diff options
author | Sasha Neftin <sasha.neftin@intel.com> | 2019-02-20 07:39:31 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2019-03-19 18:16:20 -0400 |
commit | 65cd3a725e908fe5a93d507411c3ea83157d10c4 (patch) | |
tree | 2be9aa90e2574bff934f56e9e3d993a81303ed65 /drivers/net/ethernet/intel/igc/igc_main.c | |
parent | 36b9fea60961d7426b6d4b0faaf609e5d820482d (diff) |
igc: Add support for the ntuple feature
Copy the ntuple feature into list of user selectable features.
Enable the ntuple feature.
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igc/igc_main.c')
-rw-r--r-- | drivers/net/ethernet/intel/igc/igc_main.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 1d21b95d9e2c..a883b3f357e7 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c | |||
@@ -2127,6 +2127,86 @@ static struct net_device_stats *igc_get_stats(struct net_device *netdev) | |||
2127 | return &netdev->stats; | 2127 | return &netdev->stats; |
2128 | } | 2128 | } |
2129 | 2129 | ||
2130 | static netdev_features_t igc_fix_features(struct net_device *netdev, | ||
2131 | netdev_features_t features) | ||
2132 | { | ||
2133 | /* Since there is no support for separate Rx/Tx vlan accel | ||
2134 | * enable/disable make sure Tx flag is always in same state as Rx. | ||
2135 | */ | ||
2136 | if (features & NETIF_F_HW_VLAN_CTAG_RX) | ||
2137 | features |= NETIF_F_HW_VLAN_CTAG_TX; | ||
2138 | else | ||
2139 | features &= ~NETIF_F_HW_VLAN_CTAG_TX; | ||
2140 | |||
2141 | return features; | ||
2142 | } | ||
2143 | |||
2144 | static int igc_set_features(struct net_device *netdev, | ||
2145 | netdev_features_t features) | ||
2146 | { | ||
2147 | netdev_features_t changed = netdev->features ^ features; | ||
2148 | struct igc_adapter *adapter = netdev_priv(netdev); | ||
2149 | |||
2150 | /* Add VLAN support */ | ||
2151 | if (!(changed & (NETIF_F_RXALL | NETIF_F_NTUPLE))) | ||
2152 | return 0; | ||
2153 | |||
2154 | if (!(features & NETIF_F_NTUPLE)) { | ||
2155 | struct hlist_node *node2; | ||
2156 | struct igc_nfc_filter *rule; | ||
2157 | |||
2158 | spin_lock(&adapter->nfc_lock); | ||
2159 | hlist_for_each_entry_safe(rule, node2, | ||
2160 | &adapter->nfc_filter_list, nfc_node) { | ||
2161 | igc_erase_filter(adapter, rule); | ||
2162 | hlist_del(&rule->nfc_node); | ||
2163 | kfree(rule); | ||
2164 | } | ||
2165 | spin_unlock(&adapter->nfc_lock); | ||
2166 | adapter->nfc_filter_count = 0; | ||
2167 | } | ||
2168 | |||
2169 | netdev->features = features; | ||
2170 | |||
2171 | if (netif_running(netdev)) | ||
2172 | igc_reinit_locked(adapter); | ||
2173 | else | ||
2174 | igc_reset(adapter); | ||
2175 | |||
2176 | return 1; | ||
2177 | } | ||
2178 | |||
2179 | static netdev_features_t | ||
2180 | igc_features_check(struct sk_buff *skb, struct net_device *dev, | ||
2181 | netdev_features_t features) | ||
2182 | { | ||
2183 | unsigned int network_hdr_len, mac_hdr_len; | ||
2184 | |||
2185 | /* Make certain the headers can be described by a context descriptor */ | ||
2186 | mac_hdr_len = skb_network_header(skb) - skb->data; | ||
2187 | if (unlikely(mac_hdr_len > IGC_MAX_MAC_HDR_LEN)) | ||
2188 | return features & ~(NETIF_F_HW_CSUM | | ||
2189 | NETIF_F_SCTP_CRC | | ||
2190 | NETIF_F_HW_VLAN_CTAG_TX | | ||
2191 | NETIF_F_TSO | | ||
2192 | NETIF_F_TSO6); | ||
2193 | |||
2194 | network_hdr_len = skb_checksum_start(skb) - skb_network_header(skb); | ||
2195 | if (unlikely(network_hdr_len > IGC_MAX_NETWORK_HDR_LEN)) | ||
2196 | return features & ~(NETIF_F_HW_CSUM | | ||
2197 | NETIF_F_SCTP_CRC | | ||
2198 | NETIF_F_TSO | | ||
2199 | NETIF_F_TSO6); | ||
2200 | |||
2201 | /* We can only support IPv4 TSO in tunnels if we can mangle the | ||
2202 | * inner IP ID field, so strip TSO if MANGLEID is not supported. | ||
2203 | */ | ||
2204 | if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID)) | ||
2205 | features &= ~NETIF_F_TSO; | ||
2206 | |||
2207 | return features; | ||
2208 | } | ||
2209 | |||
2130 | /** | 2210 | /** |
2131 | * igc_configure - configure the hardware for RX and TX | 2211 | * igc_configure - configure the hardware for RX and TX |
2132 | * @adapter: private board structure | 2212 | * @adapter: private board structure |
@@ -3793,6 +3873,9 @@ static const struct net_device_ops igc_netdev_ops = { | |||
3793 | .ndo_set_mac_address = igc_set_mac, | 3873 | .ndo_set_mac_address = igc_set_mac, |
3794 | .ndo_change_mtu = igc_change_mtu, | 3874 | .ndo_change_mtu = igc_change_mtu, |
3795 | .ndo_get_stats = igc_get_stats, | 3875 | .ndo_get_stats = igc_get_stats, |
3876 | .ndo_fix_features = igc_fix_features, | ||
3877 | .ndo_set_features = igc_set_features, | ||
3878 | .ndo_features_check = igc_features_check, | ||
3796 | }; | 3879 | }; |
3797 | 3880 | ||
3798 | /* PCIe configuration access */ | 3881 | /* PCIe configuration access */ |
@@ -4022,6 +4105,9 @@ static int igc_probe(struct pci_dev *pdev, | |||
4022 | if (err) | 4105 | if (err) |
4023 | goto err_sw_init; | 4106 | goto err_sw_init; |
4024 | 4107 | ||
4108 | /* copy netdev features into list of user selectable features */ | ||
4109 | netdev->hw_features |= NETIF_F_NTUPLE; | ||
4110 | |||
4025 | /* MTU range: 68 - 9216 */ | 4111 | /* MTU range: 68 - 9216 */ |
4026 | netdev->min_mtu = ETH_MIN_MTU; | 4112 | netdev->min_mtu = ETH_MIN_MTU; |
4027 | netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE; | 4113 | netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE; |