fm10k: Implement ndo_features_check
authorMatthew Vick <matthew.vick@intel.com>
Thu, 29 Jan 2015 07:17:27 +0000 (07:17 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 3 Mar 2015 09:07:22 +0000 (01:07 -0800)
The introduction of ndo_features_check allows drivers to report their
offload capabilities per-skb. Implement this in fm10k to take advantage
of this new functionality.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Matthew Vick <matthew.vick@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/fm10k/fm10k.h
drivers/net/ethernet/intel/fm10k/fm10k_main.c
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c

index 42eb4344a9dc077c52bfa97723d99af2bbcbe06b..59edfd4446cdaf4daf95659ec0d7bec6bf6c0916 100644 (file)
@@ -439,6 +439,7 @@ extern char fm10k_driver_name[];
 extern const char fm10k_driver_version[];
 int fm10k_init_queueing_scheme(struct fm10k_intfc *interface);
 void fm10k_clear_queueing_scheme(struct fm10k_intfc *interface);
+__be16 fm10k_tx_encap_offload(struct sk_buff *skb);
 netdev_tx_t fm10k_xmit_frame_ring(struct sk_buff *skb,
                                  struct fm10k_ring *tx_ring);
 void fm10k_tx_timeout_reset(struct fm10k_intfc *interface);
index a7d379802e7ce244fd110104e7bb2f27a224d227..0cb6971bfbf8a25d3b5b2c0dc9b96ac7792849c1 100644 (file)
@@ -718,7 +718,7 @@ static struct ethhdr *fm10k_gre_is_nvgre(struct sk_buff *skb)
        return (struct ethhdr *)(&nvgre_hdr->tni);
 }
 
-static __be16 fm10k_tx_encap_offload(struct sk_buff *skb)
+__be16 fm10k_tx_encap_offload(struct sk_buff *skb)
 {
        u8 l4_hdr = 0, inner_l4_hdr = 0, inner_l4_hlen;
        struct ethhdr *eth_hdr;
index cfde8bac1aeb2a23e4c447f786e06394f3ce285e..2a9b467d104223e443f71ef073c9b265bb275328 100644 (file)
@@ -1350,6 +1350,16 @@ static void fm10k_dfwd_del_station(struct net_device *dev, void *priv)
        }
 }
 
+static netdev_features_t fm10k_features_check(struct sk_buff *skb,
+                                             struct net_device *dev,
+                                             netdev_features_t features)
+{
+       if (!skb->encapsulation || fm10k_tx_encap_offload(skb))
+               return features;
+
+       return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
+}
+
 static const struct net_device_ops fm10k_netdev_ops = {
        .ndo_open               = fm10k_open,
        .ndo_stop               = fm10k_close,
@@ -1372,6 +1382,7 @@ static const struct net_device_ops fm10k_netdev_ops = {
        .ndo_do_ioctl           = fm10k_ioctl,
        .ndo_dfwd_add_station   = fm10k_dfwd_add_station,
        .ndo_dfwd_del_station   = fm10k_dfwd_del_station,
+       .ndo_features_check     = fm10k_features_check,
 };
 
 #define DEFAULT_DEBUG_LEVEL_SHIFT 3