From: Jie Liu <[email protected]> The V4 branch dropped sxe2_rxq_buf_split_fill() and the buffer split handling in sxe2_rxq_ctxt_cfg_fill(), so the Rx buffer split offload (RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) is advertised in device info but the per-queue context never configures split_en/split_type_mask/ hdr_len, and buffer split packets are not handled correctly.
Restore the sxe2_rxq_buf_split_fill() helper and the buffer split branch in sxe2_rxq_ctxt_cfg_fill(), matching the V3 implementation. Cc: [email protected] Cc: [email protected] Signed-off-by: Jie Liu <[email protected]> --- drivers/net/sxe2/sxe2_cmd_chnl.c | 106 +++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/drivers/net/sxe2/sxe2_cmd_chnl.c b/drivers/net/sxe2/sxe2_cmd_chnl.c index b17d80d917..5102890107 100644 --- a/drivers/net/sxe2/sxe2_cmd_chnl.c +++ b/drivers/net/sxe2/sxe2_cmd_chnl.c @@ -194,6 +194,102 @@ int32_t sxe2_drv_vsi_del(struct sxe2_adapter *adapter, struct sxe2_vsi *vsi) #define SXE2_RXQ_CTXT_CFG_BUF_LEN_ALIGN (1 << 7) #define SXE2_RX_HDR_SIZE 256 +static int32_t sxe2_rxq_buf_split_fill(struct sxe2_rx_queue *rxq, + struct sxe2_drv_rxq_ctxt *ctxt) +{ + int32_t ret = 0; + uint32_t proto_hdr; + + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) { + proto_hdr = rxq->rx_seg[0].proto_hdr; + if (proto_hdr == RTE_PTYPE_UNKNOWN) { + PMD_LOG_ERR(RX, "Buffer split protocol must be configured"); + ret = -1; + goto l_end; + } + + switch (proto_hdr & RTE_PTYPE_L4_MASK) { + case RTE_PTYPE_L4_TCP: + ctxt->split_type_mask = SXE2_PTYPE_L4_TCP; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + case RTE_PTYPE_L4_UDP: + ctxt->split_type_mask = SXE2_PTYPE_L4_UDP; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + case RTE_PTYPE_L4_SCTP: + ctxt->split_type_mask = SXE2_PTYPE_L4_SCTP; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + } + + switch (proto_hdr & RTE_PTYPE_L3_MASK) { + case RTE_PTYPE_L3_IPV4_EXT_UNKNOWN: + ctxt->split_type_mask = SXE2_PTYPE_L3_IPV4; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + case RTE_PTYPE_L3_IPV6_EXT_UNKNOWN: + ctxt->split_type_mask = SXE2_PTYPE_L3_IPV6; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + } + + switch (proto_hdr & RTE_PTYPE_L2_MASK) { + case RTE_PTYPE_L2_ETHER: + ctxt->split_type_mask = SXE2_PTYPE_L2_ETHER; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + } + + switch (proto_hdr & RTE_PTYPE_INNER_L4_MASK) { + case RTE_PTYPE_INNER_L4_TCP: + ctxt->split_type_mask = SXE2_PTYPE_INNER_L4_TCP; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + case RTE_PTYPE_INNER_L4_UDP: + ctxt->split_type_mask = SXE2_PTYPE_INNER_L4_UDP; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + case RTE_PTYPE_INNER_L4_SCTP: + ctxt->split_type_mask = SXE2_PTYPE_INNER_L4_SCTP; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + } + + switch (proto_hdr & RTE_PTYPE_INNER_L3_MASK) { + case RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN: + ctxt->split_type_mask = SXE2_PTYPE_INNER_L3_IPV4; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + case RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN: + ctxt->split_type_mask = SXE2_PTYPE_INNER_L3_IPV6; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + } + + switch (proto_hdr & RTE_PTYPE_INNER_L2_MASK) { + case RTE_PTYPE_INNER_L2_ETHER: + ctxt->split_type_mask = SXE2_PTYPE_INNER_L2_ETHER; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + } + + switch (proto_hdr & RTE_PTYPE_TUNNEL_MASK) { + case RTE_PTYPE_TUNNEL_GRENAT: + ctxt->split_type_mask = SXE2_PTYPE_TUNNEL_GRENAT; + ctxt->hdr_len = SXE2_RX_HDR_SIZE; + goto l_end; + } + PMD_LOG_ERR(RX, "Buffer split protocol is not supported"); + ret = -1; + } else { + ctxt->hdr_len = 0; + ctxt->split_type_mask = 0; + } +l_end: + return ret; +} + static int32_t sxe2_rxq_ctxt_cfg_fill(struct sxe2_rx_queue *rxq, struct sxe2_drv_rxq_cfg_req *req, uint16_t rxq_cnt) { @@ -227,7 +323,17 @@ static int32_t sxe2_rxq_ctxt_cfg_fill(struct sxe2_rx_queue *rxq, else ctxt->keep_crc_en = 0; + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) { + ret = sxe2_rxq_buf_split_fill(rxq, ctxt); + if (ret) + goto l_end; + ctxt->split_en = 1; + } else { + ctxt->split_en = 0; + } + ctxt->desc_size = sizeof(union sxe2_rx_desc); +l_end: return ret; } -- 2.52.0

