Skip to content

Commit 3a9024f

Browse files
Thanneeru Srinivasuludavem330
authored andcommitted
net: thunderx: Enable TSO and checksum offloads for ipv6
Adding support for TSO and checksum hardware offloads for ipv6. Signed-off-by: Thanneeru Srinivasulu <tsrinivasulu@cavium.com> Signed-off-by: Sunil Goutham <sgoutham@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c339c1c commit 3a9024f

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

drivers/net/ethernet/cavium/thunder/nicvf_main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,16 +1665,18 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
16651665
if (err)
16661666
goto err_unregister_interrupts;
16671667

1668-
netdev->hw_features = (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_SG |
1669-
NETIF_F_TSO | NETIF_F_GRO |
1668+
netdev->hw_features = (NETIF_F_RXCSUM | NETIF_F_SG |
1669+
NETIF_F_TSO | NETIF_F_GRO | NETIF_F_TSO6 |
1670+
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
16701671
NETIF_F_HW_VLAN_CTAG_RX);
16711672

16721673
netdev->hw_features |= NETIF_F_RXHASH;
16731674

16741675
netdev->features |= netdev->hw_features;
16751676
netdev->hw_features |= NETIF_F_LOOPBACK;
16761677

1677-
netdev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
1678+
netdev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM |
1679+
NETIF_F_IPV6_CSUM | NETIF_F_TSO | NETIF_F_TSO6;
16781680

16791681
netdev->netdev_ops = &nicvf_netdev_ops;
16801682
netdev->watchdog_timeo = NICVF_TX_TIMEOUT;

drivers/net/ethernet/cavium/thunder/nicvf_queues.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,13 @@ nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct snd_queue *sq, int qentry,
10941094
{
10951095
int proto;
10961096
struct sq_hdr_subdesc *hdr;
1097+
union {
1098+
struct iphdr *v4;
1099+
struct ipv6hdr *v6;
1100+
unsigned char *hdr;
1101+
} ip;
10971102

1103+
ip.hdr = skb_network_header(skb);
10981104
hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry);
10991105
memset(hdr, 0, SND_QUEUE_DESC_SIZE);
11001106
hdr->subdesc_type = SQ_DESC_TYPE_HEADER;
@@ -1119,7 +1125,9 @@ nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct snd_queue *sq, int qentry,
11191125
hdr->l3_offset = skb_network_offset(skb);
11201126
hdr->l4_offset = skb_transport_offset(skb);
11211127

1122-
proto = ip_hdr(skb)->protocol;
1128+
proto = (ip.v4->version == 4) ? ip.v4->protocol :
1129+
ip.v6->nexthdr;
1130+
11231131
switch (proto) {
11241132
case IPPROTO_TCP:
11251133
hdr->csum_l4 = SEND_L4_CSUM_TCP;

0 commit comments

Comments
 (0)