> -----Original Message-----
> From: Mandal, Anurag <[email protected]>
> Sent: 09 June 2026 16:24
> To: Loftus, Ciara <[email protected]>; [email protected]
> Cc: Richardson, Bruce <[email protected]>; Medvedkin, Vladimir
> <[email protected]>; [email protected]
> Subject: RE: [PATCH] net/iavf: fix to consolidate link change event handling
> 
> 
> > -----Original Message-----
> > From: Loftus, Ciara <[email protected]>
> > Sent: 09 June 2026 15:32
> > To: Mandal, Anurag <[email protected]>; [email protected]
> > Cc: Richardson, Bruce <[email protected]>; Medvedkin,
> > Vladimir <[email protected]>; [email protected]
> > Subject: RE: [PATCH] net/iavf: fix to consolidate link change event
> > handling
> >
> > > Subject: [PATCH] net/iavf: fix to consolidate link change event
> > > handling
> > >
> > > Handled link-change events through a common static function that
> > > reads the correct advanced & legacy link fields properly and updates
> > > no-poll/watchdog/LSC state consistently.
> > >
> > > Fixes: 5e03e316c753 ("net/iavf: handle virtchnl event message
> > > without
> > > interrupt")
> > > Fixes: 48de41ca11f0 ("net/avf: enable link status update")
> > > Cc: [email protected]
> > >
> > > Signed-off-by: Anurag Mandal <[email protected]>
> > > ---
> > >  drivers/net/intel/iavf/iavf_vchnl.c | 133
> > > +++++++++++++++++-----------
> > >  1 file changed, 81 insertions(+), 52 deletions(-)
> > >
> > > diff --git a/drivers/net/intel/iavf/iavf_vchnl.c
> > > b/drivers/net/intel/iavf/iavf_vchnl.c
> > > index 94ccfb5d6e..6454632541 100644
> > > --- a/drivers/net/intel/iavf/iavf_vchnl.c
> > > +++ b/drivers/net/intel/iavf/iavf_vchnl.c
> > > @@ -216,6 +216,75 @@ iavf_convert_link_speed(enum
> > > virtchnl_link_speed
> > > virt_link_speed)
> > >   return speed;
> > >  }
> > >
> > > +/*
> > > + * iavf_handle_link_change_event: common handler for VIRTCHNL link
> > > change events
> > > + *
> > > + * @dev: pointer to rte_eth_dev for this VF
> > > + * @vpe: pointer to the virtchnl_pf_event payload received from the
> > > +PF
> > > + *
> > > + * Handle PF link-change event: decode adv/legacy link info, update
> > > +VF
> > > + * link state, sync no-poll/watchdog behavior & notify app via LSC event.
> > > + */
> > > +static void
> > > +iavf_handle_link_change_event(struct rte_eth_dev *dev,
> > > +                       struct virtchnl_pf_event *vpe) {
> > > + struct iavf_adapter *adapter;
> > > + struct iavf_info *vf;
> > > + bool adv_link_speed;
> > > +
> > > + if (dev == NULL || dev->data == NULL ||
> > > +     dev->data->dev_private == NULL || vpe == NULL) {
> > > +         PMD_DRV_LOG(ERR, "Invalid device pointer in link change
> > > handler");
> > > +         return;
> > > + }
> >
> > Thanks for splitting this out into a standalone patch.
> > I'm not sure if all of the above NULL checking is necessary.
> > Especially vpe == NULL considering you've checked that for NULL in
> > both iavf_read_msg_from_pf and iavf_handle_pf_event_msg before
> > entering this function. It's recommended to avoid overly defensive
> > checks that can never trigger so I suggest taking a look at this again. 
> > Other
> than that the changes looks good to me.
> 
> Hi Ciara,
> 
> Thanks for the review. Initially I also did not add. Then I added it as per
> suggestions from ai-code-review run by DPDK. Funny thing is now, it is saying 
> "
> overly defensive checks". So not sure, which suggestion of ai-cdoe-review to
> follow.
> Please guide. Will act accordingly.
> 
> Thanks,
> Anuarg

Hi Ciara,

I have removed those overly defensive NULL checks and sent v2 for the review.

Thanks,
Anurag 

> 
> >
> > > +
> > > + adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data-
> > > >dev_private);
> > > + vf = &adapter->vf;
> > > +
> > > + adv_link_speed = (vf->vf_res != NULL) &&
> > > +         ((vf->vf_res->vf_cap_flags &
> > > VIRTCHNL_VF_CAP_ADV_LINK_SPEED) != 0);
> > > +

Reply via email to