Skip to content

Commit 4bdb441

Browse files
Jiawen WuPaolo Abeni
authored andcommitted
net: txgbe: support Flow Director perfect filters
Support the addition and deletion of Flow Director filters. Supported fields: src-ip, dst-ip, src-port, dst-port Supported flow-types: tcp4, udp4, sctp4, ipv4 Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent b501d26 commit 4bdb441

File tree

6 files changed

+845
-1
lines changed

6 files changed

+845
-1
lines changed

drivers/net/ethernet/wangxun/libwx/wx_lib.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,6 +2705,7 @@ int wx_set_features(struct net_device *netdev, netdev_features_t features)
27052705
{
27062706
netdev_features_t changed = netdev->features ^ features;
27072707
struct wx *wx = netdev_priv(netdev);
2708+
bool need_reset = false;
27082709

27092710
if (features & NETIF_F_RXHASH) {
27102711
wr32m(wx, WX_RDB_RA_CTL, WX_RDB_RA_CTL_RSS_EN,
@@ -2722,6 +2723,36 @@ int wx_set_features(struct net_device *netdev, netdev_features_t features)
27222723
else if (changed & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER))
27232724
wx_set_rx_mode(netdev);
27242725

2726+
if (!(test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags)))
2727+
return 0;
2728+
2729+
/* Check if Flow Director n-tuple support was enabled or disabled. If
2730+
* the state changed, we need to reset.
2731+
*/
2732+
switch (features & NETIF_F_NTUPLE) {
2733+
case NETIF_F_NTUPLE:
2734+
/* turn off ATR, enable perfect filters and reset */
2735+
if (!(test_and_set_bit(WX_FLAG_FDIR_PERFECT, wx->flags)))
2736+
need_reset = true;
2737+
2738+
clear_bit(WX_FLAG_FDIR_HASH, wx->flags);
2739+
break;
2740+
default:
2741+
/* turn off perfect filters, enable ATR and reset */
2742+
if (test_and_clear_bit(WX_FLAG_FDIR_PERFECT, wx->flags))
2743+
need_reset = true;
2744+
2745+
/* We cannot enable ATR if RSS is disabled */
2746+
if (wx->ring_feature[RING_F_RSS].limit <= 1)
2747+
break;
2748+
2749+
set_bit(WX_FLAG_FDIR_HASH, wx->flags);
2750+
break;
2751+
}
2752+
2753+
if (need_reset)
2754+
wx->do_reset(netdev);
2755+
27252756
return 0;
27262757
}
27272758
EXPORT_SYMBOL(wx_set_features);

0 commit comments

Comments
 (0)