Skip to contentSkip to conversation

net/xsc: add ethdev RSS hash ops

PATCH Superseded WanRenyong 1 participant 1 message Sep 6, 2024 Network drivers

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

WanRenyong

author
#0 lore raw

PATCH 12/19 net/xsc: add ethdev RSS hash ops

Implement xsc ethdev RSS hash config get and update functions.

---
 doc/guides/nics/features/xsc.ini |  3 +++
 drivers/net/xsc/xsc_ctrl.h       | 27 ++++++++++++++++++++
 drivers/net/xsc/xsc_ethdev.c     | 43 +++++++++++++++++++++++++++++++-
 drivers/net/xsc/xsc_ethdev.h     | 17 +++++++++++++
 drivers/net/xsc/xsc_utils.h      |  5 +++-
 5 files changed, 93 insertions(+), 2 deletions(-)
doc/guides/nics/features/xsc.ini +3 -0
index b5c44ce535..bdeb7a984b 100644
@@ -4,6 +4,9 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
 Linux                = Y
 ARMv8                = Y
 x86-64               = Y
drivers/net/xsc/xsc_ctrl.h +27 -0
index a7259c5fcb..c33e625097 100644
@@ -69,6 +69,33 @@ struct xsc_ioctl_mbox_out {
 	uint8_t                 data[];
 };
 
+struct xsc_nic_attr {
+	__be16       caps;
+	__be16       caps_mask;
+	uint8_t      mac_addr[6];
+};
+
+struct xsc_rss_modify_attr {
+	uint8_t      caps_mask;
+	uint8_t      rss_en;
+	__be16       rqn_base;
+	__be16       rqn_num;
+	uint8_t      hfunc;
+	__be32       hash_tmpl;
+	uint8_t      hash_key[52];
+};
+
+struct xsc_cmd_modify_nic_hca_mbox_in {
+	struct xsc_inbox_hdr            hdr;
+	struct xsc_nic_attr             nic;
+	struct xsc_rss_modify_attr      rss;
+};
+
+struct xsc_cmd_modify_nic_hca_mbox_out {
+	struct xsc_outbox_hdr   hdr;
+	uint8_t                 rsvd0[4];
+};
+
 struct xsc_ioctl_data_tl {
 	uint16_t table;
 	uint16_t opmod;
drivers/net/xsc/xsc_ethdev.c +42 -1

61 lines not on this page · raw message

drivers/net/xsc/xsc_ethdev.h +17 -0
index 10c3d8cc87..fb92d47dd0 100644
@@ -9,6 +9,8 @@
 #define XSC_MAX_DESC_NUMBER 1024
 #define XSC_RX_FREE_THRESH 32
 
+#define XSC_CMD_OP_MODIFY_NIC_HCA 0x812
+
 struct xsc_dev_config {
 	uint8_t pph_flag;
 	unsigned int hw_csum:1;
@@ -51,4 +53,19 @@ struct xsc_ethdev_priv {
 #define TO_XSC_ETHDEV_PRIV(dev) \
 	((struct xsc_ethdev_priv *)(dev)->data->dev_private)
 
+enum {
+	XSC_TBM_CAP_HASH_PPH = 0,
+	XSC_TBM_CAP_RSS,
+	XSC_TBM_CAP_PP_BYPASS,
+	XSC_TBM_CAP_PCT_DROP_CONFIG,
+};
+
+enum {
+	XSC_RSS_HASH_KEY_UPDATE = 0,
+	XSC_RSS_HASH_TEMP_UPDATE,
+	XSC_RSS_HASH_FUNC_UPDATE,
+	XSC_RSS_RXQ_UPDATE,
+	XSC_RSS_RXQ_DROP,
+};
+
 #endif /* _XSC_ETHDEV_H_ */
drivers/net/xsc/xsc_utils.h +4 -1
index 8d08cf75b7..672ba3871e 100644
@@ -9,6 +9,10 @@
 
 #include <ethdev_pci.h>
 
+#ifndef BIT
+#define BIT(n)  (1UL << (n))
+#endif
+
 struct ibv_device *xsc_get_ibv_device(const struct rte_pci_addr *addr);
 int xsc_get_ifname_by_pci_addr(struct rte_pci_addr *addr, char *ifname);
 int xsc_get_ifindex_by_ifname(const char *ifname, int *ifindex);
@@ -19,5 +23,4 @@ int xsc_get_mtu(uint16_t *mtu, uint32_t ifindex);
 int xsc_set_mtu(uint16_t mtu, uint32_t ifindex);
 int xsc_get_mac(uint8_t *mac, uint32_t ifindex);
 
-
 #endif
Signature · 1 line
2.25.1