* [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update
@ 2020-03-20 11:29 chandu
2020-03-21 11:40 ` Kumar, Ravi1
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: chandu @ 2020-03-20 11:29 UTC (permalink / raw)
To: dev; +Cc: Ravi1.Kumar, Amaranath.Somalapuram
From: Chandu Babu N <chandu@amd.com>
add support for RSS ethdev_ops reta_update, reta_query
rss_hash_update, rss_hash_conf_get
Signed-off-by: Chandu Babu N <chandu@amd.com>
---
drivers/net/axgbe/axgbe_dev.c | 5 +-
drivers/net/axgbe/axgbe_ethdev.c | 146 +++++++++++++++++++++++++++++++
drivers/net/axgbe/axgbe_ethdev.h | 3 +
3 files changed, 152 insertions(+), 2 deletions(-)
diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c
index 5f0f19592..af62eae3b 100644
--- a/drivers/net/axgbe/axgbe_dev.c
+++ b/drivers/net/axgbe/axgbe_dev.c
@@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata, unsigned int type,
return -EBUSY;
}
-static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
+int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
{
struct rte_eth_rss_conf *rss_conf;
unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32);
@@ -638,7 +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
return 0;
}
-static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
{
unsigned int i;
int ret;
@@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata)
uint64_t rss_hf;
rss_conf = &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
+ pdata->rss_hf = rss_conf->rss_hf;
rss_hf = rss_conf->rss_hf;
if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 867058845..f42bb7a0d 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -60,6 +60,18 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
unsigned int size);
static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
+static int
+axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+static int
+axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf);
+static int axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf);
static int axgbe_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int axgbe_flow_ctrl_get(struct rte_eth_dev *dev,
@@ -201,6 +213,10 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
.xstats_get_names = axgbe_dev_xstats_get_names,
.xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
.xstats_get_by_id = axgbe_dev_xstats_get_by_id,
+ .reta_update = axgbe_dev_rss_reta_update,
+ .reta_query = axgbe_dev_rss_reta_query,
+ .rss_hash_update = axgbe_dev_rss_hash_update,
+ .rss_hash_conf_get = axgbe_dev_rss_hash_conf_get,
.dev_infos_get = axgbe_dev_info_get,
.rx_queue_setup = axgbe_dev_rx_queue_setup,
.rx_queue_release = axgbe_dev_rx_queue_release,
@@ -450,6 +466,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
return 0;
}
+static int
+axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int i, idx, shift;
+ int ret;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < reta_size; i++) {
+ idx = i / RTE_RETA_GROUP_SIZE;
+ shift = i % RTE_RETA_GROUP_SIZE;
+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+ continue;
+ pdata->rss_table[i] = reta_conf[idx].reta[shift];
+ }
+
+ /* Program the lookup table */
+ ret = axgbe_write_rss_lookup_table(pdata);
+ return ret;
+}
+
+static int
+axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int i, idx, shift;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < reta_size; i++) {
+ idx = i / RTE_RETA_GROUP_SIZE;
+ shift = i % RTE_RETA_GROUP_SIZE;
+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+ continue;
+ reta_conf[idx].reta[shift] = pdata->rss_table[i];
+ }
+ return 0;
+}
+
+static int
+axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ int ret;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (!rss_conf) {
+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+ return -EINVAL;
+ }
+
+ if (rss_conf->rss_key &&
+ rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
+ rte_memcpy(pdata->rss_key, rss_conf->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+ /* Program the hash key */
+ ret = axgbe_write_rss_hash_key(pdata);
+ if (ret)
+ return ret;
+ }
+
+ pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
+
+ if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
+ if (pdata->rss_hf &
+ (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
+ if (pdata->rss_hf &
+ (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
+
+ /* Set the RSS options */
+ AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
+
+ return 0;
+}
+
+static int
+axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (!rss_conf) {
+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+ return -EINVAL;
+ }
+
+ if (rss_conf->rss_key &&
+ rss_conf->rss_key_len <= AXGBE_RSS_HASH_KEY_SIZE) {
+ rte_memcpy(rss_conf->rss_key, pdata->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+ }
+ rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
+ rss_conf->rss_hf = pdata->rss_hf;
+ return 0;
+}
+
static void
axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
{
diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h
index f10ec4a40..cedce5af6 100644
--- a/drivers/net/axgbe/axgbe_ethdev.h
+++ b/drivers/net/axgbe/axgbe_ethdev.h
@@ -594,6 +594,7 @@ struct axgbe_port {
uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE];
uint32_t rss_options;
int rss_enable;
+ uint64_t rss_hf;
/* Hardware features of the device */
struct axgbe_hw_features hw_feat;
@@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct axgbe_i2c_if *i2c_if);
void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
uint32_t index);
void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr, bool add);
+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata);
+int axgbe_write_rss_hash_key(struct axgbe_port *pdata);
#endif /* RTE_ETH_AXGBE_H_ */
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update
2020-03-20 11:29 [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update chandu
@ 2020-03-21 11:40 ` Kumar, Ravi1
2020-03-24 9:54 ` Andrew Rybchenko
2020-05-29 11:49 ` [dpdk-dev] [PATCH v2] " chandu
2 siblings, 0 replies; 11+ messages in thread
From: Kumar, Ravi1 @ 2020-03-21 11:40 UTC (permalink / raw)
To: Namburu, Chandu-babu, dev; +Cc: Somalapuram, Amaranath
[AMD Public Use]
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
>From: Chandu Babu N <chandu@amd.com>
>
>add support for RSS ethdev_ops reta_update, reta_query rss_hash_update, rss_hash_conf_get
>
>Signed-off-by: Chandu Babu N <chandu@amd.com>
>---
> drivers/net/axgbe/axgbe_dev.c | 5 +-
> drivers/net/axgbe/axgbe_ethdev.c | 146 +++++++++++++++++++++++++++++++
> drivers/net/axgbe/axgbe_ethdev.h | 3 +
> 3 files changed, 152 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c index 5f0f19592..af62eae3b 100644
>--- a/drivers/net/axgbe/axgbe_dev.c
>+++ b/drivers/net/axgbe/axgbe_dev.c
>@@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata, unsigned int type,
> return -EBUSY;
> }
>
>-static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
>+int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
> {
> struct rte_eth_rss_conf *rss_conf;
> unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32); @@ -638,7 +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
> return 0;
> }
>
>-static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
>+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
> {
> unsigned int i;
> int ret;
>@@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata)
> uint64_t rss_hf;
>
> rss_conf = &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
>+ pdata->rss_hf = rss_conf->rss_hf;
> rss_hf = rss_conf->rss_hf;
>
> if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6)) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
>index 867058845..f42bb7a0d 100644
>--- a/drivers/net/axgbe/axgbe_ethdev.c
>+++ b/drivers/net/axgbe/axgbe_ethdev.c
>@@ -60,6 +60,18 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
> const uint64_t *ids,
> unsigned int size);
> static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
>+static int
>+axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
>+ struct rte_eth_rss_reta_entry64 *reta_conf,
>+ uint16_t reta_size);
>+static int
>+axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
>+ struct rte_eth_rss_reta_entry64 *reta_conf,
>+ uint16_t reta_size);
>+static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
>+ struct rte_eth_rss_conf *rss_conf); static int
>+axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
>+ struct rte_eth_rss_conf *rss_conf);
> static int axgbe_dev_info_get(struct rte_eth_dev *dev,
> struct rte_eth_dev_info *dev_info); static int axgbe_flow_ctrl_get(struct rte_eth_dev *dev, @@ -201,6 +213,10 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
> .xstats_get_names = axgbe_dev_xstats_get_names,
> .xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
> .xstats_get_by_id = axgbe_dev_xstats_get_by_id,
>+ .reta_update = axgbe_dev_rss_reta_update,
>+ .reta_query = axgbe_dev_rss_reta_query,
>+ .rss_hash_update = axgbe_dev_rss_hash_update,
>+ .rss_hash_conf_get = axgbe_dev_rss_hash_conf_get,
> .dev_infos_get = axgbe_dev_info_get,
> .rx_queue_setup = axgbe_dev_rx_queue_setup,
> .rx_queue_release = axgbe_dev_rx_queue_release,
>@@ -450,6 +466,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
> return 0;
> }
>
>+static int
>+axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
>+ struct rte_eth_rss_reta_entry64 *reta_conf,
>+ uint16_t reta_size)
>+{
>+ struct axgbe_port *pdata = dev->data->dev_private;
>+ unsigned int i, idx, shift;
>+ int ret;
>+
>+ if (!pdata->rss_enable) {
>+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
>+ return -ENOTSUP;
>+ }
>+
>+ if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
>+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
>+ return -EINVAL;
>+ }
>+
>+ for (i = 0; i < reta_size; i++) {
>+ idx = i / RTE_RETA_GROUP_SIZE;
>+ shift = i % RTE_RETA_GROUP_SIZE;
>+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
>+ continue;
>+ pdata->rss_table[i] = reta_conf[idx].reta[shift];
>+ }
>+
>+ /* Program the lookup table */
>+ ret = axgbe_write_rss_lookup_table(pdata);
>+ return ret;
>+}
>+
>+static int
>+axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
>+ struct rte_eth_rss_reta_entry64 *reta_conf,
>+ uint16_t reta_size)
>+{
>+ struct axgbe_port *pdata = dev->data->dev_private;
>+ unsigned int i, idx, shift;
>+
>+ if (!pdata->rss_enable) {
>+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
>+ return -ENOTSUP;
>+ }
>+
>+ if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
>+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
>+ return -EINVAL;
>+ }
>+
>+ for (i = 0; i < reta_size; i++) {
>+ idx = i / RTE_RETA_GROUP_SIZE;
>+ shift = i % RTE_RETA_GROUP_SIZE;
>+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
>+ continue;
>+ reta_conf[idx].reta[shift] = pdata->rss_table[i];
>+ }
>+ return 0;
>+}
>+
>+static int
>+axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
>+ struct rte_eth_rss_conf *rss_conf) {
>+ struct axgbe_port *pdata = dev->data->dev_private;
>+ int ret;
>+
>+ if (!pdata->rss_enable) {
>+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
>+ return -ENOTSUP;
>+ }
>+
>+ if (!rss_conf) {
>+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
>+ return -EINVAL;
>+ }
>+
>+ if (rss_conf->rss_key &&
>+ rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
>+ rte_memcpy(pdata->rss_key, rss_conf->rss_key,
>+ AXGBE_RSS_HASH_KEY_SIZE);
>+ /* Program the hash key */
>+ ret = axgbe_write_rss_hash_key(pdata);
>+ if (ret)
>+ return ret;
>+ }
>+
>+ pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
>+
>+ if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
>+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
>+ if (pdata->rss_hf &
>+ (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP))
>+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
>+ if (pdata->rss_hf &
>+ (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP))
>+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
>+
>+ /* Set the RSS options */
>+ AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
>+
>+ return 0;
>+}
>+
>+static int
>+axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
>+ struct rte_eth_rss_conf *rss_conf) {
>+ struct axgbe_port *pdata = dev->data->dev_private;
>+
>+ if (!pdata->rss_enable) {
>+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
>+ return -ENOTSUP;
>+ }
>+
>+ if (!rss_conf) {
>+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
>+ return -EINVAL;
>+ }
>+
>+ if (rss_conf->rss_key &&
>+ rss_conf->rss_key_len <= AXGBE_RSS_HASH_KEY_SIZE) {
>+ rte_memcpy(rss_conf->rss_key, pdata->rss_key,
>+ AXGBE_RSS_HASH_KEY_SIZE);
>+ }
>+ rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
>+ rss_conf->rss_hf = pdata->rss_hf;
>+ return 0;
>+}
>+
> static void
> axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h
>index f10ec4a40..cedce5af6 100644
>--- a/drivers/net/axgbe/axgbe_ethdev.h
>+++ b/drivers/net/axgbe/axgbe_ethdev.h
>@@ -594,6 +594,7 @@ struct axgbe_port {
> uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE];
> uint32_t rss_options;
> int rss_enable;
>+ uint64_t rss_hf;
>
> /* Hardware features of the device */
> struct axgbe_hw_features hw_feat;
>@@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct axgbe_i2c_if *i2c_if); void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
> uint32_t index);
> void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr, bool add);
>+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata); int
>+axgbe_write_rss_hash_key(struct axgbe_port *pdata);
>
> #endif /* RTE_ETH_AXGBE_H_ */
>--
>2.17.1
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update
2020-03-20 11:29 [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update chandu
2020-03-21 11:40 ` Kumar, Ravi1
@ 2020-03-24 9:54 ` Andrew Rybchenko
2020-03-24 10:17 ` Namburu, Chandu-babu
2020-05-29 11:49 ` [dpdk-dev] [PATCH v2] " chandu
2 siblings, 1 reply; 11+ messages in thread
From: Andrew Rybchenko @ 2020-03-24 9:54 UTC (permalink / raw)
To: chandu, dev; +Cc: Ravi1.Kumar, Amaranath.Somalapuram
On 3/20/20 2:29 PM, chandu@amd.com wrote:
> From: Chandu Babu N <chandu@amd.com>
>
> add support for RSS ethdev_ops reta_update, reta_query
> rss_hash_update, rss_hash_conf_get
The patch should update doc/guides/nics/features/axgbe.ini to
advertise corresponding features.
>
> Signed-off-by: Chandu Babu N <chandu@amd.com>
> ---
> drivers/net/axgbe/axgbe_dev.c | 5 +-
> drivers/net/axgbe/axgbe_ethdev.c | 146 +++++++++++++++++++++++++++++++
> drivers/net/axgbe/axgbe_ethdev.h | 3 +
> 3 files changed, 152 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c
> index 5f0f19592..af62eae3b 100644
> --- a/drivers/net/axgbe/axgbe_dev.c
> +++ b/drivers/net/axgbe/axgbe_dev.c
> @@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata, unsigned int type,
> return -EBUSY;
> }
>
> -static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
> +int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
> {
> struct rte_eth_rss_conf *rss_conf;
> unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32);
> @@ -638,7 +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
> return 0;
> }
>
> -static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
> +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
> {
> unsigned int i;
> int ret;
> @@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata)
> uint64_t rss_hf;
>
> rss_conf = &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
> + pdata->rss_hf = rss_conf->rss_hf;
> rss_hf = rss_conf->rss_hf;
>
> if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
> diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
> index 867058845..f42bb7a0d 100644
> --- a/drivers/net/axgbe/axgbe_ethdev.c
> +++ b/drivers/net/axgbe/axgbe_ethdev.c
> @@ -60,6 +60,18 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
> const uint64_t *ids,
> unsigned int size);
> static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
> +static int
> +axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
> + struct rte_eth_rss_reta_entry64 *reta_conf,
> + uint16_t reta_size);
> +static int
> +axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
> + struct rte_eth_rss_reta_entry64 *reta_conf,
> + uint16_t reta_size);
It looks like style is inconsistent for above to declarations
vs declarations around.
> +static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
> + struct rte_eth_rss_conf *rss_conf);
> +static int axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
> + struct rte_eth_rss_conf *rss_conf);
> static int axgbe_dev_info_get(struct rte_eth_dev *dev,
> struct rte_eth_dev_info *dev_info);
> static int axgbe_flow_ctrl_get(struct rte_eth_dev *dev,
> @@ -201,6 +213,10 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
> .xstats_get_names = axgbe_dev_xstats_get_names,
> .xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
> .xstats_get_by_id = axgbe_dev_xstats_get_by_id,
> + .reta_update = axgbe_dev_rss_reta_update,
> + .reta_query = axgbe_dev_rss_reta_query,
> + .rss_hash_update = axgbe_dev_rss_hash_update,
> + .rss_hash_conf_get = axgbe_dev_rss_hash_conf_get,
> .dev_infos_get = axgbe_dev_info_get,
> .rx_queue_setup = axgbe_dev_rx_queue_setup,
> .rx_queue_release = axgbe_dev_rx_queue_release,
> @@ -450,6 +466,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
> return 0;
> }
>
> +static int
> +axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
> + struct rte_eth_rss_reta_entry64 *reta_conf,
> + uint16_t reta_size)
> +{
> + struct axgbe_port *pdata = dev->data->dev_private;
> + unsigned int i, idx, shift;
> + int ret;
> +
> + if (!pdata->rss_enable) {
> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
> + return -ENOTSUP;
> + }
> +
> + if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
DPDK style guide [1] says to use comparison to 0 instead of !
[1]
https://doc.dpdk.org/guides/contributing/coding_style.html#c-statement-style-and-conventions
> + PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < reta_size; i++) {
> + idx = i / RTE_RETA_GROUP_SIZE;
> + shift = i % RTE_RETA_GROUP_SIZE;
> + if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
> + continue;
> + pdata->rss_table[i] = reta_conf[idx].reta[shift];
> + }
> +
> + /* Program the lookup table */
> + ret = axgbe_write_rss_lookup_table(pdata);
> + return ret;
> +}
> +
> +static int
> +axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
> + struct rte_eth_rss_reta_entry64 *reta_conf,
> + uint16_t reta_size)
> +{
> + struct axgbe_port *pdata = dev->data->dev_private;
> + unsigned int i, idx, shift;
> +
> + if (!pdata->rss_enable) {
> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
> + return -ENOTSUP;
> + }
> +
> + if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
Here too
> + PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < reta_size; i++) {
> + idx = i / RTE_RETA_GROUP_SIZE;
> + shift = i % RTE_RETA_GROUP_SIZE;
> + if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
> + continue;
> + reta_conf[idx].reta[shift] = pdata->rss_table[i];
> + }
> + return 0;
> +}
> +
> +static int
> +axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
> + struct rte_eth_rss_conf *rss_conf)
> +{
> + struct axgbe_port *pdata = dev->data->dev_private;
> + int ret;
> +
> + if (!pdata->rss_enable) {
> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
> + return -ENOTSUP;
> + }
> +
> + if (!rss_conf) {
Here too. It should comparison vs NULL.
> + PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
> + return -EINVAL;
> + }
> +
> + if (rss_conf->rss_key &&
and here
> + rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
> + rte_memcpy(pdata->rss_key, rss_conf->rss_key,
> + AXGBE_RSS_HASH_KEY_SIZE);
> + /* Program the hash key */
> + ret = axgbe_write_rss_hash_key(pdata);
> + if (ret)
and here
> + return ret;
> + }
> +
> + pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
> +
> + if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
> + if (pdata->rss_hf &
> + (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP))
> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
> + if (pdata->rss_hf &
> + (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP))
> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
> +
> + /* Set the RSS options */
> + AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
> +
> + return 0;
> +}
> +
> +static int
> +axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
> + struct rte_eth_rss_conf *rss_conf)
> +{
> + struct axgbe_port *pdata = dev->data->dev_private;
> +
> + if (!pdata->rss_enable) {
> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
> + return -ENOTSUP;
> + }
> +
> + if (!rss_conf) {
and here
> + PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
> + return -EINVAL;
> + }
> +
> + if (rss_conf->rss_key &&
and here
> + rss_conf->rss_key_len <= AXGBE_RSS_HASH_KEY_SIZE) {
> + rte_memcpy(rss_conf->rss_key, pdata->rss_key,
> + AXGBE_RSS_HASH_KEY_SIZE);
> + }
> + rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
> + rss_conf->rss_hf = pdata->rss_hf;
> + return 0;
> +}
> +
> static void
> axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
> {
> diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h
> index f10ec4a40..cedce5af6 100644
> --- a/drivers/net/axgbe/axgbe_ethdev.h
> +++ b/drivers/net/axgbe/axgbe_ethdev.h
> @@ -594,6 +594,7 @@ struct axgbe_port {
> uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE];
> uint32_t rss_options;
> int rss_enable;
> + uint64_t rss_hf;
>
> /* Hardware features of the device */
> struct axgbe_hw_features hw_feat;
> @@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct axgbe_i2c_if *i2c_if);
> void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
> uint32_t index);
> void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr, bool add);
> +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata);
> +int axgbe_write_rss_hash_key(struct axgbe_port *pdata);
>
> #endif /* RTE_ETH_AXGBE_H_ */
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update
2020-03-24 9:54 ` Andrew Rybchenko
@ 2020-03-24 10:17 ` Namburu, Chandu-babu
2020-03-24 10:24 ` Andrew Rybchenko
0 siblings, 1 reply; 11+ messages in thread
From: Namburu, Chandu-babu @ 2020-03-24 10:17 UTC (permalink / raw)
To: Andrew Rybchenko, dev; +Cc: Kumar, Ravi1, Somalapuram, Amaranath
[AMD Official Use Only - Internal Distribution Only]
RSS functionality is already supported by AXGBE and it is updated in doc/guides/nics/features/axgbe.ini accordingly.
This patch adds support to update RSS Hash key and RETA.
Regards,
Chandu
-----Original Message-----
From: Andrew Rybchenko <arybchenko@solarflare.com>
Sent: Tuesday, March 24, 2020 3:25 PM
To: Namburu, Chandu-babu <chandu@amd.com>; dev@dpdk.org
Cc: Kumar, Ravi1 <Ravi1.Kumar@amd.com>; Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>
Subject: Re: [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update
On 3/20/20 2:29 PM, chandu@amd.com wrote:
> From: Chandu Babu N <chandu@amd.com>
>
> add support for RSS ethdev_ops reta_update, reta_query
> rss_hash_update, rss_hash_conf_get
The patch should update doc/guides/nics/features/axgbe.ini to advertise corresponding features.
>
> Signed-off-by: Chandu Babu N <chandu@amd.com>
> ---
> drivers/net/axgbe/axgbe_dev.c | 5 +-
> drivers/net/axgbe/axgbe_ethdev.c | 146 +++++++++++++++++++++++++++++++
> drivers/net/axgbe/axgbe_ethdev.h | 3 +
> 3 files changed, 152 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/axgbe/axgbe_dev.c
> b/drivers/net/axgbe/axgbe_dev.c index 5f0f19592..af62eae3b 100644
> --- a/drivers/net/axgbe/axgbe_dev.c
> +++ b/drivers/net/axgbe/axgbe_dev.c
> @@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata, unsigned int type,
> return -EBUSY;
> }
>
> -static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
> +int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
> {
> struct rte_eth_rss_conf *rss_conf;
> unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32); @@
> -638,7 +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
> return 0;
> }
>
> -static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
> +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
> {
> unsigned int i;
> int ret;
> @@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata)
> uint64_t rss_hf;
>
> rss_conf = &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
> + pdata->rss_hf = rss_conf->rss_hf;
> rss_hf = rss_conf->rss_hf;
>
> if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6)) diff --git
> a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
> index 867058845..f42bb7a0d 100644
> --- a/drivers/net/axgbe/axgbe_ethdev.c
> +++ b/drivers/net/axgbe/axgbe_ethdev.c
> @@ -60,6 +60,18 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
> const uint64_t *ids,
> unsigned int size);
> static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
> +static int
> +axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
> + struct rte_eth_rss_reta_entry64 *reta_conf,
> + uint16_t reta_size);
> +static int
> +axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
> + struct rte_eth_rss_reta_entry64 *reta_conf,
> + uint16_t reta_size);
It looks like style is inconsistent for above to declarations vs declarations around.
> +static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
> + struct rte_eth_rss_conf *rss_conf); static int
> +axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
> + struct rte_eth_rss_conf *rss_conf);
> static int axgbe_dev_info_get(struct rte_eth_dev *dev,
> struct rte_eth_dev_info *dev_info); static int
> axgbe_flow_ctrl_get(struct rte_eth_dev *dev, @@ -201,6 +213,10 @@
> static const struct eth_dev_ops axgbe_eth_dev_ops = {
> .xstats_get_names = axgbe_dev_xstats_get_names,
> .xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
> .xstats_get_by_id = axgbe_dev_xstats_get_by_id,
> + .reta_update = axgbe_dev_rss_reta_update,
> + .reta_query = axgbe_dev_rss_reta_query,
> + .rss_hash_update = axgbe_dev_rss_hash_update,
> + .rss_hash_conf_get = axgbe_dev_rss_hash_conf_get,
> .dev_infos_get = axgbe_dev_info_get,
> .rx_queue_setup = axgbe_dev_rx_queue_setup,
> .rx_queue_release = axgbe_dev_rx_queue_release,
> @@ -450,6 +466,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
> return 0;
> }
>
> +static int
> +axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
> + struct rte_eth_rss_reta_entry64 *reta_conf,
> + uint16_t reta_size)
> +{
> + struct axgbe_port *pdata = dev->data->dev_private;
> + unsigned int i, idx, shift;
> + int ret;
> +
> + if (!pdata->rss_enable) {
> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
> + return -ENOTSUP;
> + }
> +
> + if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
DPDK style guide [1] says to use comparison to 0 instead of !
[1]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides%2Fcontributing%2Fcoding_style.html%23c-statement-style-and-conventions&data=02%7C01%7Cchandu%40amd.com%7C9eb51750daa24b1703cf08d7cfd96a2b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637206405006771688&sdata=LNbxA2nLRb3HaCoae%2B%2FBh1%2FK41ZJiC4tuLjiYOPYr2E%3D&reserved=0
> + PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < reta_size; i++) {
> + idx = i / RTE_RETA_GROUP_SIZE;
> + shift = i % RTE_RETA_GROUP_SIZE;
> + if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
> + continue;
> + pdata->rss_table[i] = reta_conf[idx].reta[shift];
> + }
> +
> + /* Program the lookup table */
> + ret = axgbe_write_rss_lookup_table(pdata);
> + return ret;
> +}
> +
> +static int
> +axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
> + struct rte_eth_rss_reta_entry64 *reta_conf,
> + uint16_t reta_size)
> +{
> + struct axgbe_port *pdata = dev->data->dev_private;
> + unsigned int i, idx, shift;
> +
> + if (!pdata->rss_enable) {
> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
> + return -ENOTSUP;
> + }
> +
> + if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
Here too
> + PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < reta_size; i++) {
> + idx = i / RTE_RETA_GROUP_SIZE;
> + shift = i % RTE_RETA_GROUP_SIZE;
> + if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
> + continue;
> + reta_conf[idx].reta[shift] = pdata->rss_table[i];
> + }
> + return 0;
> +}
> +
> +static int
> +axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
> + struct rte_eth_rss_conf *rss_conf) {
> + struct axgbe_port *pdata = dev->data->dev_private;
> + int ret;
> +
> + if (!pdata->rss_enable) {
> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
> + return -ENOTSUP;
> + }
> +
> + if (!rss_conf) {
Here too. It should comparison vs NULL.
> + PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
> + return -EINVAL;
> + }
> +
> + if (rss_conf->rss_key &&
and here
> + rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
> + rte_memcpy(pdata->rss_key, rss_conf->rss_key,
> + AXGBE_RSS_HASH_KEY_SIZE);
> + /* Program the hash key */
> + ret = axgbe_write_rss_hash_key(pdata);
> + if (ret)
and here
> + return ret;
> + }
> +
> + pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
> +
> + if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
> + if (pdata->rss_hf &
> + (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP))
> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
> + if (pdata->rss_hf &
> + (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP))
> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
> +
> + /* Set the RSS options */
> + AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
> +
> + return 0;
> +}
> +
> +static int
> +axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
> + struct rte_eth_rss_conf *rss_conf) {
> + struct axgbe_port *pdata = dev->data->dev_private;
> +
> + if (!pdata->rss_enable) {
> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
> + return -ENOTSUP;
> + }
> +
> + if (!rss_conf) {
and here
> + PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
> + return -EINVAL;
> + }
> +
> + if (rss_conf->rss_key &&
and here
> + rss_conf->rss_key_len <= AXGBE_RSS_HASH_KEY_SIZE) {
> + rte_memcpy(rss_conf->rss_key, pdata->rss_key,
> + AXGBE_RSS_HASH_KEY_SIZE);
> + }
> + rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
> + rss_conf->rss_hf = pdata->rss_hf;
> + return 0;
> +}
> +
> static void
> axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) {
> diff --git a/drivers/net/axgbe/axgbe_ethdev.h
> b/drivers/net/axgbe/axgbe_ethdev.h
> index f10ec4a40..cedce5af6 100644
> --- a/drivers/net/axgbe/axgbe_ethdev.h
> +++ b/drivers/net/axgbe/axgbe_ethdev.h
> @@ -594,6 +594,7 @@ struct axgbe_port {
> uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE];
> uint32_t rss_options;
> int rss_enable;
> + uint64_t rss_hf;
>
> /* Hardware features of the device */
> struct axgbe_hw_features hw_feat;
> @@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct
> axgbe_i2c_if *i2c_if); void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
> uint32_t index);
> void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr,
> bool add);
> +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata); int
> +axgbe_write_rss_hash_key(struct axgbe_port *pdata);
>
> #endif /* RTE_ETH_AXGBE_H_ */
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update
2020-03-24 10:17 ` Namburu, Chandu-babu
@ 2020-03-24 10:24 ` Andrew Rybchenko
2020-03-25 3:25 ` Namburu, Chandu-babu
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Rybchenko @ 2020-03-24 10:24 UTC (permalink / raw)
To: Namburu, Chandu-babu, dev; +Cc: Kumar, Ravi1, Somalapuram, Amaranath
On 3/24/20 1:17 PM, Namburu, Chandu-babu wrote:
> [AMD Official Use Only - Internal Distribution Only]
>
> RSS functionality is already supported by AXGBE and it is updated in doc/guides/nics/features/axgbe.ini accordingly.
> This patch adds support to update RSS Hash key and RETA.
What about (see doc/guides/nics/features/default.ini)
RSS key update =
RSS reta update =
> Regards,
> Chandu
> -----Original Message-----
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> Sent: Tuesday, March 24, 2020 3:25 PM
> To: Namburu, Chandu-babu <chandu@amd.com>; dev@dpdk.org
> Cc: Kumar, Ravi1 <Ravi1.Kumar@amd.com>; Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>
> Subject: Re: [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update
>
> On 3/20/20 2:29 PM, chandu@amd.com wrote:
>> From: Chandu Babu N <chandu@amd.com>
>>
>> add support for RSS ethdev_ops reta_update, reta_query
>> rss_hash_update, rss_hash_conf_get
>
> The patch should update doc/guides/nics/features/axgbe.ini to advertise corresponding features.
>
>>
>> Signed-off-by: Chandu Babu N <chandu@amd.com>
>> ---
>> drivers/net/axgbe/axgbe_dev.c | 5 +-
>> drivers/net/axgbe/axgbe_ethdev.c | 146 +++++++++++++++++++++++++++++++
>> drivers/net/axgbe/axgbe_ethdev.h | 3 +
>> 3 files changed, 152 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/axgbe/axgbe_dev.c
>> b/drivers/net/axgbe/axgbe_dev.c index 5f0f19592..af62eae3b 100644
>> --- a/drivers/net/axgbe/axgbe_dev.c
>> +++ b/drivers/net/axgbe/axgbe_dev.c
>> @@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata, unsigned int type,
>> return -EBUSY;
>> }
>>
>> -static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
>> +int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
>> {
>> struct rte_eth_rss_conf *rss_conf;
>> unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32); @@
>> -638,7 +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
>> return 0;
>> }
>>
>> -static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
>> +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
>> {
>> unsigned int i;
>> int ret;
>> @@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata)
>> uint64_t rss_hf;
>>
>> rss_conf = &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
>> + pdata->rss_hf = rss_conf->rss_hf;
>> rss_hf = rss_conf->rss_hf;
>>
>> if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6)) diff --git
>> a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
>> index 867058845..f42bb7a0d 100644
>> --- a/drivers/net/axgbe/axgbe_ethdev.c
>> +++ b/drivers/net/axgbe/axgbe_ethdev.c
>> @@ -60,6 +60,18 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
>> const uint64_t *ids,
>> unsigned int size);
>> static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
>> +static int
>> +axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_reta_entry64 *reta_conf,
>> + uint16_t reta_size);
>> +static int
>> +axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_reta_entry64 *reta_conf,
>> + uint16_t reta_size);
>
> It looks like style is inconsistent for above to declarations vs declarations around.
>
>> +static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf); static int
>> +axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf);
>> static int axgbe_dev_info_get(struct rte_eth_dev *dev,
>> struct rte_eth_dev_info *dev_info); static int
>> axgbe_flow_ctrl_get(struct rte_eth_dev *dev, @@ -201,6 +213,10 @@
>> static const struct eth_dev_ops axgbe_eth_dev_ops = {
>> .xstats_get_names = axgbe_dev_xstats_get_names,
>> .xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
>> .xstats_get_by_id = axgbe_dev_xstats_get_by_id,
>> + .reta_update = axgbe_dev_rss_reta_update,
>> + .reta_query = axgbe_dev_rss_reta_query,
>> + .rss_hash_update = axgbe_dev_rss_hash_update,
>> + .rss_hash_conf_get = axgbe_dev_rss_hash_conf_get,
>> .dev_infos_get = axgbe_dev_info_get,
>> .rx_queue_setup = axgbe_dev_rx_queue_setup,
>> .rx_queue_release = axgbe_dev_rx_queue_release,
>> @@ -450,6 +466,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
>> return 0;
>> }
>>
>> +static int
>> +axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_reta_entry64 *reta_conf,
>> + uint16_t reta_size)
>> +{
>> + struct axgbe_port *pdata = dev->data->dev_private;
>> + unsigned int i, idx, shift;
>> + int ret;
>> +
>> + if (!pdata->rss_enable) {
>> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
>> + return -ENOTSUP;
>> + }
>> +
>> + if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
>
> DPDK style guide [1] says to use comparison to 0 instead of !
>
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides%2Fcontributing%2Fcoding_style.html%23c-statement-style-and-conventions&data=02%7C01%7Cchandu%40amd.com%7C9eb51750daa24b1703cf08d7cfd96a2b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637206405006771688&sdata=LNbxA2nLRb3HaCoae%2B%2FBh1%2FK41ZJiC4tuLjiYOPYr2E%3D&reserved=0
>
>> + PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
>> + return -EINVAL;
>> + }
>> +
>> + for (i = 0; i < reta_size; i++) {
>> + idx = i / RTE_RETA_GROUP_SIZE;
>> + shift = i % RTE_RETA_GROUP_SIZE;
>> + if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
>> + continue;
>> + pdata->rss_table[i] = reta_conf[idx].reta[shift];
>> + }
>> +
>> + /* Program the lookup table */
>> + ret = axgbe_write_rss_lookup_table(pdata);
>> + return ret;
>> +}
>> +
>> +static int
>> +axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_reta_entry64 *reta_conf,
>> + uint16_t reta_size)
>> +{
>> + struct axgbe_port *pdata = dev->data->dev_private;
>> + unsigned int i, idx, shift;
>> +
>> + if (!pdata->rss_enable) {
>> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
>> + return -ENOTSUP;
>> + }
>> +
>> + if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
>
> Here too
>
>> + PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
>> + return -EINVAL;
>> + }
>> +
>> + for (i = 0; i < reta_size; i++) {
>> + idx = i / RTE_RETA_GROUP_SIZE;
>> + shift = i % RTE_RETA_GROUP_SIZE;
>> + if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
>> + continue;
>> + reta_conf[idx].reta[shift] = pdata->rss_table[i];
>> + }
>> + return 0;
>> +}
>> +
>> +static int
>> +axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf) {
>> + struct axgbe_port *pdata = dev->data->dev_private;
>> + int ret;
>> +
>> + if (!pdata->rss_enable) {
>> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
>> + return -ENOTSUP;
>> + }
>> +
>> + if (!rss_conf) {
>
> Here too. It should comparison vs NULL.
>
>> + PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
>> + return -EINVAL;
>> + }
>> +
>> + if (rss_conf->rss_key &&
>
> and here
>
>> + rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
>> + rte_memcpy(pdata->rss_key, rss_conf->rss_key,
>> + AXGBE_RSS_HASH_KEY_SIZE);
>> + /* Program the hash key */
>> + ret = axgbe_write_rss_hash_key(pdata);
>> + if (ret)
>
> and here
>
>> + return ret;
>> + }
>> +
>> + pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
>> +
>> + if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
>> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
>> + if (pdata->rss_hf &
>> + (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP))
>> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
>> + if (pdata->rss_hf &
>> + (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP))
>> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
>> +
>> + /* Set the RSS options */
>> + AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
>> +
>> + return 0;
>> +}
>> +
>> +static int
>> +axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf) {
>> + struct axgbe_port *pdata = dev->data->dev_private;
>> +
>> + if (!pdata->rss_enable) {
>> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
>> + return -ENOTSUP;
>> + }
>> +
>> + if (!rss_conf) {
>
> and here
>
>> + PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
>> + return -EINVAL;
>> + }
>> +
>> + if (rss_conf->rss_key &&
>
> and here
>
>> + rss_conf->rss_key_len <= AXGBE_RSS_HASH_KEY_SIZE) {
>> + rte_memcpy(rss_conf->rss_key, pdata->rss_key,
>> + AXGBE_RSS_HASH_KEY_SIZE);
>> + }
>> + rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
>> + rss_conf->rss_hf = pdata->rss_hf;
>> + return 0;
>> +}
>> +
>> static void
>> axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) {
>> diff --git a/drivers/net/axgbe/axgbe_ethdev.h
>> b/drivers/net/axgbe/axgbe_ethdev.h
>> index f10ec4a40..cedce5af6 100644
>> --- a/drivers/net/axgbe/axgbe_ethdev.h
>> +++ b/drivers/net/axgbe/axgbe_ethdev.h
>> @@ -594,6 +594,7 @@ struct axgbe_port {
>> uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE];
>> uint32_t rss_options;
>> int rss_enable;
>> + uint64_t rss_hf;
>>
>> /* Hardware features of the device */
>> struct axgbe_hw_features hw_feat;
>> @@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct
>> axgbe_i2c_if *i2c_if); void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
>> uint32_t index);
>> void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr,
>> bool add);
>> +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata); int
>> +axgbe_write_rss_hash_key(struct axgbe_port *pdata);
>>
>> #endif /* RTE_ETH_AXGBE_H_ */
>>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update
2020-03-24 10:24 ` Andrew Rybchenko
@ 2020-03-25 3:25 ` Namburu, Chandu-babu
0 siblings, 0 replies; 11+ messages in thread
From: Namburu, Chandu-babu @ 2020-03-25 3:25 UTC (permalink / raw)
To: Andrew Rybchenko, dev; +Cc: Kumar, Ravi1, Somalapuram, Amaranath
[AMD Public Use]
Thank you Andrew, will update these in v2 patch.
-----Original Message-----
From: Andrew Rybchenko <arybchenko@solarflare.com>
Sent: Tuesday, March 24, 2020 3:55 PM
To: Namburu, Chandu-babu <chandu@amd.com>; dev@dpdk.org
Cc: Kumar, Ravi1 <Ravi1.Kumar@amd.com>; Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>
Subject: Re: [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update
On 3/24/20 1:17 PM, Namburu, Chandu-babu wrote:
> [AMD Official Use Only - Internal Distribution Only]
>
> RSS functionality is already supported by AXGBE and it is updated in doc/guides/nics/features/axgbe.ini accordingly.
> This patch adds support to update RSS Hash key and RETA.
What about (see doc/guides/nics/features/default.ini)
RSS key update =
RSS reta update =
> Regards,
> Chandu
> -----Original Message-----
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> Sent: Tuesday, March 24, 2020 3:25 PM
> To: Namburu, Chandu-babu <chandu@amd.com>; dev@dpdk.org
> Cc: Kumar, Ravi1 <Ravi1.Kumar@amd.com>; Somalapuram, Amaranath
> <Amaranath.Somalapuram@amd.com>
> Subject: Re: [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query
> and update
>
> On 3/20/20 2:29 PM, chandu@amd.com wrote:
>> From: Chandu Babu N <chandu@amd.com>
>>
>> add support for RSS ethdev_ops reta_update, reta_query
>> rss_hash_update, rss_hash_conf_get
>
> The patch should update doc/guides/nics/features/axgbe.ini to advertise corresponding features.
>
>>
>> Signed-off-by: Chandu Babu N <chandu@amd.com>
>> ---
>> drivers/net/axgbe/axgbe_dev.c | 5 +-
>> drivers/net/axgbe/axgbe_ethdev.c | 146 +++++++++++++++++++++++++++++++
>> drivers/net/axgbe/axgbe_ethdev.h | 3 +
>> 3 files changed, 152 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/axgbe/axgbe_dev.c
>> b/drivers/net/axgbe/axgbe_dev.c index 5f0f19592..af62eae3b 100644
>> --- a/drivers/net/axgbe/axgbe_dev.c
>> +++ b/drivers/net/axgbe/axgbe_dev.c
>> @@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata, unsigned int type,
>> return -EBUSY;
>> }
>>
>> -static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
>> +int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
>> {
>> struct rte_eth_rss_conf *rss_conf;
>> unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32); @@
>> -638,7 +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
>> return 0;
>> }
>>
>> -static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
>> +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
>> {
>> unsigned int i;
>> int ret;
>> @@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata)
>> uint64_t rss_hf;
>>
>> rss_conf = &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
>> + pdata->rss_hf = rss_conf->rss_hf;
>> rss_hf = rss_conf->rss_hf;
>>
>> if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6)) diff --git
>> a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
>> index 867058845..f42bb7a0d 100644
>> --- a/drivers/net/axgbe/axgbe_ethdev.c
>> +++ b/drivers/net/axgbe/axgbe_ethdev.c
>> @@ -60,6 +60,18 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
>> const uint64_t *ids,
>> unsigned int size);
>> static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
>> +static int
>> +axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_reta_entry64 *reta_conf,
>> + uint16_t reta_size);
>> +static int
>> +axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_reta_entry64 *reta_conf,
>> + uint16_t reta_size);
>
> It looks like style is inconsistent for above to declarations vs declarations around.
>
>> +static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf); static int
>> +axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf);
>> static int axgbe_dev_info_get(struct rte_eth_dev *dev,
>> struct rte_eth_dev_info *dev_info); static int
>> axgbe_flow_ctrl_get(struct rte_eth_dev *dev, @@ -201,6 +213,10 @@
>> static const struct eth_dev_ops axgbe_eth_dev_ops = {
>> .xstats_get_names = axgbe_dev_xstats_get_names,
>> .xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
>> .xstats_get_by_id = axgbe_dev_xstats_get_by_id,
>> + .reta_update = axgbe_dev_rss_reta_update,
>> + .reta_query = axgbe_dev_rss_reta_query,
>> + .rss_hash_update = axgbe_dev_rss_hash_update,
>> + .rss_hash_conf_get = axgbe_dev_rss_hash_conf_get,
>> .dev_infos_get = axgbe_dev_info_get,
>> .rx_queue_setup = axgbe_dev_rx_queue_setup,
>> .rx_queue_release = axgbe_dev_rx_queue_release,
>> @@ -450,6 +466,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
>> return 0;
>> }
>>
>> +static int
>> +axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_reta_entry64 *reta_conf,
>> + uint16_t reta_size)
>> +{
>> + struct axgbe_port *pdata = dev->data->dev_private;
>> + unsigned int i, idx, shift;
>> + int ret;
>> +
>> + if (!pdata->rss_enable) {
>> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
>> + return -ENOTSUP;
>> + }
>> +
>> + if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
>
> DPDK style guide [1] says to use comparison to 0 instead of !
>
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.
> dpdk.org%2Fguides%2Fcontributing%2Fcoding_style.html%23c-statement-sty
> le-and-conventions&data=02%7C01%7Cchandu%40amd.com%7C91ae3be800694
> 09de13308d7cfdd91e0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C63720
> 6422857685216&sdata=kr9UNBwAGI3ns4YB%2B5gJ4YUOuv%2FP6G6LmSfNH%2BYH
> uv0%3D&reserved=0
>
>> + PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
>> + return -EINVAL;
>> + }
>> +
>> + for (i = 0; i < reta_size; i++) {
>> + idx = i / RTE_RETA_GROUP_SIZE;
>> + shift = i % RTE_RETA_GROUP_SIZE;
>> + if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
>> + continue;
>> + pdata->rss_table[i] = reta_conf[idx].reta[shift];
>> + }
>> +
>> + /* Program the lookup table */
>> + ret = axgbe_write_rss_lookup_table(pdata);
>> + return ret;
>> +}
>> +
>> +static int
>> +axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_reta_entry64 *reta_conf,
>> + uint16_t reta_size)
>> +{
>> + struct axgbe_port *pdata = dev->data->dev_private;
>> + unsigned int i, idx, shift;
>> +
>> + if (!pdata->rss_enable) {
>> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
>> + return -ENOTSUP;
>> + }
>> +
>> + if (!reta_size || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
>
> Here too
>
>> + PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
>> + return -EINVAL;
>> + }
>> +
>> + for (i = 0; i < reta_size; i++) {
>> + idx = i / RTE_RETA_GROUP_SIZE;
>> + shift = i % RTE_RETA_GROUP_SIZE;
>> + if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
>> + continue;
>> + reta_conf[idx].reta[shift] = pdata->rss_table[i];
>> + }
>> + return 0;
>> +}
>> +
>> +static int
>> +axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf) {
>> + struct axgbe_port *pdata = dev->data->dev_private;
>> + int ret;
>> +
>> + if (!pdata->rss_enable) {
>> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
>> + return -ENOTSUP;
>> + }
>> +
>> + if (!rss_conf) {
>
> Here too. It should comparison vs NULL.
>
>> + PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
>> + return -EINVAL;
>> + }
>> +
>> + if (rss_conf->rss_key &&
>
> and here
>
>> + rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
>> + rte_memcpy(pdata->rss_key, rss_conf->rss_key,
>> + AXGBE_RSS_HASH_KEY_SIZE);
>> + /* Program the hash key */
>> + ret = axgbe_write_rss_hash_key(pdata);
>> + if (ret)
>
> and here
>
>> + return ret;
>> + }
>> +
>> + pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
>> +
>> + if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
>> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
>> + if (pdata->rss_hf &
>> + (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP))
>> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
>> + if (pdata->rss_hf &
>> + (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP))
>> + AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
>> +
>> + /* Set the RSS options */
>> + AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
>> +
>> + return 0;
>> +}
>> +
>> +static int
>> +axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf) {
>> + struct axgbe_port *pdata = dev->data->dev_private;
>> +
>> + if (!pdata->rss_enable) {
>> + PMD_DRV_LOG(ERR, "RSS not enabled\n");
>> + return -ENOTSUP;
>> + }
>> +
>> + if (!rss_conf) {
>
> and here
>
>> + PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
>> + return -EINVAL;
>> + }
>> +
>> + if (rss_conf->rss_key &&
>
> and here
>
>> + rss_conf->rss_key_len <= AXGBE_RSS_HASH_KEY_SIZE) {
>> + rte_memcpy(rss_conf->rss_key, pdata->rss_key,
>> + AXGBE_RSS_HASH_KEY_SIZE);
>> + }
>> + rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
>> + rss_conf->rss_hf = pdata->rss_hf;
>> + return 0;
>> +}
>> +
>> static void
>> axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
>> { diff --git a/drivers/net/axgbe/axgbe_ethdev.h
>> b/drivers/net/axgbe/axgbe_ethdev.h
>> index f10ec4a40..cedce5af6 100644
>> --- a/drivers/net/axgbe/axgbe_ethdev.h
>> +++ b/drivers/net/axgbe/axgbe_ethdev.h
>> @@ -594,6 +594,7 @@ struct axgbe_port {
>> uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE];
>> uint32_t rss_options;
>> int rss_enable;
>> + uint64_t rss_hf;
>>
>> /* Hardware features of the device */
>> struct axgbe_hw_features hw_feat;
>> @@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct
>> axgbe_i2c_if *i2c_if); void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
>> uint32_t index);
>> void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr,
>> bool add);
>> +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata); int
>> +axgbe_write_rss_hash_key(struct axgbe_port *pdata);
>>
>> #endif /* RTE_ETH_AXGBE_H_ */
>>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2] net/axgbe: add RSS reta/hash query and update
2020-03-20 11:29 [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update chandu
2020-03-21 11:40 ` Kumar, Ravi1
2020-03-24 9:54 ` Andrew Rybchenko
@ 2020-05-29 11:49 ` chandu
2020-06-04 5:27 ` Somalapuram, Amaranath
2 siblings, 1 reply; 11+ messages in thread
From: chandu @ 2020-05-29 11:49 UTC (permalink / raw)
To: dev; +Cc: Amaranath.Somalapuram
From: Chandu Babu N <chandu@amd.com>
add support for RSS reta/hash query and update function
v2:
modification as per Andrew Rybchenko review comments
Signed-off-by: Chandu Babu N <chandu@amd.com>
---
doc/guides/nics/features/axgbe.ini | 2 +
drivers/net/axgbe/axgbe_dev.c | 5 +-
drivers/net/axgbe/axgbe_ethdev.c | 144 +++++++++++++++++++++++++++++
drivers/net/axgbe/axgbe_ethdev.h | 3 +
4 files changed, 152 insertions(+), 2 deletions(-)
diff --git a/doc/guides/nics/features/axgbe.ini b/doc/guides/nics/features/axgbe.ini
index 0becaa097..34df0d1ee 100644
--- a/doc/guides/nics/features/axgbe.ini
+++ b/doc/guides/nics/features/axgbe.ini
@@ -11,6 +11,8 @@ Scattered Rx = Y
Promiscuous mode = Y
Allmulticast mode = Y
RSS hash = Y
+RSS key update = Y
+RSS reta update = Y
CRC offload = Y
L3 checksum offload = Y
L4 checksum offload = Y
diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c
index 5f0f19592..af62eae3b 100644
--- a/drivers/net/axgbe/axgbe_dev.c
+++ b/drivers/net/axgbe/axgbe_dev.c
@@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata, unsigned int type,
return -EBUSY;
}
-static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
+int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
{
struct rte_eth_rss_conf *rss_conf;
unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32);
@@ -638,7 +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
return 0;
}
-static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
{
unsigned int i;
int ret;
@@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata)
uint64_t rss_hf;
rss_conf = &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
+ pdata->rss_hf = rss_conf->rss_hf;
rss_hf = rss_conf->rss_hf;
if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 867058845..619250fb0 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -60,6 +60,16 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
unsigned int size);
static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
+static int axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+static int axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf);
+static int axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf);
static int axgbe_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int axgbe_flow_ctrl_get(struct rte_eth_dev *dev,
@@ -201,6 +211,10 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
.xstats_get_names = axgbe_dev_xstats_get_names,
.xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
.xstats_get_by_id = axgbe_dev_xstats_get_by_id,
+ .reta_update = axgbe_dev_rss_reta_update,
+ .reta_query = axgbe_dev_rss_reta_query,
+ .rss_hash_update = axgbe_dev_rss_hash_update,
+ .rss_hash_conf_get = axgbe_dev_rss_hash_conf_get,
.dev_infos_get = axgbe_dev_info_get,
.rx_queue_setup = axgbe_dev_rx_queue_setup,
.rx_queue_release = axgbe_dev_rx_queue_release,
@@ -450,6 +464,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
return 0;
}
+static int
+axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int i, idx, shift;
+ int ret;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (reta_size == 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < reta_size; i++) {
+ idx = i / RTE_RETA_GROUP_SIZE;
+ shift = i % RTE_RETA_GROUP_SIZE;
+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+ continue;
+ pdata->rss_table[i] = reta_conf[idx].reta[shift];
+ }
+
+ /* Program the lookup table */
+ ret = axgbe_write_rss_lookup_table(pdata);
+ return ret;
+}
+
+static int
+axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int i, idx, shift;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (reta_size == 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < reta_size; i++) {
+ idx = i / RTE_RETA_GROUP_SIZE;
+ shift = i % RTE_RETA_GROUP_SIZE;
+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+ continue;
+ reta_conf[idx].reta[shift] = pdata->rss_table[i];
+ }
+ return 0;
+}
+
+static int
+axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ int ret;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (rss_conf == NULL) {
+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+ return -EINVAL;
+ }
+
+ if (rss_conf->rss_key != NULL &&
+ rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
+ rte_memcpy(pdata->rss_key, rss_conf->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+ /* Program the hash key */
+ ret = axgbe_write_rss_hash_key(pdata);
+ if (ret != 0)
+ return ret;
+ }
+
+ pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
+
+ if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
+ if (pdata->rss_hf &
+ (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
+ if (pdata->rss_hf &
+ (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
+
+ /* Set the RSS options */
+ AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
+
+ return 0;
+}
+
+static int
+axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (rss_conf == NULL) {
+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+ return -EINVAL;
+ }
+
+ if (rss_conf->rss_key != NULL &&
+ rss_conf->rss_key_len >= AXGBE_RSS_HASH_KEY_SIZE) {
+ rte_memcpy(rss_conf->rss_key, pdata->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+ }
+ rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
+ rss_conf->rss_hf = pdata->rss_hf;
+ return 0;
+}
+
static void
axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
{
diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h
index f10ec4a40..cedce5af6 100644
--- a/drivers/net/axgbe/axgbe_ethdev.h
+++ b/drivers/net/axgbe/axgbe_ethdev.h
@@ -594,6 +594,7 @@ struct axgbe_port {
uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE];
uint32_t rss_options;
int rss_enable;
+ uint64_t rss_hf;
/* Hardware features of the device */
struct axgbe_hw_features hw_feat;
@@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct axgbe_i2c_if *i2c_if);
void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
uint32_t index);
void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr, bool add);
+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata);
+int axgbe_write_rss_hash_key(struct axgbe_port *pdata);
#endif /* RTE_ETH_AXGBE_H_ */
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/axgbe: add RSS reta/hash query and update
2020-05-29 11:49 ` [dpdk-dev] [PATCH v2] " chandu
@ 2020-06-04 5:27 ` Somalapuram, Amaranath
2020-06-04 12:06 ` Ferruh Yigit
2020-06-05 14:49 ` Ferruh Yigit
0 siblings, 2 replies; 11+ messages in thread
From: Somalapuram, Amaranath @ 2020-06-04 5:27 UTC (permalink / raw)
To: Namburu, Chandu-babu, dev
[AMD Official Use Only - Internal Distribution Only]
For series,
Acked-by: Somalapuram Amaranath <asomalap@amd.com>
-----Original Message-----
From: Namburu, Chandu-babu <chandu@amd.com>
Sent: Friday, May 29, 2020 5:19 PM
To: dev@dpdk.org
Cc: Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>
Subject: [PATCH v2] net/axgbe: add RSS reta/hash query and update
From: Chandu Babu N <chandu@amd.com>
add support for RSS reta/hash query and update function
v2:
modification as per Andrew Rybchenko review comments
Signed-off-by: Chandu Babu N <chandu@amd.com>
---
doc/guides/nics/features/axgbe.ini | 2 +
drivers/net/axgbe/axgbe_dev.c | 5 +-
drivers/net/axgbe/axgbe_ethdev.c | 144 +++++++++++++++++++++++++++++
drivers/net/axgbe/axgbe_ethdev.h | 3 +
4 files changed, 152 insertions(+), 2 deletions(-)
diff --git a/doc/guides/nics/features/axgbe.ini b/doc/guides/nics/features/axgbe.ini
index 0becaa097..34df0d1ee 100644
--- a/doc/guides/nics/features/axgbe.ini
+++ b/doc/guides/nics/features/axgbe.ini
@@ -11,6 +11,8 @@ Scattered Rx = Y
Promiscuous mode = Y
Allmulticast mode = Y
RSS hash = Y
+RSS key update = Y
+RSS reta update = Y
CRC offload = Y
L3 checksum offload = Y
L4 checksum offload = Y
diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c index 5f0f19592..af62eae3b 100644
--- a/drivers/net/axgbe/axgbe_dev.c
+++ b/drivers/net/axgbe/axgbe_dev.c
@@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata, unsigned int type,
return -EBUSY;
}
-static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
+int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
{
struct rte_eth_rss_conf *rss_conf;
unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32); @@ -638,7 +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
return 0;
}
-static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
{
unsigned int i;
int ret;
@@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata)
uint64_t rss_hf;
rss_conf = &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
+pdata->rss_hf = rss_conf->rss_hf;
rss_hf = rss_conf->rss_hf;
if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6)) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 867058845..619250fb0 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -60,6 +60,16 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
unsigned int size);
static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
+static int axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+static int axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf); static int
+axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf);
static int axgbe_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info); static int axgbe_flow_ctrl_get(struct rte_eth_dev *dev, @@ -201,6 +211,10 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
.xstats_get_names = axgbe_dev_xstats_get_names,
.xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
.xstats_get_by_id = axgbe_dev_xstats_get_by_id,
+.reta_update = axgbe_dev_rss_reta_update,
+.reta_query = axgbe_dev_rss_reta_query,
+.rss_hash_update = axgbe_dev_rss_hash_update,
+.rss_hash_conf_get = axgbe_dev_rss_hash_conf_get,
.dev_infos_get = axgbe_dev_info_get,
.rx_queue_setup = axgbe_dev_rx_queue_setup,
.rx_queue_release = axgbe_dev_rx_queue_release,
@@ -450,6 +464,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
return 0;
}
+static int
+axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+struct axgbe_port *pdata = dev->data->dev_private;
+unsigned int i, idx, shift;
+int ret;
+
+if (!pdata->rss_enable) {
+PMD_DRV_LOG(ERR, "RSS not enabled\n");
+return -ENOTSUP;
+}
+
+if (reta_size == 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+return -EINVAL;
+}
+
+for (i = 0; i < reta_size; i++) {
+idx = i / RTE_RETA_GROUP_SIZE;
+shift = i % RTE_RETA_GROUP_SIZE;
+if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+continue;
+pdata->rss_table[i] = reta_conf[idx].reta[shift];
+}
+
+/* Program the lookup table */
+ret = axgbe_write_rss_lookup_table(pdata);
+return ret;
+}
+
+static int
+axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+struct axgbe_port *pdata = dev->data->dev_private;
+unsigned int i, idx, shift;
+
+if (!pdata->rss_enable) {
+PMD_DRV_LOG(ERR, "RSS not enabled\n");
+return -ENOTSUP;
+}
+
+if (reta_size == 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+return -EINVAL;
+}
+
+for (i = 0; i < reta_size; i++) {
+idx = i / RTE_RETA_GROUP_SIZE;
+shift = i % RTE_RETA_GROUP_SIZE;
+if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+continue;
+reta_conf[idx].reta[shift] = pdata->rss_table[i];
+}
+return 0;
+}
+
+static int
+axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf) {
+struct axgbe_port *pdata = dev->data->dev_private;
+int ret;
+
+if (!pdata->rss_enable) {
+PMD_DRV_LOG(ERR, "RSS not enabled\n");
+return -ENOTSUP;
+}
+
+if (rss_conf == NULL) {
+PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+return -EINVAL;
+}
+
+if (rss_conf->rss_key != NULL &&
+ rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
+rte_memcpy(pdata->rss_key, rss_conf->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+/* Program the hash key */
+ret = axgbe_write_rss_hash_key(pdata);
+if (ret != 0)
+return ret;
+}
+
+pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
+
+if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
+AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
+if (pdata->rss_hf &
+ (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP))
+AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
+if (pdata->rss_hf &
+ (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP))
+AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
+
+/* Set the RSS options */
+AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
+
+return 0;
+}
+
+static int
+axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf) {
+struct axgbe_port *pdata = dev->data->dev_private;
+
+if (!pdata->rss_enable) {
+PMD_DRV_LOG(ERR, "RSS not enabled\n");
+return -ENOTSUP;
+}
+
+if (rss_conf == NULL) {
+PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+return -EINVAL;
+}
+
+if (rss_conf->rss_key != NULL &&
+ rss_conf->rss_key_len >= AXGBE_RSS_HASH_KEY_SIZE) {
+rte_memcpy(rss_conf->rss_key, pdata->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+}
+rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
+rss_conf->rss_hf = pdata->rss_hf;
+return 0;
+}
+
static void
axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h
index f10ec4a40..cedce5af6 100644
--- a/drivers/net/axgbe/axgbe_ethdev.h
+++ b/drivers/net/axgbe/axgbe_ethdev.h
@@ -594,6 +594,7 @@ struct axgbe_port {
uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE];
uint32_t rss_options;
int rss_enable;
+uint64_t rss_hf;
/* Hardware features of the device */
struct axgbe_hw_features hw_feat;
@@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct axgbe_i2c_if *i2c_if); void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
uint32_t index);
void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr, bool add);
+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata); int
+axgbe_write_rss_hash_key(struct axgbe_port *pdata);
#endif /* RTE_ETH_AXGBE_H_ */
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/axgbe: add RSS reta/hash query and update
2020-06-04 5:27 ` Somalapuram, Amaranath
@ 2020-06-04 12:06 ` Ferruh Yigit
2020-06-05 14:49 ` Ferruh Yigit
1 sibling, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2020-06-04 12:06 UTC (permalink / raw)
To: Somalapuram, Amaranath, Namburu, Chandu-babu, dev
On 6/4/2020 6:27 AM, Somalapuram, Amaranath wrote:
> [AMD Official Use Only - Internal Distribution Only]
Is there a way to remove above header, public email list is definitely not
internal distribution.
>
> For series,
> Acked-by: Somalapuram Amaranath <asomalap@amd.com>
>
<...>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/axgbe: add RSS reta/hash query and update
2020-06-04 5:27 ` Somalapuram, Amaranath
2020-06-04 12:06 ` Ferruh Yigit
@ 2020-06-05 14:49 ` Ferruh Yigit
1 sibling, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2020-06-05 14:49 UTC (permalink / raw)
To: Somalapuram, Amaranath, Namburu, Chandu-babu, dev
On 6/4/2020 6:27 AM, Somalapuram, Amaranath wrote:
<...>
> -----Original Message-----
> From: Namburu, Chandu-babu <chandu@amd.com>
> Sent: Friday, May 29, 2020 5:19 PM
> To: dev@dpdk.org
> Cc: Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>
> Subject: [PATCH v2] net/axgbe: add RSS reta/hash query and update
>
> From: Chandu Babu N <chandu@amd.com>
>
> add support for RSS reta/hash query and update function
>
> v2:
> modification as per Andrew Rybchenko review comments
>
> Signed-off-by: Chandu Babu N <chandu@amd.com>
Acked-by: Amaranath Somalapuram <asomalap@amd.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2] net/axgbe: add RSS reta/hash query and update
@ 2020-05-29 11:34 chandu
0 siblings, 0 replies; 11+ messages in thread
From: chandu @ 2020-05-29 11:34 UTC (permalink / raw)
To: dev; +Cc: Amaranath.Somalapuram
From: Chandu Babu N <chandu@amd.com>
add support for RSS reta/hash query and update function
v2:
modification as per Andrew Rybchenko review comments
Signed-off-by: Chandu Babu N <chandu@amd.com>
---
doc/guides/nics/features/axgbe.ini | 2 +
drivers/net/axgbe/axgbe_dev.c | 5 +-
drivers/net/axgbe/axgbe_ethdev.c | 144 +++++++++++++++++++++++++++++
drivers/net/axgbe/axgbe_ethdev.h | 3 +
4 files changed, 152 insertions(+), 2 deletions(-)
diff --git a/doc/guides/nics/features/axgbe.ini b/doc/guides/nics/features/axgbe.ini
index 0becaa097..34df0d1ee 100644
--- a/doc/guides/nics/features/axgbe.ini
+++ b/doc/guides/nics/features/axgbe.ini
@@ -11,6 +11,8 @@ Scattered Rx = Y
Promiscuous mode = Y
Allmulticast mode = Y
RSS hash = Y
+RSS key update = Y
+RSS reta update = Y
CRC offload = Y
L3 checksum offload = Y
L4 checksum offload = Y
diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c
index 5f0f19592..af62eae3b 100644
--- a/drivers/net/axgbe/axgbe_dev.c
+++ b/drivers/net/axgbe/axgbe_dev.c
@@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata, unsigned int type,
return -EBUSY;
}
-static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
+int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
{
struct rte_eth_rss_conf *rss_conf;
unsigned int key_regs = sizeof(pdata->rss_key) / sizeof(u32);
@@ -638,7 +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata)
return 0;
}
-static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata)
{
unsigned int i;
int ret;
@@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata)
uint64_t rss_hf;
rss_conf = &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf;
+ pdata->rss_hf = rss_conf->rss_hf;
rss_hf = rss_conf->rss_hf;
if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 867058845..619250fb0 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -60,6 +60,16 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
unsigned int size);
static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
+static int axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+static int axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf);
+static int axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf);
static int axgbe_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int axgbe_flow_ctrl_get(struct rte_eth_dev *dev,
@@ -201,6 +211,10 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
.xstats_get_names = axgbe_dev_xstats_get_names,
.xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
.xstats_get_by_id = axgbe_dev_xstats_get_by_id,
+ .reta_update = axgbe_dev_rss_reta_update,
+ .reta_query = axgbe_dev_rss_reta_query,
+ .rss_hash_update = axgbe_dev_rss_hash_update,
+ .rss_hash_conf_get = axgbe_dev_rss_hash_conf_get,
.dev_infos_get = axgbe_dev_info_get,
.rx_queue_setup = axgbe_dev_rx_queue_setup,
.rx_queue_release = axgbe_dev_rx_queue_release,
@@ -450,6 +464,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
return 0;
}
+static int
+axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int i, idx, shift;
+ int ret;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (reta_size == 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < reta_size; i++) {
+ idx = i / RTE_RETA_GROUP_SIZE;
+ shift = i % RTE_RETA_GROUP_SIZE;
+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+ continue;
+ pdata->rss_table[i] = reta_conf[idx].reta[shift];
+ }
+
+ /* Program the lookup table */
+ ret = axgbe_write_rss_lookup_table(pdata);
+ return ret;
+}
+
+static int
+axgbe_dev_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ unsigned int i, idx, shift;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (reta_size == 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) {
+ PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < reta_size; i++) {
+ idx = i / RTE_RETA_GROUP_SIZE;
+ shift = i % RTE_RETA_GROUP_SIZE;
+ if ((reta_conf[idx].mask & (1ULL << shift)) == 0)
+ continue;
+ reta_conf[idx].reta[shift] = pdata->rss_table[i];
+ }
+ return 0;
+}
+
+static int
+axgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+ int ret;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (rss_conf == NULL) {
+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+ return -EINVAL;
+ }
+
+ if (rss_conf->rss_key != NULL &&
+ rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) {
+ rte_memcpy(pdata->rss_key, rss_conf->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+ /* Program the hash key */
+ ret = axgbe_write_rss_hash_key(pdata);
+ if (ret != 0)
+ return ret;
+ }
+
+ pdata->rss_hf = rss_conf->rss_hf & AXGBE_RSS_OFFLOAD;
+
+ if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
+ if (pdata->rss_hf &
+ (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
+ if (pdata->rss_hf &
+ (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP))
+ AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
+
+ /* Set the RSS options */
+ AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options);
+
+ return 0;
+}
+
+static int
+axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct axgbe_port *pdata = dev->data->dev_private;
+
+ if (!pdata->rss_enable) {
+ PMD_DRV_LOG(ERR, "RSS not enabled\n");
+ return -ENOTSUP;
+ }
+
+ if (rss_conf == NULL) {
+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n");
+ return -EINVAL;
+ }
+
+ if (rss_conf->rss_key != NULL &&
+ rss_conf->rss_key_len >= AXGBE_RSS_HASH_KEY_SIZE) {
+ rte_memcpy(rss_conf->rss_key, pdata->rss_key,
+ AXGBE_RSS_HASH_KEY_SIZE);
+ }
+ rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE;
+ rss_conf->rss_hf = pdata->rss_hf;
+ return 0;
+}
+
static void
axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
{
diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h
index f10ec4a40..cedce5af6 100644
--- a/drivers/net/axgbe/axgbe_ethdev.h
+++ b/drivers/net/axgbe/axgbe_ethdev.h
@@ -594,6 +594,7 @@ struct axgbe_port {
uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE];
uint32_t rss_options;
int rss_enable;
+ uint64_t rss_hf;
/* Hardware features of the device */
struct axgbe_hw_features hw_feat;
@@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct axgbe_i2c_if *i2c_if);
void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr,
uint32_t index);
void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr, bool add);
+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata);
+int axgbe_write_rss_hash_key(struct axgbe_port *pdata);
#endif /* RTE_ETH_AXGBE_H_ */
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-06-05 14:50 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 11:29 [dpdk-dev] [PATCH v1] net/axgbe: add RSS reta/hash query and update chandu
2020-03-21 11:40 ` Kumar, Ravi1
2020-03-24 9:54 ` Andrew Rybchenko
2020-03-24 10:17 ` Namburu, Chandu-babu
2020-03-24 10:24 ` Andrew Rybchenko
2020-03-25 3:25 ` Namburu, Chandu-babu
2020-05-29 11:49 ` [dpdk-dev] [PATCH v2] " chandu
2020-06-04 5:27 ` Somalapuram, Amaranath
2020-06-04 12:06 ` Ferruh Yigit
2020-06-05 14:49 ` Ferruh Yigit
2020-05-29 11:34 chandu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).