|
15 | 15 | #include <linux/vermagic.h>
|
16 | 16 | #include <net/gre.h>
|
17 | 17 | #include <net/pkt_cls.h>
|
| 18 | +#include <net/tcp.h> |
18 | 19 | #include <net/vxlan.h>
|
19 | 20 |
|
20 | 21 | #include "hnae3.h"
|
@@ -2318,6 +2319,12 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
|
2318 | 2319 | if (!(netdev->features & NETIF_F_RXCSUM))
|
2319 | 2320 | return;
|
2320 | 2321 |
|
| 2322 | + /* We MUST enable hardware checksum before enabling hardware GRO */ |
| 2323 | + if (skb_shinfo(skb)->gso_size) { |
| 2324 | + skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 2325 | + return; |
| 2326 | + } |
| 2327 | + |
2321 | 2328 | /* check if hardware has done checksum */
|
2322 | 2329 | if (!hnae3_get_bit(bd_base_info, HNS3_RXD_L3L4P_B))
|
2323 | 2330 | return;
|
@@ -2511,6 +2518,39 @@ static int hns3_add_frag(struct hns3_enet_ring *ring, struct hns3_desc *desc,
|
2511 | 2518 | return 0;
|
2512 | 2519 | }
|
2513 | 2520 |
|
| 2521 | +static void hns3_set_gro_param(struct sk_buff *skb, u32 l234info, |
| 2522 | + u32 bd_base_info) |
| 2523 | +{ |
| 2524 | + u16 gro_count; |
| 2525 | + u32 l3_type; |
| 2526 | + |
| 2527 | + gro_count = hnae3_get_field(l234info, HNS3_RXD_GRO_COUNT_M, |
| 2528 | + HNS3_RXD_GRO_COUNT_S); |
| 2529 | + /* if there is no HW GRO, do not set gro params */ |
| 2530 | + if (!gro_count) |
| 2531 | + return; |
| 2532 | + |
| 2533 | + /* tcp_gro_complete() will copy NAPI_GRO_CB(skb)->count |
| 2534 | + * to skb_shinfo(skb)->gso_segs |
| 2535 | + */ |
| 2536 | + NAPI_GRO_CB(skb)->count = gro_count; |
| 2537 | + |
| 2538 | + l3_type = hnae3_get_field(l234info, HNS3_RXD_L3ID_M, |
| 2539 | + HNS3_RXD_L3ID_S); |
| 2540 | + if (l3_type == HNS3_L3_TYPE_IPV4) |
| 2541 | + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; |
| 2542 | + else if (l3_type == HNS3_L3_TYPE_IPV6) |
| 2543 | + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; |
| 2544 | + else |
| 2545 | + return; |
| 2546 | + |
| 2547 | + skb_shinfo(skb)->gso_size = hnae3_get_field(bd_base_info, |
| 2548 | + HNS3_RXD_GRO_SIZE_M, |
| 2549 | + HNS3_RXD_GRO_SIZE_S); |
| 2550 | + if (skb_shinfo(skb)->gso_size) |
| 2551 | + tcp_gro_complete(skb); |
| 2552 | +} |
| 2553 | + |
2514 | 2554 | static void hns3_set_rx_skb_rss_type(struct hns3_enet_ring *ring,
|
2515 | 2555 | struct sk_buff *skb)
|
2516 | 2556 | {
|
@@ -2645,6 +2685,9 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring,
|
2645 | 2685 |
|
2646 | 2686 | ring->tqp_vector->rx_group.total_bytes += skb->len;
|
2647 | 2687 |
|
| 2688 | + /* This is needed in order to enable forwarding support */ |
| 2689 | + hns3_set_gro_param(skb, l234info, bd_base_info); |
| 2690 | + |
2648 | 2691 | hns3_rx_checksum(ring, skb, desc);
|
2649 | 2692 | *out_skb = skb;
|
2650 | 2693 | hns3_set_rx_skb_rss_type(ring, skb);
|
|
0 commit comments