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.
Fixes: d8e4e075acb4 ("net/sxe2: add probing skeleton")
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
drivers/net/sxe2/sxe2_cmd_chnl.c | 88 ++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/drivers/net/sxe2/sxe2_cmd_chnl.c b/drivers/net/sxe2/sxe2_cmd_chnl.c
index 84fe401ec4..3998309bb1 100644
--- a/drivers/net/sxe2/sxe2_cmd_chnl.c
+++ b/drivers/net/sxe2/sxe2_cmd_chnl.c
@@ -195,6 +195,84 @@ 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)
+{
+ uint32_t proto_hdr;
+
+ proto_hdr = rxq->rx_seg[0].proto_hdr;
+ if (proto_hdr == RTE_PTYPE_UNKNOWN) {
+ PMD_LOG_ERR(RX, "Buffer split protocol must be configured");
+ return -EINVAL;
+ }
+
+ switch (proto_hdr & RTE_PTYPE_L4_MASK) {
+ case RTE_PTYPE_L4_TCP:
+ ctxt->split_type_mask = SXE2_PTYPE_L4_TCP;
+ goto l_end;
+ case RTE_PTYPE_L4_UDP:
+ ctxt->split_type_mask = SXE2_PTYPE_L4_UDP;
+ goto l_end;
+ case RTE_PTYPE_L4_SCTP:
+ ctxt->split_type_mask = SXE2_PTYPE_L4_SCTP;
+ 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;
+ goto l_end;
+ case RTE_PTYPE_L3_IPV6_EXT_UNKNOWN:
+ ctxt->split_type_mask = SXE2_PTYPE_L3_IPV6;
+ goto l_end;
+ }
+
+ switch (proto_hdr & RTE_PTYPE_L2_MASK) {
+ case RTE_PTYPE_L2_ETHER:
+ ctxt->split_type_mask = SXE2_PTYPE_L2_ETHER;
+ 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;
+ goto l_end;
+ case RTE_PTYPE_INNER_L4_UDP:
+ ctxt->split_type_mask = SXE2_PTYPE_INNER_L4_UDP;
+ goto l_end;
+ case RTE_PTYPE_INNER_L4_SCTP:
+ ctxt->split_type_mask = SXE2_PTYPE_INNER_L4_SCTP;
+ 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;
+ goto l_end;
+ case RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN:
+ ctxt->split_type_mask = SXE2_PTYPE_INNER_L3_IPV6;
+ 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;
+ goto l_end;
+ }
+
+ switch (proto_hdr & RTE_PTYPE_TUNNEL_MASK) {
+ case RTE_PTYPE_TUNNEL_GRENAT:
+ ctxt->split_type_mask = SXE2_PTYPE_TUNNEL_GRENAT;
+ goto l_end;
+ }
+
+ PMD_LOG_ERR(RX, "Buffer split protocol is not supported");
+ return -ENOTSUP;
+l_end:
+ ctxt->hdr_len = SXE2_RX_HDR_SIZE;
+ return 0;
+}
+
static int32_t sxe2_rxq_ctxt_cfg_fill(struct sxe2_rx_queue *rxq,
struct sxe2_drv_rxq_cfg_req *req, uint16_t rxq_cnt)
{
@@ -228,7 +306,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