IPoIB: Improve parent interface p_key handling.
PATCH 1/1 IPoIB: Improve parent interface p_key handling.
Resending as there was a typo in Subject line.
----------------------
With reference to commit c2904141696ee19551f1553944446f23cdd5d95e. It was noticed that parent interface keeps sending broadcast group join requests if p_key index 0 is invalid. That creates unnecessary noise on a fabric:
ib0: multicast join failed for ff12:401b:8000:0000:0000:0000:ffff:ffff,
status -22
Proposed patch re-init resources, then brings interface
up only if p_key idx 0 is valid either on bootup or on PKEY_CHANGE event. Otherwise it keeps interface quiet.
--- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_ib.c +16 -9
@@ -669,6 +669,12 @@ int ipoib_ib_dev_open(struct net_device *dev)struct ipoib_dev_priv *priv =netdev_priv (dev);int ret; +if (!(priv->pkey &0x7fff )) { +ipoib_warn (priv,"Invalid P_Key\n" ); +clear_bit (IPOIB_PKEY_ASSIGNED , &priv->flags); +return -1 ; + } +if (ib_find_pkey (priv->ca, priv->port, priv->pkey, &priv->pkey_index)) {ipoib_warn (priv,"P_Key 0x%04x not found\n" , priv->pkey);clear_bit (IPOIB_PKEY_ASSIGNED , &priv->flags);
@@ -714,7 +720,8 @@ static void ipoib_pkey_dev_check_presence(struct net_device *dev)struct ipoib_dev_priv *priv =netdev_priv (dev);u16 pkey_index =0 ; -if (ib_find_pkey (priv->ca, priv->port, priv->pkey, &pkey_index)) +if (!(priv->pkey &0x7fff ) || +ib_find_pkey (priv->ca, priv->port, priv->pkey, &pkey_index))clear_bit (IPOIB_PKEY_ASSIGNED , &priv->flags);else set_bit (IPOIB_PKEY_ASSIGNED , &priv->flags);
@@ -987,12 +994,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,up_read (&priv->vlan_rwsem);if (!test_bit (IPOIB_FLAG_INITIALIZED , &priv->flags)) { -/* for non-child devices must check/update the pkey value here */ -if (level ==IPOIB_FLUSH_HEAVY && - !test_bit (IPOIB_FLAG_SUBINTERFACE , &priv->flags)) -update_parent_pkey (priv); -ipoib_dbg (priv,"Not flushing - IPOIB_FLAG_INITIALIZED not set.\n" ); -return ; +if (level <IPOIB_FLUSH_HEAVY ) { +ipoib_dbg (priv,"Not flushing - IPOIB_FLAG_INITIALIZED not set.\n" ); +return ; + } }if (!test_bit (IPOIB_FLAG_ADMIN_UP , &priv->flags)) {
@@ -1038,8 +1043,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,ipoib_ib_dev_down (dev,0 );if (level ==IPOIB_FLUSH_HEAVY ) { -ipoib_ib_dev_stop (dev,0 ); -ipoib_ib_dev_open (dev); +if (test_bit (IPOIB_FLAG_INITIALIZED , &priv->flags)) +ipoib_ib_dev_stop (dev,0 ); +if (ipoib_ib_dev_open (dev) !=0 ) +return ; }/*
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20140605184010.19629.7048.stgit-u2TXY/[email protected]
Hi Alex,
it is a good idea, i have 2 comments.
Thanks, Erez
Quoted 29 lines
Resending as there was a typo in Subject line.
----------------------
With reference to commit
c2904141696ee19551f1553944446f23cdd5d95e. It was noticed that parent interface keeps sending broadcast group join requests ifp_keyindex 0 is invalid. That creates unnecessary noise on a fabric:ib0: multicast join failed for ff12:401b:8000:0000:0000:0000:ffff:ffff,
status -22Proposed patch re-init resources, then brings interface
up only ifp_keyidx 0 is valid either on bootup or onPKEY_CHANGEevent. Otherwise it keeps interface quiet.Reviewed-by Ira Weiny <[email protected]>Signed-off-by Alex Estrin <[email protected]>--- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-)drivers/infiniband/ulp/ipoib/ipoib_ib.c +0
-0@@ -669,6 +669,12 @@ int ipoib_ib_dev_open(struct net_device *dev)struct ipoib_dev_priv *priv =netdev_priv (dev);int ret;
drivers/infiniband/ulp/ipoib/ipoib_ib.c int ipoib_ib_dev_open(struct net_device *dev) · line 680
Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +6
-0+if (!(priv->pkey &0x7fff )) { +ipoib_warn (priv,"Invalid P_Key\n" ); +clear_bit (IPOIB_PKEY_ASSIGNED , &priv->flags); +return -1 ; + } +if (ib_find_pkey (priv->ca, priv->port, priv->pkey, &priv->pkey_index)) {ipoib_warn (priv,"P_Key 0x%04x not found\n" , priv->pkey);clear_bit (IPOIB_PKEY_ASSIGNED , &priv->flags);
Instead of that check here, you can call again to ipoib_pkey_dev_check_presence, one place for checking that. (like it is in ipoib_ib_dev_up)
drivers/infiniband/ulp/ipoib/ipoib_ib.c static void ipoib_pkey_dev_check_presence(struct net_device *dev) · line 724
Quoted 7 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +2
-1@@ -714,7 +720,8 @@ static void ipoib_pkey_dev_check_presence(struct net_device *dev)struct ipoib_dev_priv *priv =netdev_priv (dev);u16 pkey_index =0 ; -if (ib_find_pkey (priv->ca, priv->port, priv->pkey, &pkey_index)) +if (!(priv->pkey &0x7fff ) || +ib_find_pkey (priv->ca, priv->port, priv->pkey, &pkey_index))
Here should be the only place for checking, perhaps you will want to change the prototype of the function, to return int instead.
Quoted 9 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +0
-2clear_bit (IPOIB_PKEY_ASSIGNED , &priv->flags); else set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);@@ -987,12 +994,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,up_read (&priv->vlan_rwsem);if (!test_bit (IPOIB_FLAG_INITIALIZED , &priv->flags)) { -/* for non-child devices must check/update the pkey value here */ - if (level == IPOIB_FLUSH_HEAVY &&
drivers/infiniband/ulp/ipoib/ipoib_ib.c static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, · line 1002
Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +4
-4- !test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) -update_parent_pkey (priv); -ipoib_dbg (priv,"Not flushing - IPOIB_FLAG_INITIALIZED not set.\n" ); -return ; +if (level <IPOIB_FLUSH_HEAVY ) { +ipoib_dbg (priv,"Not flushing - IPOIB_FLAG_INITIALIZED not set.\n" ); +return ; + } }
i think that you cannot skip the call for update_parent_pkey, otherwise if the pkey value in index 0 was changed before the bit IPOIB_FLAG_INITIALIZED was set, the pkey will not be updated. so, IMHO you can leave the code at that point, as it was before.
Quoted 16 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +4
-3if (!test_bit (IPOIB_FLAG_ADMIN_UP , &priv->flags)) {@@ -1038,8 +1043,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,ipoib_ib_dev_down (dev,0 );if (level ==IPOIB_FLUSH_HEAVY ) { -ipoib_ib_dev_stop (dev,0 ); -ipoib_ib_dev_open (dev); +if (test_bit (IPOIB_FLAG_INITIALIZED , &priv->flags)) +ipoib_ib_dev_stop (dev,0 ); +if (ipoib_ib_dev_open (dev) !=0 ) +return ; }/* --
Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Erez,
Please see below.
Thanks,
Alex.
Quoted 42 lines
-----Original Message-----
From: Erez Shitrit [mailto:[email protected]]
Sent: Sunday, June 08, 2014 9:07 AM
To: Estrin, Alex
Cc: Roland Dreier; [email protected]
Subject: Re: [PATCH 1/1] IPoIB: Improve parent interfacep_keyhandling.Hi Alex,
it is a good idea, i have 2 comments.Thanks, Erez
Quoted 16 lines
Resending as there was a typo in Subject line.
----------------------
With reference to commit
c2904141696ee19551f1553944446f23cdd5d95e. It was noticed that parent interface keeps sending broadcast group join requests ifp_keyindex 0 is invalid. That creates unnecessary noise on a fabric:ib0: multicast join failed for ff12:401b:8000:0000:0000:0000:ffff:ffff,
status -22Proposed patch re-init resources, then brings interface
up only ifp_keyidx 0 is valid either on bootup or onPKEY_CHANGEevent. Otherwise it keeps interface quiet.Review
Quoted 7 lines
Reviewed-by Ira Weiny <[email protected]>Signed-off-by Alex Estrin <[email protected]>--- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-)(quoted diff) +0
-0
b/drivers/infiniband/ulp/ipoib/ipoib_ib.cQuoted 7 lines
index 6a7003d..3201fe5 100644
drivers/infiniband/ulp/ipoib/ipoib_ib.c +0
-0@@ -669,6 +669,12 @@ int ipoib_ib_dev_open(struct net_device *dev)struct ipoib_dev_priv *priv =netdev_priv (dev);int ret;
Quoted 13 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c int ipoib_ib_dev_open(struct net_device *dev) · line 680
Quoted 9 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +6
-0+if (!(priv->pkey &0x7fff )) { +ipoib_warn (priv,"Invalid P_Key\n" ); +clear_bit (IPOIB_PKEY_ASSIGNED , &priv->flags); +return -1 ; + } +if (ib_find_pkey (priv->ca, priv->port, priv->pkey, &priv->pkey_index)) {ipoib_warn (priv,"P_Key 0x%04x not found\n" , priv->pkey);clear_bit (IPOIB_PKEY_ASSIGNED , &priv->flags);Instead of that check here, you can call again to
ipoib_pkey_dev_check_presence, one place for checking that. (like it is inipoib_ib_dev_up)
Agreed, that would be a better way.
Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c static void ipoib_pkey_dev_check_presence(struct
Quoted 1 line
drivers/infiniband/ulp/ipoib/ipoib_ib.c +0
-0@@ -714,7 +720,8 @@ static void ipoib_pkey_dev_check_presence(struct
net_device*dev)drivers/infiniband/ulp/ipoib/ipoib_ib.c static void ipoib_pkey_dev_check_presence(struct net_device *dev) · line 724
Quoted 6 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +2
-1struct ipoib_dev_priv *priv =netdev_priv (dev);u16 pkey_index =0 ; -if (ib_find_pkey (priv->ca, priv->port, priv->pkey, &pkey_index)) +if (!(priv->pkey &0x7fff ) || +ib_find_pkey (priv->ca, priv->port, priv->pkey, &pkey_index))Here should be the only place for checking, perhaps you will want to change the prototype of the function, to return int instead.
Most likely no need to change function prototype, since we already have flag IPOIB_PKEY_ASSIGNED indication.
Quoted 16 lines
Quoted 5 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +0
-0clear_bit (IPOIB_PKEY_ASSIGNED , &priv->flags); else set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);@@ -987,12 +994,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,up_read (&priv->vlan_rwsem);drivers/infiniband/ulp/ipoib/ipoib_ib.c static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, · line 998
Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +2
-6if (!test_bit (IPOIB_FLAG_INITIALIZED , &priv->flags)) { -/* for non-child devices must check/update the pkey value here */ -if (level ==IPOIB_FLUSH_HEAVY && - !test_bit (IPOIB_FLAG_SUBINTERFACE , &priv->flags)) -update_parent_pkey (priv); -ipoib_dbg (priv,"Not flushing - IPOIB_FLAG_INITIALIZED not set.\n" ); -return ; +if (level <IPOIB_FLUSH_HEAVY ) { + ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED notset.\n");
Quoted 8 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, · line 1002
Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +2
-0+return ; + } }i think that you cannot skip the call for
update_parent_pkey, otherwise if the pkey value in index 0 was changed before the bitIPOIB_FLAG_INITIALIZEDwas set, the pkey will not be updated. so, IMHO you can leave the code at that point, as it was before.
Please note , if IPOIB_FLAG_INITIALIZED is not set, flush handler will return for all other levels but IPOIB_FLUSH_HEAVY (which corresponds to PKEY_CHANGE event) so call 'update_parent_pkey()' will always fire a few lines later in the code:
if (test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
................................
} else {
result = update_parent_pkey(priv);
................................Then result analyzed for further action.
If pkey transitioned from invalid to valid then ipoib_ib_dev_open() follows its normal flow, If pkey changed from valid to invalid, then ipoib_ib_dev_open() early return will prevent multicast task to re-start.
Quoted 13 lines
Quoted 13 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +4
-2if (!test_bit (IPOIB_FLAG_ADMIN_UP , &priv->flags)) {@@ -1038,8 +1043,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,ipoib_ib_dev_down (dev,0 );if (level ==IPOIB_FLUSH_HEAVY ) { -ipoib_ib_dev_stop (dev,0 ); -ipoib_ib_dev_open (dev); +if (test_bit (IPOIB_FLAG_INITIALIZED , &priv->flags)) +ipoib_ib_dev_stop (dev,0 ); +if (ipoib_ib_dev_open (dev) !=0 ) +return ; }
Quoted 7 lines
Quoted 7 lines
drivers/infiniband/ulp/ipoib/ipoib_ib.c +0
-1/* -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html