david/ipxe
Archived
1
0

[ipoib] Fix REMAC cache discarder

Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2015-06-01 18:02:55 +01:00
parent 6d195c5669
commit 6b7157c233

View File

@ -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 );