Subject: Re: linux-next: manual merge of the rdma tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Wed, 15 Jan 2025 12:07:32 +1100

Hi Jason,

On Tue, 14 Jan 2025 20:41:30 -0400 Jason Gunthorpe <[email-masked]> wrote:
>
> On Wed, Jan 15, 2025 at 08:27:21AM +1100, Stephen Rothwell wrote:
> > Hi Jason,
> > 
> > On Tue, 14 Jan 2025 16:48:28 -0400 Jason Gunthorpe <[email-masked]> wrote:  
> > >
> > > I think we need to retain the ib_get_curr_port_state() call:  
> > 
> > Why?   
> 
> That is how the new system is supposed to work.. Drivers are supposed
> to call ib_get_curr_port_state() not open code it. This matches what
> is in the for-next tree:
> 
>         attr->state = ib_get_curr_port_state(sdev->netdev);
>         attr->phys_state = attr->state == IB_PORT_ACTIVE ?
>                 IB_PORT_PHYS_STATE_LINK_UP : IB_PORT_PHYS_STATE_DISABLED;
> 
> > It is no longer used to determine the attr->phys-state value and
> > then attr->state is set again just below.    
> 
> Ah, missed that, it should be deleted also, and the phys_state should
> use the other hunk too:
> 
> --- drivers/infiniband/sw/siw/siw_verbs.c       2025-01-14 16:37:02.023738738 -0400
> +++ /home/jgg/oss/testing-k.o/drivers/infiniband/sw/siw/siw_verbs.c     2025-01-14 20:38:42.611302948 -0400
> @@ -189,10 +189,9 @@
>         attr->max_msg_sz = -1;
>         attr->max_mtu = ib_mtu_int_to_enum(ndev->max_mtu);
>         attr->active_mtu = ib_mtu_int_to_enum(READ_ONCE(ndev->mtu));
> -       attr->phys_state = (netif_running(ndev) && netif_carrier_ok(ndev)) ?
> +       attr->state = ib_get_curr_port_state(ndev);
> +       attr->phys_state = attr->state == IB_PORT_ACTIVE ?
>                 IB_PORT_PHYS_STATE_LINK_UP : IB_PORT_PHYS_STATE_DISABLED;
> -       attr->state = attr->phys_state == IB_PORT_PHYS_STATE_LINK_UP ?
> -               IB_PORT_ACTIVE : IB_PORT_DOWN;
>         attr->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_DEVICE_MGMT_SUP;
>         /*
>          * All zero

Thanks, I have updated my resolution to that today.

-- 
Cheers,
Stephen Rothwell