Skip to contentSkip to conversation

net/xsc: configure xsc device hardware table

PATCH Superseded WanRenyong 1 participant 1 message Sep 6, 2024

Subsystems (2)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

WanRenyong

author
#0 lore raw

PATCH 16/19 net/xsc: configure xsc device hardware table

Configure hardware table to enable transmission and reception of the queues.

---
 drivers/net/xsc/meson.build  |   1 +
 drivers/net/xsc/xsc_ctrl.h   |  22 +++++
 drivers/net/xsc/xsc_ethdev.c |  39 ++++++++
 drivers/net/xsc/xsc_flow.c   | 167 +++++++++++++++++++++++++++++++++++
 drivers/net/xsc/xsc_flow.h   |  67 ++++++++++++++
 5 files changed, 296 insertions(+)
 create mode 100644 drivers/net/xsc/xsc_flow.c
 create mode 100644 drivers/net/xsc/xsc_flow.h
drivers/net/xsc/meson.build +1 -0
index 2fc4e5ace7..348e8ed145 100644
@@ -12,6 +12,7 @@ sources = files(
         'xsc_utils.c',
         'xsc_ctrl.c',
         'xsc_rxtx.c',
+        'xsc_flow.c',
 )
 
 libnames = ['ibverbs']
drivers/net/xsc/xsc_ctrl.h +22 -0
index e51847d68f..51bda47ca8 100644
@@ -41,6 +41,12 @@ enum xsc_ioctl_opmod {
 	((_n) + (_d) - 1) / (_d); \
 })
 
+enum {
+	XSC_CMD_OP_MODIFY_RAW_QP = 0x81f,
+	XSC_CMD_OP_IOCTL_FLOW    = 0x900,
+	XSC_CMD_OP_MAX
+};
+
 enum {
 	XSC_IOCTL_SET_QP_STATUS = 0x200,
 	XSC_IOCTL_SET_MAX
@@ -72,6 +78,22 @@ enum {
 	XSC_QUEUE_TYPE_RAW_TX     = 7,
 	XSC_QUEUE_TYPE_INVALID    = 0xFF,
 };
+enum  xsc_flow_tbl_id {
+	XSC_FLOW_TBL_IPAT = 0,
+	XSC_FLOW_TBL_PCT_V4 = 4,
+	XSC_FLOW_TBL_EPAT = 19,
+	XSC_FLOW_TBL_MAX
+};
+
+enum xsc_ioctl_op {
+	XSC_IOCTL_OP_ADD,
+	XSC_IOCTL_OP_DEL,
+	XSC_IOCTL_OP_GET,
+	XSC_IOCTL_OP_CLR,
+	XSC_IOCTL_OP_MOD,
+	XSC_IOCTL_OP_MAX
+};
+
 
 struct xsc_inbox_hdr {
 	__be16     opcode;
drivers/net/xsc/xsc_ethdev.c +39 -0
index 991978dd1c..d3e044e740 100644
@@ -11,6 +11,7 @@
 #include "xsc_dev.h"
 #include "xsc_ethdev.h"
 #include "xsc_utils.h"
+#include "xsc_flow.h"
 #include "xsc_ctrl.h"
 #include "xsc_rxtx.h"
 
@@ -787,6 +788,43 @@ xsc_rxq_start(struct rte_eth_dev *dev)
 	return -rte_errno;
 }
 
+static int
+xsc_dev_start_config_hw(struct rte_eth_dev *dev)
+{
+	struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
+	struct xsc_hwinfo *hwinfo;
+	int peer_dstinfo = 0;
+	int peer_logicalport = 0;
+	int logical_port = 0;
+	int local_dstinfo = 0;
+	int pcie_logic_port = 0;
+	int qp_set_id = 0;
+	int rep_id;
+	struct xsc_rxq_data *rxq = xsc_rxq_get(dev, 0);
+	uint16_t rx_qpn = (uint16_t)rxq->qpn;
+	static int xsc_global_pct_priority_idx = 128;
+
+	if (priv->funcid_type != XSC_PHYPORT_MAC_FUNCID)
+		return -1;
+
+	hwinfo = &priv->xdev->hwinfo;
+	rep_id = priv->representor_id;
+	peer_dstinfo = hwinfo->mac_phy_port;
+	peer_logicalport = hwinfo->mac_phy_port;
+
+	qp_set_id = rep_id % 511 + 1;
+	logical_port = priv->xdev->vfos_logical_in_port + qp_set_id - 1;
+	local_dstinfo = logical_port;
+	pcie_logic_port = hwinfo->pcie_no + 8;
+
+	xsc_create_ipat(dev, logical_port, peer_dstinfo);
+	xsc_create_epat(dev, local_dstinfo, pcie_logic_port,
+		rx_qpn - hwinfo->raw_rss_qp_id_base, priv->num_rq);
+	xsc_create_pct(dev, logical_port, peer_dstinfo, xsc_global_pct_priority_idx++);
+	xsc_create_pct(dev, peer_logicalport, local_dstinfo, xsc_global_pct_priority_idx++);
+	return 0;
+}
+
 static int
 xsc_ethdev_start(struct rte_eth_dev *dev)
 {
@@ -812,6 +850,7 @@ xsc_ethdev_start(struct rte_eth_dev *dev)
 	dev->rx_pkt_burst = xsc_rx_burst;
 	dev->tx_pkt_burst = xsc_tx_burst;
 
+	ret = xsc_dev_start_config_hw(dev);
 	return 0;
 
 error:
drivers/net/xsc/xsc_flow.c new file +167 -0

167 lines not on this page · raw message

drivers/net/xsc/xsc_flow.h new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.25.1