diff mbox

[v1,11/11] IB/rxe: Handle NETDEV_CHANGE events

Message ID 1503687956-7110-12-git-send-email-andrew.boyer@dell.com (mailing list archive)
State Superseded
Headers show

Commit Message

Andrew Boyer Aug. 25, 2017, 7:05 p.m. UTC
Without this fix, ports configured on top of ixgbe miss link up
notifications. ibv_query_port() will continue to return IBV_PORT_DOWN even
though the port is up and working.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
---
 drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Yuval Shaia Aug. 27, 2017, 10:30 a.m. UTC | #1
On Fri, Aug 25, 2017 at 03:05:56PM -0400, Andrew Boyer wrote:
> Without this fix, ports configured on top of ixgbe miss link up
> notifications. ibv_query_port() will continue to return IBV_PORT_DOWN even
> though the port is up and working.
> 
> Fixes: 8700e3e7c485 ("Soft RoCE driver")
> Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index 3ba76e7..133c6c4 100644
> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -651,8 +651,13 @@ static int rxe_notify(struct notifier_block *not_blk,
>  		pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu);
>  		rxe_set_mtu(rxe, ndev->mtu);
>  		break;
> -	case NETDEV_REBOOT:
>  	case NETDEV_CHANGE:
> +		if (netif_running(ndev) && netif_carrier_ok(ndev))
> +			rxe_port_up(rxe, port_num);

On top of which branch/patch this patch is based on?

> +		else
> +			rxe_port_down(rxe, port_num);
> +		break;
> +	case NETDEV_REBOOT:
>  	case NETDEV_GOING_DOWN:
>  	case NETDEV_CHANGEADDR:
>  	case NETDEV_CHANGENAME:
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot Aug. 27, 2017, 11 p.m. UTC | #2
Hi Andrew,

[auto build test ERROR on rdma/master]
[also build test ERROR on v4.13-rc6 next-20170825]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andrew-Boyer/IB-rxe-Bug-fixes/20170828-060737
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git master
config: i386-randconfig-x001-201735 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/infiniband//sw/rxe/rxe_net.c: In function 'rxe_notify':
>> drivers/infiniband//sw/rxe/rxe_net.c:656:21: error: 'port_num' undeclared (first use in this function)
       rxe_port_up(rxe, port_num);
                        ^~~~~~~~
   drivers/infiniband//sw/rxe/rxe_net.c:656:21: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/infiniband//sw/rxe/rxe_net.c:656:4: error: too many arguments to function 'rxe_port_up'
       rxe_port_up(rxe, port_num);
       ^~~~~~~~~~~
   drivers/infiniband//sw/rxe/rxe_net.c:604:6: note: declared here
    void rxe_port_up(struct rxe_dev *rxe)
         ^~~~~~~~~~~
>> drivers/infiniband//sw/rxe/rxe_net.c:658:4: error: too many arguments to function 'rxe_port_down'
       rxe_port_down(rxe, port_num);
       ^~~~~~~~~~~~~
   drivers/infiniband//sw/rxe/rxe_net.c:617:6: note: declared here
    void rxe_port_down(struct rxe_dev *rxe)
         ^~~~~~~~~~~~~

vim +/port_num +656 drivers/infiniband//sw/rxe/rxe_net.c

   628	
   629	static int rxe_notify(struct notifier_block *not_blk,
   630			      unsigned long event,
   631			      void *arg)
   632	{
   633		struct net_device *ndev = netdev_notifier_info_to_dev(arg);
   634		struct rxe_dev *rxe = net_to_rxe(ndev);
   635	
   636		if (!rxe)
   637			goto out;
   638	
   639		switch (event) {
   640		case NETDEV_UNREGISTER:
   641			list_del(&rxe->list);
   642			rxe_remove(rxe);
   643			break;
   644		case NETDEV_UP:
   645			rxe_port_up(rxe);
   646			break;
   647		case NETDEV_DOWN:
   648			rxe_port_down(rxe);
   649			break;
   650		case NETDEV_CHANGEMTU:
   651			pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu);
   652			rxe_set_mtu(rxe, ndev->mtu);
   653			break;
   654		case NETDEV_CHANGE:
   655			if (netif_running(ndev) && netif_carrier_ok(ndev))
 > 656				rxe_port_up(rxe, port_num);
   657			else
 > 658				rxe_port_down(rxe, port_num);
   659			break;
   660		case NETDEV_REBOOT:
   661		case NETDEV_GOING_DOWN:
   662		case NETDEV_CHANGEADDR:
   663		case NETDEV_CHANGENAME:
   664		case NETDEV_FEAT_CHANGE:
   665		default:
   666			pr_info("ignoring netdev event = %ld for %s\n",
   667				event, ndev->name);
   668			break;
   669		}
   670	out:
   671		return NOTIFY_OK;
   672	}
   673	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Andrew Boyer Aug. 28, 2017, 12:38 p.m. UTC | #3
On 8/27/17, 6:30 AM, "Yuval Shaia" <yuval.shaia@oracle.com> wrote:

>On Fri, Aug 25, 2017 at 03:05:56PM -0400, Andrew Boyer wrote:
>> Without this fix, ports configured on top of ixgbe miss link up
>> notifications. ibv_query_port() will continue to return IBV_PORT_DOWN
>>even
>> though the port is up and working.
>> 
>> Fixes: 8700e3e7c485 ("Soft RoCE driver")
>> Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
>> ---
>>  drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c
>>b/drivers/infiniband/sw/rxe/rxe_net.c
>> index 3ba76e7..133c6c4 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_net.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
>> @@ -651,8 +651,13 @@ static int rxe_notify(struct notifier_block
>>*not_blk,
>>  		pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu);
>>  		rxe_set_mtu(rxe, ndev->mtu);
>>  		break;
>> -	case NETDEV_REBOOT:
>>  	case NETDEV_CHANGE:
>> +		if (netif_running(ndev) && netif_carrier_ok(ndev))
>> +			rxe_port_up(rxe, port_num);
>
>On top of which branch/patch this patch is based on?

Yikes, it relies on an internal patch that Doug wasn¹t interested in
taking. Will respin.

>
>> +		else
>> +			rxe_port_down(rxe, port_num);
>> +		break;
>> +	case NETDEV_REBOOT:
>>  	case NETDEV_GOING_DOWN:
>>  	case NETDEV_CHANGEADDR:
>>  	case NETDEV_CHANGENAME:
>> -- 
>> 1.8.3.1
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
>> the body of a message to majordomo@vger.kernel.org
>> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Aug. 28, 2017, 1:37 p.m. UTC | #4
On 8/28/2017 8:38 AM, Boyer, Andrew wrote:
> 
> On 8/27/17, 6:30 AM, "Yuval Shaia" <yuval.shaia@oracle.com> wrote:
> 
>> On Fri, Aug 25, 2017 at 03:05:56PM -0400, Andrew Boyer wrote:
>>> Without this fix, ports configured on top of ixgbe miss link up
>>> notifications. ibv_query_port() will continue to return IBV_PORT_DOWN
>>> even
>>> though the port is up and working.
>>>
>>> Fixes: 8700e3e7c485 ("Soft RoCE driver")
>>> Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
>>> ---
>>>  drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++++-
>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c
>>> b/drivers/infiniband/sw/rxe/rxe_net.c
>>> index 3ba76e7..133c6c4 100644
>>> --- a/drivers/infiniband/sw/rxe/rxe_net.c
>>> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
>>> @@ -651,8 +651,13 @@ static int rxe_notify(struct notifier_block
>>> *not_blk,
>>>  		pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu);
>>>  		rxe_set_mtu(rxe, ndev->mtu);
>>>  		break;
>>> -	case NETDEV_REBOOT:
>>>  	case NETDEV_CHANGE:
>>> +		if (netif_running(ndev) && netif_carrier_ok(ndev))
>>> +			rxe_port_up(rxe, port_num);
>> On top of which branch/patch this patch is based on?
> Yikes, it relies on an internal patch that Doug wasn¹t interested in
> taking. Will respin.
> 

I don't remember seeing a patch come through that added rxe_port_up(),
let alone turning it away...
Andrew Boyer Aug. 28, 2017, 1:47 p.m. UTC | #5
On 8/28/17, 9:37 AM, "Doug Ledford" <dledford@redhat.com> wrote:

>On 8/28/2017 8:38 AM, Boyer, Andrew wrote:

>> 

>> On 8/27/17, 6:30 AM, "Yuval Shaia" <yuval.shaia@oracle.com> wrote:

>> 

>>> On Fri, Aug 25, 2017 at 03:05:56PM -0400, Andrew Boyer wrote:

>>>> Without this fix, ports configured on top of ixgbe miss link up

>>>> notifications. ibv_query_port() will continue to return IBV_PORT_DOWN

>>>> even

>>>> though the port is up and working.

>>>>

>>>> Fixes: 8700e3e7c485 ("Soft RoCE driver")

>>>> Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>

>>>> ---

>>>>  drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++++-

>>>>  1 file changed, 6 insertions(+), 1 deletion(-)

>>>>

>>>> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c

>>>> b/drivers/infiniband/sw/rxe/rxe_net.c

>>>> index 3ba76e7..133c6c4 100644

>>>> --- a/drivers/infiniband/sw/rxe/rxe_net.c

>>>> +++ b/drivers/infiniband/sw/rxe/rxe_net.c

>>>> @@ -651,8 +651,13 @@ static int rxe_notify(struct notifier_block

>>>> *not_blk,

>>>>  		pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu);

>>>>  		rxe_set_mtu(rxe, ndev->mtu);

>>>>  		break;

>>>> -	case NETDEV_REBOOT:

>>>>  	case NETDEV_CHANGE:

>>>> +		if (netif_running(ndev) && netif_carrier_ok(ndev))

>>>> +			rxe_port_up(rxe, port_num);

>>> On top of which branch/patch this patch is based on?

>> Yikes, it relies on an internal patch that Doug wasn¹t interested in

>> taking. Will respin.

>> 

>

>I don't remember seeing a patch come through that added rxe_port_up(),

>let alone turning it away...


It’s the port_num argument that doesn’t exist upstream. We added the
ability for RXE to support a second port (to better mimic an mlx4) but you
said it wasn’t needed.

-Andrew

>

>-- 

>Doug Ledford <dledford@redhat.com>

>    GPG Key ID: B826A3330E572FDD

>    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

>
Yuval Shaia Aug. 28, 2017, 1:50 p.m. UTC | #6
On Mon, Aug 28, 2017 at 09:37:08AM -0400, Doug Ledford wrote:
> On 8/28/2017 8:38 AM, Boyer, Andrew wrote:
> > 
> > On 8/27/17, 6:30 AM, "Yuval Shaia" <yuval.shaia@oracle.com> wrote:
> > 
> >> On Fri, Aug 25, 2017 at 03:05:56PM -0400, Andrew Boyer wrote:
> >>> Without this fix, ports configured on top of ixgbe miss link up
> >>> notifications. ibv_query_port() will continue to return IBV_PORT_DOWN
> >>> even
> >>> though the port is up and working.
> >>>
> >>> Fixes: 8700e3e7c485 ("Soft RoCE driver")
> >>> Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
> >>> ---
> >>>  drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++++-
> >>>  1 file changed, 6 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c
> >>> b/drivers/infiniband/sw/rxe/rxe_net.c
> >>> index 3ba76e7..133c6c4 100644
> >>> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> >>> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> >>> @@ -651,8 +651,13 @@ static int rxe_notify(struct notifier_block
> >>> *not_blk,
> >>>  		pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu);
> >>>  		rxe_set_mtu(rxe, ndev->mtu);
> >>>  		break;
> >>> -	case NETDEV_REBOOT:
> >>>  	case NETDEV_CHANGE:
> >>> +		if (netif_running(ndev) && netif_carrier_ok(ndev))
> >>> +			rxe_port_up(rxe, port_num);
> >> On top of which branch/patch this patch is based on?
> > Yikes, it relies on an internal patch that Doug wasn¹t interested in
> > taking. Will respin.
> > 
> 
> I don't remember seeing a patch come through that added rxe_port_up(),
> let alone turning it away...

rxe_port_up is already implemented but since RXE device has only one port i
don't see a reason to pass porn_num to this function.
I might be wrong.

> 
> -- 
> Doug Ledford <dledford@redhat.com>
>     GPG Key ID: B826A3330E572FDD
>     Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD
> 



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Aug. 28, 2017, 2:13 p.m. UTC | #7
On 8/28/2017 9:47 AM, Boyer, Andrew wrote:
> 
> 
> On 8/28/17, 9:37 AM, "Doug Ledford" <dledford@redhat.com> wrote:
> 
>> On 8/28/2017 8:38 AM, Boyer, Andrew wrote:
>>>
>>> On 8/27/17, 6:30 AM, "Yuval Shaia" <yuval.shaia@oracle.com> wrote:
>>>
>>>> On Fri, Aug 25, 2017 at 03:05:56PM -0400, Andrew Boyer wrote:
>>>>> Without this fix, ports configured on top of ixgbe miss link up
>>>>> notifications. ibv_query_port() will continue to return IBV_PORT_DOWN
>>>>> even
>>>>> though the port is up and working.
>>>>>
>>>>> Fixes: 8700e3e7c485 ("Soft RoCE driver")
>>>>> Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
>>>>> ---
>>>>>  drivers/infiniband/sw/rxe/rxe_net.c | 7 ++++++-
>>>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c
>>>>> b/drivers/infiniband/sw/rxe/rxe_net.c
>>>>> index 3ba76e7..133c6c4 100644
>>>>> --- a/drivers/infiniband/sw/rxe/rxe_net.c
>>>>> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
>>>>> @@ -651,8 +651,13 @@ static int rxe_notify(struct notifier_block
>>>>> *not_blk,
>>>>>  		pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu);
>>>>>  		rxe_set_mtu(rxe, ndev->mtu);
>>>>>  		break;
>>>>> -	case NETDEV_REBOOT:
>>>>>  	case NETDEV_CHANGE:
>>>>> +		if (netif_running(ndev) && netif_carrier_ok(ndev))
>>>>> +			rxe_port_up(rxe, port_num);
>>>> On top of which branch/patch this patch is based on?
>>> Yikes, it relies on an internal patch that Doug wasn¹t interested in
>>> taking. Will respin.
>>>
>>
>> I don't remember seeing a patch come through that added rxe_port_up(),
>> let alone turning it away...
> 
> It’s the port_num argument that doesn’t exist upstream. We added the
> ability for RXE to support a second port (to better mimic an mlx4) but you
> said it wasn’t needed.

OK.  I still don't remember the event though ;-)

Anyway, I'll wait for you to send a fixed version of the code.
diff mbox

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 3ba76e7..133c6c4 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -651,8 +651,13 @@  static int rxe_notify(struct notifier_block *not_blk,
 		pr_info("%s changed mtu to %d\n", ndev->name, ndev->mtu);
 		rxe_set_mtu(rxe, ndev->mtu);
 		break;
-	case NETDEV_REBOOT:
 	case NETDEV_CHANGE:
+		if (netif_running(ndev) && netif_carrier_ok(ndev))
+			rxe_port_up(rxe, port_num);
+		else
+			rxe_port_down(rxe, port_num);
+		break;
+	case NETDEV_REBOOT:
 	case NETDEV_GOING_DOWN:
 	case NETDEV_CHANGEADDR:
 	case NETDEV_CHANGENAME: