Commit 7c3c288b authored by Anjali Singhai Jain's avatar Anjali Singhai Jain Committed by Jeff Kirsher

i40e: Patch to enable Ethtool/netdev feature flag for NTUPLE control

This enables option '-k/-K' in ethtool for NTUPLE control.
NTUPLE control requires a reset, to take effect. When the feature is
turned off, the SW list of stored FD SB filters gets cleaned up.

Change-ID: I9d564b67a10d4afa11de3b320d601c3d2e6edc1f
Signed-off-by: default avatarAnjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: default avatarCatherine Sullivan <catherine.sullivan@intel.com>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 30a500e2
...@@ -558,6 +558,7 @@ int i40e_add_del_fdir(struct i40e_vsi *vsi, ...@@ -558,6 +558,7 @@ int i40e_add_del_fdir(struct i40e_vsi *vsi,
struct i40e_fdir_filter *input, bool add); struct i40e_fdir_filter *input, bool add);
void i40e_fdir_check_and_reenable(struct i40e_pf *pf); void i40e_fdir_check_and_reenable(struct i40e_pf *pf);
int i40e_get_current_fd_count(struct i40e_pf *pf); int i40e_get_current_fd_count(struct i40e_pf *pf);
bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features);
void i40e_set_ethtool_ops(struct net_device *netdev); void i40e_set_ethtool_ops(struct net_device *netdev);
struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,
u8 *macaddr, s16 vlan, u8 *macaddr, s16 vlan,
......
...@@ -6408,6 +6408,39 @@ static int i40e_sw_init(struct i40e_pf *pf) ...@@ -6408,6 +6408,39 @@ static int i40e_sw_init(struct i40e_pf *pf)
return err; return err;
} }
/**
* i40e_set_ntuple - set the ntuple feature flag and take action
* @pf: board private structure to initialize
* @features: the feature set that the stack is suggesting
*
* returns a bool to indicate if reset needs to happen
**/
bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features)
{
bool need_reset = false;
/* Check if Flow Director n-tuple support was enabled or disabled. If
* the state changed, we need to reset.
*/
if (features & NETIF_F_NTUPLE) {
/* Enable filters and mark for reset */
if (!(pf->flags & I40E_FLAG_FD_SB_ENABLED))
need_reset = true;
pf->flags |= I40E_FLAG_FD_SB_ENABLED;
} else {
/* turn off filters, mark for reset and clear SW filter list */
if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
need_reset = true;
i40e_fdir_filter_exit(pf);
}
pf->flags &= ~I40E_FLAG_FD_SB_ENABLED;
/* if ATR was disabled it can be re-enabled. */
if (!(pf->flags & I40E_FLAG_FD_ATR_ENABLED))
pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
}
return need_reset;
}
/** /**
* i40e_set_features - set the netdev feature flags * i40e_set_features - set the netdev feature flags
* @netdev: ptr to the netdev being adjusted * @netdev: ptr to the netdev being adjusted
...@@ -6418,12 +6451,19 @@ static int i40e_set_features(struct net_device *netdev, ...@@ -6418,12 +6451,19 @@ static int i40e_set_features(struct net_device *netdev,
{ {
struct i40e_netdev_priv *np = netdev_priv(netdev); struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_vsi *vsi = np->vsi; struct i40e_vsi *vsi = np->vsi;
struct i40e_pf *pf = vsi->back;
bool need_reset;
if (features & NETIF_F_HW_VLAN_CTAG_RX) if (features & NETIF_F_HW_VLAN_CTAG_RX)
i40e_vlan_stripping_enable(vsi); i40e_vlan_stripping_enable(vsi);
else else
i40e_vlan_stripping_disable(vsi); i40e_vlan_stripping_disable(vsi);
need_reset = i40e_set_ntuple(pf, features);
if (need_reset)
i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED));
return 0; return 0;
} }
...@@ -6595,6 +6635,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ...@@ -6595,6 +6635,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
NETIF_F_TSO | NETIF_F_TSO |
NETIF_F_TSO6 | NETIF_F_TSO6 |
NETIF_F_RXCSUM | NETIF_F_RXCSUM |
NETIF_F_NTUPLE |
NETIF_F_RXHASH | NETIF_F_RXHASH |
0; 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment