| Message ID | 20251022161143.370040-1-robert.malz@canonical.com |
|---|---|
| State | Accepted |
| Delegated to: | Anthony Nguyen |
| Headers | show |
| Series | [v2] i40e: avoid redundant VF link state updates | expand |
> -----Original Message----- > From: Robert Malz <robert.malz@canonical.com> > Sent: Wednesday, October 22, 2025 6:12 PM > To: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org > Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, > Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn > <andrew+netdev@lunn.ch>; David S . Miller <davem@davemloft.net>; Eric > Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo > Abeni <pabeni@redhat.com>; Simon Horman <horms@kernel.org>; Loktionov, > Aleksandr <aleksandr.loktionov@intel.com>; Czapnik, Lukasz > <lukasz.czapnik@intel.com>; Robert Malz <robert.malz@canonical.com>; > Jamie Bainbridge <jamie.bainbridge@gmail.com>; Jay Vosburgh > <jay.vosburgh@canonical.com>; Dennis Chen <dechen@redhat.com>; Keller, > Jacob E <jacob.e.keller@intel.com>; Michal Swiatkowski > <michal.swiatkowski@linux.intel.com> > Subject: [PATCH v2] i40e: avoid redundant VF link state updates > > From: Jay Vosburgh <jay.vosburgh@canonical.com> > > Multiple sources can request VF link state changes with identical > parameters. For example, OpenStack Neutron may request to set the VF > link state to IFLA_VF_LINK_STATE_AUTO during every initialization or > user can > issue: `ip link set <ifname> vf 0 state auto` multiple times. > Currently, the i40e driver processes each of these requests, even if > the requested state is the same as the current one. This leads to > unnecessary VF resets and can cause performance degradation or > instability in the VF driver, particularly in environment using Data > Plane Development Kit (DPDK). > > With this patch i40e will skip VF link state change requests when the > desired link state matches the current configuration. This prevents > unnecessary VF resets and reduces PF-VF communication overhead. > > To reproduce the problem run following command multiple times on the > same interface: 'ip link set <ifname> vf 0 state auto' > Every time command is executed, PF driver will trigger VF reset. > > Co-developed-by: Robert Malz <robert.malz@canonical.com> > Signed-off-by: Robert Malz <robert.malz@canonical.com> > Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com> > > --- > V1 -> V2: updated commit message, added information how to reproduce > > drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c > b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c > index 081a4526a2f0..0fe0d52c796b 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c > +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c > @@ -4788,6 +4788,7 @@ int i40e_ndo_set_vf_link_state(struct net_device > *netdev, int vf_id, int link) > unsigned long q_map; > struct i40e_vf *vf; > int abs_vf_id; > + int old_link; > int ret = 0; > int tmp; > > @@ -4806,6 +4807,17 @@ int i40e_ndo_set_vf_link_state(struct > net_device *netdev, int vf_id, int link) > vf = &pf->vf[vf_id]; > abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; > > + /* skip VF link state change if requested state is already set > */ > + if (!vf->link_forced) > + old_link = IFLA_VF_LINK_STATE_AUTO; > + else if (vf->link_up) > + old_link = IFLA_VF_LINK_STATE_ENABLE; > + else > + old_link = IFLA_VF_LINK_STATE_DISABLE; > + > + if (link == old_link) > + goto error_out; > + > pfe.event = VIRTCHNL_EVENT_LINK_CHANGE; > pfe.severity = PF_EVENT_SEVERITY_INFO; > > -- > 2.34.1 Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> -----Original Message----- > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of > Robert Malz > Sent: Wednesday, October 22, 2025 6:12 PM > To: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org > Cc: Jamie Bainbridge <jamie.bainbridge@gmail.com>; Michal Swiatkowski > <michal.swiatkowski@linux.intel.com>; Dennis Chen <dechen@redhat.com>; > Robert Malz <robert.malz@canonical.com>; Kitszel, Przemyslaw > <przemyslaw.kitszel@intel.com>; Czapnik, Lukasz > <lukasz.czapnik@intel.com>; Loktionov, Aleksandr > <aleksandr.loktionov@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>; > Eric Dumazet <edumazet@google.com>; Nguyen, Anthony L > <anthony.l.nguyen@intel.com>; Simon Horman <horms@kernel.org>; Keller, > Jacob E <jacob.e.keller@intel.com>; Jakub Kicinski <kuba@kernel.org>; Paolo > Abeni <pabeni@redhat.com>; David S . Miller <davem@davemloft.net> > Subject: [Intel-wired-lan] [PATCH v2] i40e: avoid redundant VF link state > updates > > From: Jay Vosburgh <jay.vosburgh@canonical.com> > > Multiple sources can request VF link state changes with identical parameters. > For example, OpenStack Neutron may request to set the VF link state to > IFLA_VF_LINK_STATE_AUTO during every initialization or user can > issue: `ip link set <ifname> vf 0 state auto` multiple times. Currently, the i40e > driver processes each of these requests, even if the requested state is the > same as the current one. This leads to unnecessary VF resets and can cause > performance degradation or instability in the VF driver, particularly in > environment using Data Plane Development Kit (DPDK). > > With this patch i40e will skip VF link state change requests when the desired > link state matches the current configuration. This prevents unnecessary VF > resets and reduces PF-VF communication overhead. > > To reproduce the problem run following command multiple times on the same > interface: 'ip link set <ifname> vf 0 state auto' > Every time command is executed, PF driver will trigger VF reset. > > Co-developed-by: Robert Malz <robert.malz@canonical.com> > Signed-off-by: Robert Malz <robert.malz@canonical.com> > Signed-off-by: Jay Vosburgh <jay.vosburgh@canonical.com> > > --- > V1 -> V2: updated commit message, added information how to reproduce > > drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 081a4526a2f0..0fe0d52c796b 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -4788,6 +4788,7 @@ int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link) unsigned long q_map; struct i40e_vf *vf; int abs_vf_id; + int old_link; int ret = 0; int tmp; @@ -4806,6 +4807,17 @@ int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link) vf = &pf->vf[vf_id]; abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; + /* skip VF link state change if requested state is already set */ + if (!vf->link_forced) + old_link = IFLA_VF_LINK_STATE_AUTO; + else if (vf->link_up) + old_link = IFLA_VF_LINK_STATE_ENABLE; + else + old_link = IFLA_VF_LINK_STATE_DISABLE; + + if (link == old_link) + goto error_out; + pfe.event = VIRTCHNL_EVENT_LINK_CHANGE; pfe.severity = PF_EVENT_SEVERITY_INFO;