Browse Source

[ipoib] Fix REMAC cache discarder

Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
6b7157c233
1 changed files with 11 additions and 3 deletions
  1. 11
    3
      src/drivers/net/ipoib.c

+ 11
- 3
src/drivers/net/ipoib.c View File

@@ -100,6 +100,8 @@ struct errortab ipoib_errors[] __errortab = {
100 100
 	__einfo_errortab ( EINFO_EINPROGRESS_JOINING ),
101 101
 };
102 102
 
103
+static struct net_device_operations ipoib_operations;
104
+
103 105
 /****************************************************************************
104 106
  *
105 107
  * IPoIB REMAC cache
@@ -206,14 +208,20 @@ static void ipoib_flush_remac ( struct ipoib_device *ipoib ) {
206 208
  * @ret discarded	Number of cached items discarded
207 209
  */
208 210
 static unsigned int ipoib_discard_remac ( void ) {
209
-	struct ib_device *ibdev;
211
+	struct net_device *netdev;
210 212
 	struct ipoib_device *ipoib;
211 213
 	struct ipoib_peer *peer;
212 214
 	unsigned int discarded = 0;
213 215
 
214 216
 	/* Try to discard one cache entry for each IPoIB device */
215
-	for_each_ibdev ( ibdev ) {
216
-		ipoib = ib_get_ownerdata ( ibdev );
217
+	for_each_netdev ( netdev ) {
218
+
219
+		/* Skip non-IPoIB devices */
220
+		if ( netdev->op != &ipoib_operations )
221
+			continue;
222
+		ipoib = netdev->priv;
223
+
224
+		/* Discard least recently used cache entry (if any) */
217 225
 		list_for_each_entry_reverse ( peer, &ipoib->peers, list ) {
218 226
 			list_del ( &peer->list );
219 227
 			free ( peer );

Loading…
Cancel
Save