Просмотр исходного кода

[ipoib] Allow external code to identify IPoIB network devices

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 лет назад
Родитель
Сommit
750a2efeb2
2 измененных файлов: 19 добавлений и 0 удалений
  1. 18
    0
      src/drivers/net/ipoib.c
  2. 1
    0
      src/include/ipxe/ipoib.h

+ 18
- 0
src/drivers/net/ipoib.c Просмотреть файл

1027
 	.notify = ipoib_notify,
1027
 	.notify = ipoib_notify,
1028
 	.remove = ipoib_remove,
1028
 	.remove = ipoib_remove,
1029
 };
1029
 };
1030
+
1031
+/**
1032
+ * Find IPoIB network device
1033
+ *
1034
+ * @v ibdev		Infiniband device
1035
+ * @ret netdev		IPoIB network device, or NULL if not found
1036
+ */
1037
+struct net_device * ipoib_netdev ( struct ib_device *ibdev ) {
1038
+	struct ipoib_device *ipoib;
1039
+
1040
+	/* Find matching IPoIB device */
1041
+	list_for_each_entry ( ipoib, &ipoib_devices, list ) {
1042
+		if ( ipoib->ibdev != ibdev )
1043
+			continue;
1044
+		return ipoib->netdev;
1045
+	}
1046
+	return NULL;
1047
+}

+ 1
- 0
src/include/ipxe/ipoib.h Просмотреть файл

62
 
62
 
63
 extern const char * ipoib_ntoa ( const void *ll_addr );
63
 extern const char * ipoib_ntoa ( const void *ll_addr );
64
 extern struct net_device * alloc_ipoibdev ( size_t priv_size );
64
 extern struct net_device * alloc_ipoibdev ( size_t priv_size );
65
+extern struct net_device * ipoib_netdev ( struct ib_device *ibdev );
65
 
66
 
66
 #endif /* _IPXE_IPOIB_H */
67
 #endif /* _IPXE_IPOIB_H */

Загрузка…
Отмена
Сохранить