aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2015-06-01 18:02:55 +0100
committerMichael Brown <mcb30@ipxe.org>2015-06-01 18:02:55 +0100
commit6b7157c233541a4cb3c90021e8ca219b0b5dd358 (patch)
tree242b1ad3133977f4bfb1fb0f83bb83dd8f968456 /src
parent6d195c5669b3d4c728074a78f0dab9085a012734 (diff)
downloadipxe-6b7157c233541a4cb3c90021e8ca219b0b5dd358.zip
ipxe-6b7157c233541a4cb3c90021e8ca219b0b5dd358.tar.gz
ipxe-6b7157c233541a4cb3c90021e8ca219b0b5dd358.tar.bz2
[ipoib] Fix REMAC cache discarder
Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/net/ipoib.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c
index 369ebe4..7250f84 100644
--- a/src/drivers/net/ipoib.c
+++ b/src/drivers/net/ipoib.c
@@ -100,6 +100,8 @@ struct errortab ipoib_errors[] __errortab = {
__einfo_errortab ( EINFO_EINPROGRESS_JOINING ),
};
+static struct net_device_operations ipoib_operations;
+
/****************************************************************************
*
* IPoIB REMAC cache
@@ -206,14 +208,20 @@ static void ipoib_flush_remac ( struct ipoib_device *ipoib ) {
* @ret discarded Number of cached items discarded
*/
static unsigned int ipoib_discard_remac ( void ) {
- struct ib_device *ibdev;
+ struct net_device *netdev;
struct ipoib_device *ipoib;
struct ipoib_peer *peer;
unsigned int discarded = 0;
/* Try to discard one cache entry for each IPoIB device */
- for_each_ibdev ( ibdev ) {
- ipoib = ib_get_ownerdata ( ibdev );
+ for_each_netdev ( netdev ) {
+
+ /* Skip non-IPoIB devices */
+ if ( netdev->op != &ipoib_operations )
+ continue;
+ ipoib = netdev->priv;
+
+ /* Discard least recently used cache entry (if any) */
list_for_each_entry_reverse ( peer, &ipoib->peers, list ) {
list_del ( &peer->list );
free ( peer );