summaryrefslogtreecommitdiff
path: root/components/net/netdev
diff options
context:
space:
mode:
authorHubretXie <[email protected]>2019-06-09 13:55:19 +0800
committerGitHub <[email protected]>2019-06-09 13:55:19 +0800
commit5a5ea94928061548e5c59dd6cd070eaaeb347213 (patch)
tree4d88994e08184bc0aa297dfc20c70ca3906d36b1 /components/net/netdev
parent36ffdc058b3aeb447d74dd916c26e1dd80b80def (diff)
parentcf7052f6b7502c20f28eae5b9c096978c7f3a98f (diff)
Merge pull request #6 from RT-Thread/master
sync
Diffstat (limited to 'components/net/netdev')
-rw-r--r--components/net/netdev/include/netdev.h1
-rw-r--r--components/net/netdev/src/netdev.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/components/net/netdev/include/netdev.h b/components/net/netdev/include/netdev.h
index e9d8e38658..0be2a2bda3 100644
--- a/components/net/netdev/include/netdev.h
+++ b/components/net/netdev/include/netdev.h
@@ -138,6 +138,7 @@ struct netdev *netdev_get_by_ipaddr(ip_addr_t *ip_addr);
struct netdev *netdev_get_by_name(const char *name);
#ifdef RT_USING_SAL
struct netdev *netdev_get_by_family(int family);
+int netdev_family_get(struct netdev *netdev);
#endif /* RT_USING_SAL */
/* Set default network interface device in list */
diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c
index 71b1ec7ccd..5f49a46f17 100644
--- a/components/net/netdev/src/netdev.c
+++ b/components/net/netdev/src/netdev.c
@@ -294,6 +294,20 @@ struct netdev *netdev_get_by_family(int family)
return RT_NULL;
}
+/**
+ * This function will get the family type from network interface device
+ *
+ * @param netdev network interface device object
+ *
+ * @return the network interface device family type
+ */
+int netdev_family_get(struct netdev *netdev)
+{
+ RT_ASSERT(netdev);
+
+ return ((struct sal_proto_family *)netdev->sal_user_data)->family;
+}
+
#endif /* RT_USING_SAL */
/**