mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 07:33:19 +02:00
hinic3: Add RX VLAN offload support
Add vlan offload processing in RX process. Co-developed-by: Zhu Yikai <zhuyikai1@h-partners.com> Signed-off-by: Zhu Yikai <zhuyikai1@h-partners.com> Signed-off-by: Fan Gong <gongfan1@huawei.com> Link: https://patch.msgid.link/22cf02a014c2beb7b5f92ab5e6de38c4dd928125.1773062356.git.zhuyikai1@h-partners.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
d69ee992fb
commit
0f746fc5bc
|
|
@ -328,6 +328,7 @@ static void hinic3_rx_csum(struct hinic3_rxq *rxq, u32 offload_type,
|
|||
u32 ip_type = RQ_CQE_OFFOLAD_TYPE_GET(offload_type, IP_TYPE);
|
||||
u32 csum_err = RQ_CQE_STATUS_GET(status, CSUM_ERR);
|
||||
struct net_device *netdev = rxq->netdev;
|
||||
bool l2_tunnel;
|
||||
|
||||
if (!(netdev->features & NETIF_F_RXCSUM))
|
||||
return;
|
||||
|
|
@ -350,6 +351,12 @@ static void hinic3_rx_csum(struct hinic3_rxq *rxq, u32 offload_type,
|
|||
case HINIC3_RX_UDP_PKT:
|
||||
case HINIC3_RX_SCTP_PKT:
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
l2_tunnel = HINIC3_GET_RX_TUNNEL_PKT_FORMAT(offload_type) ==
|
||||
HINIC3_RX_PKT_FORMAT_VXLAN ? 1 : 0;
|
||||
if (l2_tunnel) {
|
||||
/* If we checked the outer header let the stack know */
|
||||
skb->csum_level = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
|
|
@ -390,6 +397,14 @@ static int recv_one_pkt(struct hinic3_rxq *rxq, struct hinic3_rq_cqe *rx_cqe,
|
|||
offload_type = le32_to_cpu(rx_cqe->offload_type);
|
||||
hinic3_rx_csum(rxq, offload_type, status, skb);
|
||||
|
||||
if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
|
||||
RQ_CQE_OFFOLAD_TYPE_GET(offload_type, VLAN_EN)) {
|
||||
u16 vid = RQ_CQE_SGE_GET(vlan_len, VLAN);
|
||||
|
||||
/* if the packet is a vlan pkt, the vid may be 0 */
|
||||
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
|
||||
}
|
||||
|
||||
num_lro = RQ_CQE_STATUS_GET(status, NUM_LRO);
|
||||
if (num_lro)
|
||||
hinic3_lro_set_gso_params(skb, num_lro);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@
|
|||
#define RQ_CQE_OFFOLAD_TYPE_GET(val, member) \
|
||||
FIELD_GET(RQ_CQE_OFFOLAD_TYPE_##member##_MASK, val)
|
||||
|
||||
#define HINIC3_GET_RX_TUNNEL_PKT_FORMAT(offload_type) \
|
||||
RQ_CQE_OFFOLAD_TYPE_GET(offload_type, TUNNEL_PKT_FORMAT)
|
||||
|
||||
#define RQ_CQE_SGE_VLAN_MASK GENMASK(15, 0)
|
||||
#define RQ_CQE_SGE_LEN_MASK GENMASK(31, 16)
|
||||
#define RQ_CQE_SGE_GET(val, member) \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user