Commit 69e66c04 authored by Joe Damato's avatar Joe Damato Committed by Tony Nguyen

ice: Add mpls+tso support

Attempt to add mpls+tso support.

I don't have ice hardware available to test myself, but I just implemented
this feature in i40e and thought it might be useful to implement for ice
while this is fresh in my brain.

Hoping some one at intel will be able to test this on my behalf.
Signed-off-by: default avatarJoe Damato <jdamato@fastly.com>
Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent b4fb2d33
...@@ -3329,7 +3329,9 @@ static void ice_set_netdev_features(struct net_device *netdev) ...@@ -3329,7 +3329,9 @@ static void ice_set_netdev_features(struct net_device *netdev)
vlano_features | tso_features; vlano_features | tso_features;
/* add support for HW_CSUM on packets with MPLS header */ /* add support for HW_CSUM on packets with MPLS header */
netdev->mpls_features = NETIF_F_HW_CSUM; netdev->mpls_features = NETIF_F_HW_CSUM |
NETIF_F_TSO |
NETIF_F_TSO6;
/* enable features */ /* enable features */
netdev->features |= netdev->hw_features; netdev->features |= netdev->hw_features;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/prefetch.h> #include <linux/prefetch.h>
#include <linux/bpf_trace.h> #include <linux/bpf_trace.h>
#include <net/dsfield.h> #include <net/dsfield.h>
#include <net/mpls.h>
#include <net/xdp.h> #include <net/xdp.h>
#include "ice_txrx_lib.h" #include "ice_txrx_lib.h"
#include "ice_lib.h" #include "ice_lib.h"
...@@ -1748,18 +1749,24 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) ...@@ -1748,18 +1749,24 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
if (skb->ip_summed != CHECKSUM_PARTIAL) if (skb->ip_summed != CHECKSUM_PARTIAL)
return 0; return 0;
ip.hdr = skb_network_header(skb); protocol = vlan_get_protocol(skb);
l4.hdr = skb_transport_header(skb);
if (eth_p_mpls(protocol))
ip.hdr = skb_inner_network_header(skb);
else
ip.hdr = skb_network_header(skb);
l4.hdr = skb_checksum_start(skb);
/* compute outer L2 header size */ /* compute outer L2 header size */
l2_len = ip.hdr - skb->data; l2_len = ip.hdr - skb->data;
offset = (l2_len / 2) << ICE_TX_DESC_LEN_MACLEN_S; offset = (l2_len / 2) << ICE_TX_DESC_LEN_MACLEN_S;
protocol = vlan_get_protocol(skb); /* set the tx_flags to indicate the IP protocol type. this is
* required so that checksum header computation below is accurate.
if (protocol == htons(ETH_P_IP)) */
if (ip.v4->version == 4)
first->tx_flags |= ICE_TX_FLAGS_IPV4; first->tx_flags |= ICE_TX_FLAGS_IPV4;
else if (protocol == htons(ETH_P_IPV6)) else if (ip.v6->version == 6)
first->tx_flags |= ICE_TX_FLAGS_IPV6; first->tx_flags |= ICE_TX_FLAGS_IPV6;
if (skb->encapsulation) { if (skb->encapsulation) {
...@@ -1957,6 +1964,7 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off) ...@@ -1957,6 +1964,7 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
unsigned char *hdr; unsigned char *hdr;
} l4; } l4;
u64 cd_mss, cd_tso_len; u64 cd_mss, cd_tso_len;
__be16 protocol;
u32 paylen; u32 paylen;
u8 l4_start; u8 l4_start;
int err; int err;
...@@ -1972,8 +1980,13 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off) ...@@ -1972,8 +1980,13 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
return err; return err;
/* cppcheck-suppress unreadVariable */ /* cppcheck-suppress unreadVariable */
ip.hdr = skb_network_header(skb); protocol = vlan_get_protocol(skb);
l4.hdr = skb_transport_header(skb);
if (eth_p_mpls(protocol))
ip.hdr = skb_inner_network_header(skb);
else
ip.hdr = skb_network_header(skb);
l4.hdr = skb_checksum_start(skb);
/* initialize outer IP header fields */ /* initialize outer IP header fields */
if (ip.v4->version == 4) { if (ip.v4->version == 4) {
......
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