[ipxe-devel] [PATCH] [ipoib] Fix cache discarder
Wissam Shoukair
wissams at mellanox.com
Tue Jan 13 11:02:01 UTC 2015
Hi,
We found an issue in ipoib_discard_remac().
1. IPoIB discarder is not valid for non-Infiniband devices.
2. owner data in ibdev is netdev struct pointer and not ipoib struct pointer.
This bug made some servers hang when trying to do HTTP boot over IB.
Thanks,
Wissam Shoukair
Mellanox Technologies IT
Issue: 466447
Signed-off-by: Wissam Shoukair <wissams at mellanox.com>
---
src/drivers/net/ipoib.c | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c index b18c6d5..679cbff 100644
--- a/src/drivers/net/ipoib.c
+++ b/src/drivers/net/ipoib.c
@@ -98,6 +98,20 @@ struct errortab ipoib_errors[] __errortab = {
__einfo_errortab ( EINFO_EINPROGRESS_JOINING ), };
+static int ipoib_open ( struct net_device *netdev ); static void
+ipoib_close ( struct net_device *netdev ); static int ipoib_transmit (
+struct net_device *netdev,
+ struct io_buffer *iobuf );
+static void ipoib_poll ( struct net_device *netdev );
+
+/** IPoIB network device operations */
+static struct net_device_operations ipoib_operations = {
+ .open = ipoib_open,
+ .close = ipoib_close,
+ .transmit = ipoib_transmit,
+ .poll = ipoib_poll,
+};
+
/****************************************************************************
*
* IPoIB REMAC cache
@@ -205,13 +219,22 @@ static void ipoib_flush_remac ( struct ipoib_device *ipoib ) {
*/
static unsigned int ipoib_discard_remac ( void ) {
struct ib_device *ibdev;
+ struct net_device *netdev;
struct ipoib_device *ipoib;
struct ipoib_peer *peer, *tmp;
unsigned int discarded = 0;
/* Try to discard one cache entry for each IPoIB device */
for_each_ibdev ( ibdev ) {
- ipoib = ib_get_ownerdata ( ibdev );
+ netdev = ib_get_ownerdata ( ibdev );
+ /* Skip non-Infiniband ports */
+ if ( netdev->op != &ipoib_operations )
+ continue;
+
+ ipoib = netdev->priv;
+ if ( list_empty ( &ipoib->peers ) )
+ return 0;
+
list_for_each_entry_reverse_safe ( peer, tmp, &ipoib->peers, list ) {
list_del ( &peer->list );
free ( peer );
@@ -900,14 +923,6 @@ static void ipoib_close ( struct net_device *netdev ) {
ib_close ( ibdev );
}
-/** IPoIB network device operations */
-static struct net_device_operations ipoib_operations = {
- .open = ipoib_open,
- .close = ipoib_close,
- .transmit = ipoib_transmit,
- .poll = ipoib_poll,
-};
-
uint8_t mellanox_general_client_id[MAX_LL_ADDR_LEN] = {255,0,0,0,0,0,2,0,0,2,0xC9,0,0,0,0,0,0,0,0,0};
/**
* Probe IPoIB device
--
1.7.11.1
More information about the ipxe-devel
mailing list