Skip to content

Commit 69e66c0

Browse files
jdamato-fslyanguy11
authored andcommitted
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: Joe Damato <[email protected]> Tested-by: Gurucharan <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent b4fb2d3 commit 69e66c0

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3329,7 +3329,9 @@ static void ice_set_netdev_features(struct net_device *netdev)
33293329
vlano_features | tso_features;
33303330

33313331
/* add support for HW_CSUM on packets with MPLS header */
3332-
netdev->mpls_features = NETIF_F_HW_CSUM;
3332+
netdev->mpls_features = NETIF_F_HW_CSUM |
3333+
NETIF_F_TSO |
3334+
NETIF_F_TSO6;
33333335

33343336
/* enable features */
33353337
netdev->features |= netdev->hw_features;

drivers/net/ethernet/intel/ice/ice_txrx.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/prefetch.h>
99
#include <linux/bpf_trace.h>
1010
#include <net/dsfield.h>
11+
#include <net/mpls.h>
1112
#include <net/xdp.h>
1213
#include "ice_txrx_lib.h"
1314
#include "ice_lib.h"
@@ -1748,18 +1749,24 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
17481749
if (skb->ip_summed != CHECKSUM_PARTIAL)
17491750
return 0;
17501751

1751-
ip.hdr = skb_network_header(skb);
1752-
l4.hdr = skb_transport_header(skb);
1752+
protocol = vlan_get_protocol(skb);
1753+
1754+
if (eth_p_mpls(protocol))
1755+
ip.hdr = skb_inner_network_header(skb);
1756+
else
1757+
ip.hdr = skb_network_header(skb);
1758+
l4.hdr = skb_checksum_start(skb);
17531759

17541760
/* compute outer L2 header size */
17551761
l2_len = ip.hdr - skb->data;
17561762
offset = (l2_len / 2) << ICE_TX_DESC_LEN_MACLEN_S;
17571763

1758-
protocol = vlan_get_protocol(skb);
1759-
1760-
if (protocol == htons(ETH_P_IP))
1764+
/* set the tx_flags to indicate the IP protocol type. this is
1765+
* required so that checksum header computation below is accurate.
1766+
*/
1767+
if (ip.v4->version == 4)
17611768
first->tx_flags |= ICE_TX_FLAGS_IPV4;
1762-
else if (protocol == htons(ETH_P_IPV6))
1769+
else if (ip.v6->version == 6)
17631770
first->tx_flags |= ICE_TX_FLAGS_IPV6;
17641771

17651772
if (skb->encapsulation) {
@@ -1957,6 +1964,7 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
19571964
unsigned char *hdr;
19581965
} l4;
19591966
u64 cd_mss, cd_tso_len;
1967+
__be16 protocol;
19601968
u32 paylen;
19611969
u8 l4_start;
19621970
int err;
@@ -1972,8 +1980,13 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
19721980
return err;
19731981

19741982
/* cppcheck-suppress unreadVariable */
1975-
ip.hdr = skb_network_header(skb);
1976-
l4.hdr = skb_transport_header(skb);
1983+
protocol = vlan_get_protocol(skb);
1984+
1985+
if (eth_p_mpls(protocol))
1986+
ip.hdr = skb_inner_network_header(skb);
1987+
else
1988+
ip.hdr = skb_network_header(skb);
1989+
l4.hdr = skb_checksum_start(skb);
19771990

19781991
/* initialize outer IP header fields */
19791992
if (ip.v4->version == 4) {

0 commit comments

Comments
 (0)