* [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and firmware version
@ 2021-09-27 18:01 Rahul Lakkireddy
2021-09-27 18:01 ` [dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Rahul Lakkireddy @ 2021-09-27 18:01 UTC (permalink / raw)
To: dev; +Cc: nikhil.vasoya
This series of patches add following features.
Patch 1 adds support to fetch port and queue stats via xstats API
for VF.
Patch 2 adds support to get firmware version.
Thanks,
Rahul
Nikhil Vasoya (2):
net/cxgbe: add support for xstats API for the VF
net/cxgbe: add support to get firmware version
drivers/net/cxgbe/cxgbe_ethdev.c | 94 ++++++++++++++++++++++++------
drivers/net/cxgbe/cxgbe_pfvf.h | 13 +++++
drivers/net/cxgbe/cxgbevf_ethdev.c | 21 +++----
3 files changed, 96 insertions(+), 32 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API for the VF
2021-09-27 18:01 [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and firmware version Rahul Lakkireddy
@ 2021-09-27 18:01 ` Rahul Lakkireddy
2021-09-30 16:09 ` Ferruh Yigit
2021-09-27 18:01 ` [dpdk-dev] [PATCH 2/2] net/cxgbe: add support to get firmware version Rahul Lakkireddy
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Rahul Lakkireddy @ 2021-09-27 18:01 UTC (permalink / raw)
To: dev; +Cc: nikhil.vasoya
From: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Add support to fetch port and queue stats via xstats API. Also remove
queue stats from basic stats because they're now available via xstats
API for the VF.
Signed-off-by: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
drivers/net/cxgbe/cxgbe_ethdev.c | 68 +++++++++++++++++++++---------
drivers/net/cxgbe/cxgbe_pfvf.h | 11 +++++
drivers/net/cxgbe/cxgbevf_ethdev.c | 20 +++------
3 files changed, 67 insertions(+), 32 deletions(-)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 177eca3976..a6b5c0110a 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -881,15 +881,37 @@ static const struct cxgbe_dev_xstats_name_off cxgbe_dev_port_stats_strings[] = {
{"rx_bg3_truncated_packets", offsetof(struct port_stats, rx_trunc3)},
};
+static const struct cxgbe_dev_xstats_name_off
+cxgbevf_dev_port_stats_strings[] = {
+ {"tx_bytes", offsetof(struct port_stats, tx_octets)},
+ {"tx_broadcast_packets", offsetof(struct port_stats, tx_bcast_frames)},
+ {"tx_multicast_packets", offsetof(struct port_stats, tx_mcast_frames)},
+ {"tx_unicast_packets", offsetof(struct port_stats, tx_ucast_frames)},
+ {"tx_drop_packets", offsetof(struct port_stats, tx_drop)},
+ {"rx_broadcast_packets", offsetof(struct port_stats, rx_bcast_frames)},
+ {"rx_multicast_packets", offsetof(struct port_stats, rx_mcast_frames)},
+ {"rx_unicast_packets", offsetof(struct port_stats, rx_ucast_frames)},
+ {"rx_length_error_packets", offsetof(struct port_stats, rx_len_err)},
+};
+
#define CXGBE_NB_RXQ_STATS RTE_DIM(cxgbe_dev_rxq_stats_strings)
#define CXGBE_NB_TXQ_STATS RTE_DIM(cxgbe_dev_txq_stats_strings)
#define CXGBE_NB_PORT_STATS RTE_DIM(cxgbe_dev_port_stats_strings)
+#define CXGBEVF_NB_PORT_STATS RTE_DIM(cxgbevf_dev_port_stats_strings)
static u16 cxgbe_dev_xstats_count(struct port_info *pi)
{
- return CXGBE_NB_PORT_STATS +
- (pi->n_tx_qsets * CXGBE_NB_TXQ_STATS) +
- (pi->n_rx_qsets * CXGBE_NB_RXQ_STATS);
+ u16 count;
+
+ count = (pi->n_tx_qsets * CXGBE_NB_TXQ_STATS) +
+ (pi->n_rx_qsets * CXGBE_NB_RXQ_STATS);
+
+ if (is_pf4(pi->adapter) != 0)
+ count += CXGBE_NB_PORT_STATS;
+ else
+ count += CXGBEVF_NB_PORT_STATS;
+
+ return count;
}
static int cxgbe_dev_xstats(struct rte_eth_dev *dev,
@@ -900,20 +922,28 @@ static int cxgbe_dev_xstats(struct rte_eth_dev *dev,
struct port_info *pi = dev->data->dev_private;
struct adapter *adap = pi->adapter;
struct sge *s = &adap->sge;
+ u16 count, i, qid, nstats;
struct port_stats ps;
- u16 count, i, qid;
u64 *stats_ptr;
count = cxgbe_dev_xstats_count(pi);
if (size < count)
return count;
- /* port stats */
- cxgbe_stats_get(pi, &ps);
+ if (is_pf4(adap) != 0) {
+ /* port stats for PF*/
+ cxgbe_stats_get(pi, &ps);
+ xstats_str = cxgbe_dev_port_stats_strings;
+ nstats = CXGBE_NB_PORT_STATS;
+ } else {
+ /* port stats for VF*/
+ cxgbevf_stats_get(pi, &ps);
+ xstats_str = cxgbevf_dev_port_stats_strings;
+ nstats = CXGBEVF_NB_PORT_STATS;
+ }
count = 0;
- xstats_str = cxgbe_dev_port_stats_strings;
- for (i = 0; i < CXGBE_NB_PORT_STATS; i++, count++) {
+ for (i = 0; i < nstats; i++, count++) {
if (xstats_names != NULL)
snprintf(xstats_names[count].name,
sizeof(xstats_names[count].name),
@@ -970,9 +1000,9 @@ static int cxgbe_dev_xstats(struct rte_eth_dev *dev,
}
/* Get port extended statistics by ID. */
-static int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
- const uint64_t *ids, uint64_t *values,
- unsigned int n)
+int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
+ const uint64_t *ids, uint64_t *values,
+ unsigned int n)
{
struct port_info *pi = dev->data->dev_private;
struct rte_eth_xstat *xstats_copy;
@@ -1005,9 +1035,9 @@ static int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
}
/* Get names of port extended statistics by ID. */
-static int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xnames,
- const uint64_t *ids, unsigned int n)
+int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xnames,
+ const uint64_t *ids, unsigned int n)
{
struct port_info *pi = dev->data->dev_private;
struct rte_eth_xstat_name *xnames_copy;
@@ -1041,16 +1071,16 @@ static int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
}
/* Get port extended statistics. */
-static int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
- struct rte_eth_xstat *xstats, unsigned int n)
+int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
+ struct rte_eth_xstat *xstats, unsigned int n)
{
return cxgbe_dev_xstats(dev, NULL, xstats, n);
}
/* Get names of port extended statistics. */
-static int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int n)
+int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int n)
{
return cxgbe_dev_xstats(dev, xstats_names, NULL, n);
}
diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h
index 801d6995d1..3c7aee0ae7 100644
--- a/drivers/net/cxgbe/cxgbe_pfvf.h
+++ b/drivers/net/cxgbe/cxgbe_pfvf.h
@@ -52,4 +52,15 @@ uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
const uint32_t *cxgbe_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev);
+int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
+ const uint64_t *ids, uint64_t *values,
+ unsigned int n);
+int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xnames,
+ const uint64_t *ids, unsigned int n);
+int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int n);
+int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
+ struct rte_eth_xstat *xstats, unsigned int n);
#endif /* _CXGBE_PFVF_H_ */
diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c
index bf1815c25f..4c809991b7 100644
--- a/drivers/net/cxgbe/cxgbevf_ethdev.c
+++ b/drivers/net/cxgbe/cxgbevf_ethdev.c
@@ -54,22 +54,12 @@ static int cxgbevf_dev_stats_get(struct rte_eth_dev *eth_dev,
eth_stats->oerrors = ps.tx_drop;
for (i = 0; i < pi->n_rx_qsets; i++) {
- struct sge_eth_rxq *rxq =
- &s->ethrxq[pi->first_rxqset + i];
+ struct sge_eth_rxq *rxq = &s->ethrxq[pi->first_rxqset + i];
- eth_stats->q_ipackets[i] = rxq->stats.pkts;
- eth_stats->q_ibytes[i] = rxq->stats.rx_bytes;
- eth_stats->ipackets += eth_stats->q_ipackets[i];
- eth_stats->ibytes += eth_stats->q_ibytes[i];
+ eth_stats->ipackets += rxq->stats.pkts;
+ eth_stats->ibytes += rxq->stats.rx_bytes;
}
- for (i = 0; i < pi->n_tx_qsets; i++) {
- struct sge_eth_txq *txq =
- &s->ethtxq[pi->first_txqset + i];
-
- eth_stats->q_opackets[i] = txq->stats.pkts;
- eth_stats->q_obytes[i] = txq->stats.tx_bytes;
- }
return 0;
}
@@ -97,6 +87,10 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = {
.rx_queue_stop = cxgbe_dev_rx_queue_stop,
.rx_queue_release = cxgbe_dev_rx_queue_release,
.stats_get = cxgbevf_dev_stats_get,
+ .xstats_get = cxgbe_dev_xstats_get,
+ .xstats_get_by_id = cxgbe_dev_xstats_get_by_id,
+ .xstats_get_names = cxgbe_dev_xstats_get_names,
+ .xstats_get_names_by_id = cxgbe_dev_xstats_get_names_by_id,
.mac_addr_set = cxgbe_mac_addr_set,
};
--
2.27.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH 2/2] net/cxgbe: add support to get firmware version
2021-09-27 18:01 [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and firmware version Rahul Lakkireddy
2021-09-27 18:01 ` [dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
@ 2021-09-27 18:01 ` Rahul Lakkireddy
2021-09-30 16:12 ` Ferruh Yigit
2021-09-30 16:23 ` [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and " Ferruh Yigit
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add " Rahul Lakkireddy
3 siblings, 1 reply; 10+ messages in thread
From: Rahul Lakkireddy @ 2021-09-27 18:01 UTC (permalink / raw)
To: dev; +Cc: nikhil.vasoya
From: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Implement eth_dev_ops callback to get firmware version.
Signed-off-by: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
drivers/net/cxgbe/cxgbe_ethdev.c | 26 ++++++++++++++++++++++++++
drivers/net/cxgbe/cxgbe_pfvf.h | 2 ++
drivers/net/cxgbe/cxgbevf_ethdev.c | 1 +
3 files changed, 29 insertions(+)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index a6b5c0110a..304fafed25 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1620,6 +1620,31 @@ static int cxgbe_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa)
return ret;
}
+int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+ size_t fw_size)
+{
+ struct port_info *pi = dev->data->dev_private;
+ struct adapter *adapter = pi->adapter;
+ int ret;
+
+ if (adapter->params.fw_vers == 0)
+ return -EIO;
+
+ ret = snprintf(fw_version, fw_size, "%u.%u.%u.%u",
+ G_FW_HDR_FW_VER_MAJOR(adapter->params.fw_vers),
+ G_FW_HDR_FW_VER_MINOR(adapter->params.fw_vers),
+ G_FW_HDR_FW_VER_MICRO(adapter->params.fw_vers),
+ G_FW_HDR_FW_VER_BUILD(adapter->params.fw_vers));
+ if (ret < 0)
+ return -EINVAL;
+
+ ret += 1;
+ if (fw_size < (size_t)ret)
+ return ret;
+
+ return 0;
+}
+
static const struct eth_dev_ops cxgbe_eth_dev_ops = {
.dev_start = cxgbe_dev_start,
.dev_stop = cxgbe_dev_stop,
@@ -1665,6 +1690,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = {
.fec_get_capability = cxgbe_fec_get_capability,
.fec_get = cxgbe_fec_get,
.fec_set = cxgbe_fec_set,
+ .fw_version_get = cxgbe_fw_version_get,
};
/*
diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h
index 3c7aee0ae7..81d0fce2e5 100644
--- a/drivers/net/cxgbe/cxgbe_pfvf.h
+++ b/drivers/net/cxgbe/cxgbe_pfvf.h
@@ -63,4 +63,6 @@ int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
unsigned int n);
int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned int n);
+int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+ size_t fw_size);
#endif /* _CXGBE_PFVF_H_ */
diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c
index 4c809991b7..a62c56c2b9 100644
--- a/drivers/net/cxgbe/cxgbevf_ethdev.c
+++ b/drivers/net/cxgbe/cxgbevf_ethdev.c
@@ -92,6 +92,7 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = {
.xstats_get_names = cxgbe_dev_xstats_get_names,
.xstats_get_names_by_id = cxgbe_dev_xstats_get_names_by_id,
.mac_addr_set = cxgbe_mac_addr_set,
+ .fw_version_get = cxgbe_fw_version_get,
};
/*
--
2.27.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API for the VF
2021-09-27 18:01 ` [dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
@ 2021-09-30 16:09 ` Ferruh Yigit
0 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2021-09-30 16:09 UTC (permalink / raw)
To: Rahul Lakkireddy, dev; +Cc: nikhil.vasoya
On 9/27/2021 7:01 PM, Rahul Lakkireddy wrote:
> From: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
>
> Add support to fetch port and queue stats via xstats API. Also remove
> queue stats from basic stats because they're now available via xstats
> API for the VF.
>
> Signed-off-by: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> ---
> drivers/net/cxgbe/cxgbe_ethdev.c | 68 +++++++++++++++++++++---------
> drivers/net/cxgbe/cxgbe_pfvf.h | 11 +++++
> drivers/net/cxgbe/cxgbevf_ethdev.c | 20 +++------
Can you please update the .ini file (doc/guides/nics/features/cxgbevf.ini) and
announce "Extended stats" feature?
btw, PF (doc/guides/nics/features/cxgbe.ini) also seems missing "Extended stats"
feature.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] net/cxgbe: add support to get firmware version
2021-09-27 18:01 ` [dpdk-dev] [PATCH 2/2] net/cxgbe: add support to get firmware version Rahul Lakkireddy
@ 2021-09-30 16:12 ` Ferruh Yigit
0 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2021-09-30 16:12 UTC (permalink / raw)
To: Rahul Lakkireddy, dev; +Cc: nikhil.vasoya
On 9/27/2021 7:01 PM, Rahul Lakkireddy wrote:
> From: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
>
> Implement eth_dev_ops callback to get firmware version.
>
> Signed-off-by: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> ---
> drivers/net/cxgbe/cxgbe_ethdev.c | 26 ++++++++++++++++++++++++++
> drivers/net/cxgbe/cxgbe_pfvf.h | 2 ++
> drivers/net/cxgbe/cxgbevf_ethdev.c | 1 +
Similarly can you please announce "FW version" feature in .ini files?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and firmware version
2021-09-27 18:01 [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and firmware version Rahul Lakkireddy
2021-09-27 18:01 ` [dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
2021-09-27 18:01 ` [dpdk-dev] [PATCH 2/2] net/cxgbe: add support to get firmware version Rahul Lakkireddy
@ 2021-09-30 16:23 ` Ferruh Yigit
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add " Rahul Lakkireddy
3 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2021-09-30 16:23 UTC (permalink / raw)
To: Rahul Lakkireddy, dev; +Cc: nikhil.vasoya
On 9/27/2021 7:01 PM, Rahul Lakkireddy wrote:
> This series of patches add following features.
>
> Patch 1 adds support to fetch port and queue stats via xstats API
> for VF.
>
> Patch 2 adds support to get firmware version.
>
> Thanks,
> Rahul
>
> Nikhil Vasoya (2):
> net/cxgbe: add support for xstats API for the VF
> net/cxgbe: add support to get firmware version
>
Looks good except missing updates in .ini file, can you please send a new
version with it?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add VF xstats and firmware version
2021-09-27 18:01 [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and firmware version Rahul Lakkireddy
` (2 preceding siblings ...)
2021-09-30 16:23 ` [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and " Ferruh Yigit
@ 2021-09-30 17:09 ` Rahul Lakkireddy
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
` (2 more replies)
3 siblings, 3 replies; 10+ messages in thread
From: Rahul Lakkireddy @ 2021-09-30 17:09 UTC (permalink / raw)
To: dev; +Cc: nikhil.vasoya
This series of patches add following features.
Patch 1 adds support to fetch port and queue stats via xstats API
for VF.
Patch 2 adds support to get firmware version.
Thanks,
Rahul
---
v2:
- Update Extended Stats and FW version features in cxgbe.ini and
cxgbevf.ini
Nikhil Vasoya (2):
net/cxgbe: add support for xstats API for the VF
net/cxgbe: add support to get firmware version
doc/guides/nics/features/cxgbe.ini | 2 +
doc/guides/nics/features/cxgbevf.ini | 2 +
drivers/net/cxgbe/cxgbe_ethdev.c | 94 ++++++++++++++++++++++------
drivers/net/cxgbe/cxgbe_pfvf.h | 13 ++++
drivers/net/cxgbe/cxgbevf_ethdev.c | 21 +++----
5 files changed, 100 insertions(+), 32 deletions(-)
--
2.27.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] net/cxgbe: add support for xstats API for the VF
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add " Rahul Lakkireddy
@ 2021-09-30 17:09 ` Rahul Lakkireddy
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 2/2] net/cxgbe: add support to get firmware version Rahul Lakkireddy
2021-10-05 17:35 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add VF xstats and " Ferruh Yigit
2 siblings, 0 replies; 10+ messages in thread
From: Rahul Lakkireddy @ 2021-09-30 17:09 UTC (permalink / raw)
To: dev; +Cc: nikhil.vasoya
From: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Add support to fetch port and queue stats via xstats API. Also remove
queue stats from basic stats because they're now available via xstats
API for the VF.
Signed-off-by: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
v2:
- Update Extended Stats feature in cxgbe.ini and cxgbevf.ini
doc/guides/nics/features/cxgbe.ini | 1 +
doc/guides/nics/features/cxgbevf.ini | 1 +
drivers/net/cxgbe/cxgbe_ethdev.c | 68 ++++++++++++++++++++--------
drivers/net/cxgbe/cxgbe_pfvf.h | 11 +++++
drivers/net/cxgbe/cxgbevf_ethdev.c | 20 +++-----
5 files changed, 69 insertions(+), 32 deletions(-)
diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini
index a3ecf12aad..6721740fbd 100644
--- a/doc/guides/nics/features/cxgbe.ini
+++ b/doc/guides/nics/features/cxgbe.ini
@@ -24,6 +24,7 @@ L3 checksum offload = Y
L4 checksum offload = Y
Packet type parsing = Y
Basic stats = Y
+Extended stats = Y
Stats per queue = Y
EEPROM dump = Y
Registers dump = Y
diff --git a/doc/guides/nics/features/cxgbevf.ini b/doc/guides/nics/features/cxgbevf.ini
index 303d6f2337..c8a25c9a8b 100644
--- a/doc/guides/nics/features/cxgbevf.ini
+++ b/doc/guides/nics/features/cxgbevf.ini
@@ -20,6 +20,7 @@ L3 checksum offload = Y
L4 checksum offload = Y
Packet type parsing = Y
Basic stats = Y
+Extended stats = Y
Stats per queue = Y
Multiprocess aware = Y
Linux = Y
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 177eca3976..a6b5c0110a 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -881,15 +881,37 @@ static const struct cxgbe_dev_xstats_name_off cxgbe_dev_port_stats_strings[] = {
{"rx_bg3_truncated_packets", offsetof(struct port_stats, rx_trunc3)},
};
+static const struct cxgbe_dev_xstats_name_off
+cxgbevf_dev_port_stats_strings[] = {
+ {"tx_bytes", offsetof(struct port_stats, tx_octets)},
+ {"tx_broadcast_packets", offsetof(struct port_stats, tx_bcast_frames)},
+ {"tx_multicast_packets", offsetof(struct port_stats, tx_mcast_frames)},
+ {"tx_unicast_packets", offsetof(struct port_stats, tx_ucast_frames)},
+ {"tx_drop_packets", offsetof(struct port_stats, tx_drop)},
+ {"rx_broadcast_packets", offsetof(struct port_stats, rx_bcast_frames)},
+ {"rx_multicast_packets", offsetof(struct port_stats, rx_mcast_frames)},
+ {"rx_unicast_packets", offsetof(struct port_stats, rx_ucast_frames)},
+ {"rx_length_error_packets", offsetof(struct port_stats, rx_len_err)},
+};
+
#define CXGBE_NB_RXQ_STATS RTE_DIM(cxgbe_dev_rxq_stats_strings)
#define CXGBE_NB_TXQ_STATS RTE_DIM(cxgbe_dev_txq_stats_strings)
#define CXGBE_NB_PORT_STATS RTE_DIM(cxgbe_dev_port_stats_strings)
+#define CXGBEVF_NB_PORT_STATS RTE_DIM(cxgbevf_dev_port_stats_strings)
static u16 cxgbe_dev_xstats_count(struct port_info *pi)
{
- return CXGBE_NB_PORT_STATS +
- (pi->n_tx_qsets * CXGBE_NB_TXQ_STATS) +
- (pi->n_rx_qsets * CXGBE_NB_RXQ_STATS);
+ u16 count;
+
+ count = (pi->n_tx_qsets * CXGBE_NB_TXQ_STATS) +
+ (pi->n_rx_qsets * CXGBE_NB_RXQ_STATS);
+
+ if (is_pf4(pi->adapter) != 0)
+ count += CXGBE_NB_PORT_STATS;
+ else
+ count += CXGBEVF_NB_PORT_STATS;
+
+ return count;
}
static int cxgbe_dev_xstats(struct rte_eth_dev *dev,
@@ -900,20 +922,28 @@ static int cxgbe_dev_xstats(struct rte_eth_dev *dev,
struct port_info *pi = dev->data->dev_private;
struct adapter *adap = pi->adapter;
struct sge *s = &adap->sge;
+ u16 count, i, qid, nstats;
struct port_stats ps;
- u16 count, i, qid;
u64 *stats_ptr;
count = cxgbe_dev_xstats_count(pi);
if (size < count)
return count;
- /* port stats */
- cxgbe_stats_get(pi, &ps);
+ if (is_pf4(adap) != 0) {
+ /* port stats for PF*/
+ cxgbe_stats_get(pi, &ps);
+ xstats_str = cxgbe_dev_port_stats_strings;
+ nstats = CXGBE_NB_PORT_STATS;
+ } else {
+ /* port stats for VF*/
+ cxgbevf_stats_get(pi, &ps);
+ xstats_str = cxgbevf_dev_port_stats_strings;
+ nstats = CXGBEVF_NB_PORT_STATS;
+ }
count = 0;
- xstats_str = cxgbe_dev_port_stats_strings;
- for (i = 0; i < CXGBE_NB_PORT_STATS; i++, count++) {
+ for (i = 0; i < nstats; i++, count++) {
if (xstats_names != NULL)
snprintf(xstats_names[count].name,
sizeof(xstats_names[count].name),
@@ -970,9 +1000,9 @@ static int cxgbe_dev_xstats(struct rte_eth_dev *dev,
}
/* Get port extended statistics by ID. */
-static int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
- const uint64_t *ids, uint64_t *values,
- unsigned int n)
+int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
+ const uint64_t *ids, uint64_t *values,
+ unsigned int n)
{
struct port_info *pi = dev->data->dev_private;
struct rte_eth_xstat *xstats_copy;
@@ -1005,9 +1035,9 @@ static int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
}
/* Get names of port extended statistics by ID. */
-static int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xnames,
- const uint64_t *ids, unsigned int n)
+int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xnames,
+ const uint64_t *ids, unsigned int n)
{
struct port_info *pi = dev->data->dev_private;
struct rte_eth_xstat_name *xnames_copy;
@@ -1041,16 +1071,16 @@ static int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
}
/* Get port extended statistics. */
-static int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
- struct rte_eth_xstat *xstats, unsigned int n)
+int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
+ struct rte_eth_xstat *xstats, unsigned int n)
{
return cxgbe_dev_xstats(dev, NULL, xstats, n);
}
/* Get names of port extended statistics. */
-static int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int n)
+int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int n)
{
return cxgbe_dev_xstats(dev, xstats_names, NULL, n);
}
diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h
index 801d6995d1..3c7aee0ae7 100644
--- a/drivers/net/cxgbe/cxgbe_pfvf.h
+++ b/drivers/net/cxgbe/cxgbe_pfvf.h
@@ -52,4 +52,15 @@ uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
const uint32_t *cxgbe_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev);
+int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
+ const uint64_t *ids, uint64_t *values,
+ unsigned int n);
+int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xnames,
+ const uint64_t *ids, unsigned int n);
+int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int n);
+int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
+ struct rte_eth_xstat *xstats, unsigned int n);
#endif /* _CXGBE_PFVF_H_ */
diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c
index bf1815c25f..4c809991b7 100644
--- a/drivers/net/cxgbe/cxgbevf_ethdev.c
+++ b/drivers/net/cxgbe/cxgbevf_ethdev.c
@@ -54,22 +54,12 @@ static int cxgbevf_dev_stats_get(struct rte_eth_dev *eth_dev,
eth_stats->oerrors = ps.tx_drop;
for (i = 0; i < pi->n_rx_qsets; i++) {
- struct sge_eth_rxq *rxq =
- &s->ethrxq[pi->first_rxqset + i];
+ struct sge_eth_rxq *rxq = &s->ethrxq[pi->first_rxqset + i];
- eth_stats->q_ipackets[i] = rxq->stats.pkts;
- eth_stats->q_ibytes[i] = rxq->stats.rx_bytes;
- eth_stats->ipackets += eth_stats->q_ipackets[i];
- eth_stats->ibytes += eth_stats->q_ibytes[i];
+ eth_stats->ipackets += rxq->stats.pkts;
+ eth_stats->ibytes += rxq->stats.rx_bytes;
}
- for (i = 0; i < pi->n_tx_qsets; i++) {
- struct sge_eth_txq *txq =
- &s->ethtxq[pi->first_txqset + i];
-
- eth_stats->q_opackets[i] = txq->stats.pkts;
- eth_stats->q_obytes[i] = txq->stats.tx_bytes;
- }
return 0;
}
@@ -97,6 +87,10 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = {
.rx_queue_stop = cxgbe_dev_rx_queue_stop,
.rx_queue_release = cxgbe_dev_rx_queue_release,
.stats_get = cxgbevf_dev_stats_get,
+ .xstats_get = cxgbe_dev_xstats_get,
+ .xstats_get_by_id = cxgbe_dev_xstats_get_by_id,
+ .xstats_get_names = cxgbe_dev_xstats_get_names,
+ .xstats_get_names_by_id = cxgbe_dev_xstats_get_names_by_id,
.mac_addr_set = cxgbe_mac_addr_set,
};
--
2.27.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] net/cxgbe: add support to get firmware version
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add " Rahul Lakkireddy
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
@ 2021-09-30 17:09 ` Rahul Lakkireddy
2021-10-05 17:35 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add VF xstats and " Ferruh Yigit
2 siblings, 0 replies; 10+ messages in thread
From: Rahul Lakkireddy @ 2021-09-30 17:09 UTC (permalink / raw)
To: dev; +Cc: nikhil.vasoya
From: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Implement eth_dev_ops callback to get firmware version.
Signed-off-by: Nikhil Vasoya <nikhil.vasoya@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
v2:
- Update FW version feature in cxgbe.ini and cxgbevf.ini
doc/guides/nics/features/cxgbe.ini | 1 +
doc/guides/nics/features/cxgbevf.ini | 1 +
drivers/net/cxgbe/cxgbe_ethdev.c | 26 ++++++++++++++++++++++++++
drivers/net/cxgbe/cxgbe_pfvf.h | 2 ++
drivers/net/cxgbe/cxgbevf_ethdev.c | 1 +
5 files changed, 31 insertions(+)
diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini
index 6721740fbd..f41fc14825 100644
--- a/doc/guides/nics/features/cxgbe.ini
+++ b/doc/guides/nics/features/cxgbe.ini
@@ -26,6 +26,7 @@ Packet type parsing = Y
Basic stats = Y
Extended stats = Y
Stats per queue = Y
+FW version = Y
EEPROM dump = Y
Registers dump = Y
Multiprocess aware = Y
diff --git a/doc/guides/nics/features/cxgbevf.ini b/doc/guides/nics/features/cxgbevf.ini
index c8a25c9a8b..a3174ef399 100644
--- a/doc/guides/nics/features/cxgbevf.ini
+++ b/doc/guides/nics/features/cxgbevf.ini
@@ -22,6 +22,7 @@ Packet type parsing = Y
Basic stats = Y
Extended stats = Y
Stats per queue = Y
+FW version = Y
Multiprocess aware = Y
Linux = Y
x86-32 = Y
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index a6b5c0110a..304fafed25 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1620,6 +1620,31 @@ static int cxgbe_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa)
return ret;
}
+int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+ size_t fw_size)
+{
+ struct port_info *pi = dev->data->dev_private;
+ struct adapter *adapter = pi->adapter;
+ int ret;
+
+ if (adapter->params.fw_vers == 0)
+ return -EIO;
+
+ ret = snprintf(fw_version, fw_size, "%u.%u.%u.%u",
+ G_FW_HDR_FW_VER_MAJOR(adapter->params.fw_vers),
+ G_FW_HDR_FW_VER_MINOR(adapter->params.fw_vers),
+ G_FW_HDR_FW_VER_MICRO(adapter->params.fw_vers),
+ G_FW_HDR_FW_VER_BUILD(adapter->params.fw_vers));
+ if (ret < 0)
+ return -EINVAL;
+
+ ret += 1;
+ if (fw_size < (size_t)ret)
+ return ret;
+
+ return 0;
+}
+
static const struct eth_dev_ops cxgbe_eth_dev_ops = {
.dev_start = cxgbe_dev_start,
.dev_stop = cxgbe_dev_stop,
@@ -1665,6 +1690,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = {
.fec_get_capability = cxgbe_fec_get_capability,
.fec_get = cxgbe_fec_get,
.fec_set = cxgbe_fec_set,
+ .fw_version_get = cxgbe_fw_version_get,
};
/*
diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h
index 3c7aee0ae7..81d0fce2e5 100644
--- a/drivers/net/cxgbe/cxgbe_pfvf.h
+++ b/drivers/net/cxgbe/cxgbe_pfvf.h
@@ -63,4 +63,6 @@ int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
unsigned int n);
int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned int n);
+int cxgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+ size_t fw_size);
#endif /* _CXGBE_PFVF_H_ */
diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c
index 4c809991b7..a62c56c2b9 100644
--- a/drivers/net/cxgbe/cxgbevf_ethdev.c
+++ b/drivers/net/cxgbe/cxgbevf_ethdev.c
@@ -92,6 +92,7 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = {
.xstats_get_names = cxgbe_dev_xstats_get_names,
.xstats_get_names_by_id = cxgbe_dev_xstats_get_names_by_id,
.mac_addr_set = cxgbe_mac_addr_set,
+ .fw_version_get = cxgbe_fw_version_get,
};
/*
--
2.27.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add VF xstats and firmware version
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add " Rahul Lakkireddy
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 2/2] net/cxgbe: add support to get firmware version Rahul Lakkireddy
@ 2021-10-05 17:35 ` Ferruh Yigit
2 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2021-10-05 17:35 UTC (permalink / raw)
To: Rahul Lakkireddy, dev; +Cc: nikhil.vasoya
On 9/30/2021 6:09 PM, Rahul Lakkireddy wrote:
> This series of patches add following features.
>
> Patch 1 adds support to fetch port and queue stats via xstats API
> for VF.
>
> Patch 2 adds support to get firmware version.
>
> Thanks,
> Rahul
>
> ---
> v2:
> - Update Extended Stats and FW version features in cxgbe.ini and
> cxgbevf.ini
>
> Nikhil Vasoya (2):
> net/cxgbe: add support for xstats API for the VF
> net/cxgbe: add support to get firmware version
>
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-10-05 17:35 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 18:01 [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and firmware version Rahul Lakkireddy
2021-09-27 18:01 ` [dpdk-dev] [PATCH 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
2021-09-30 16:09 ` Ferruh Yigit
2021-09-27 18:01 ` [dpdk-dev] [PATCH 2/2] net/cxgbe: add support to get firmware version Rahul Lakkireddy
2021-09-30 16:12 ` Ferruh Yigit
2021-09-30 16:23 ` [dpdk-dev] [PATCH 0/2] net/cxgbe: fetch VF xstats and " Ferruh Yigit
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add " Rahul Lakkireddy
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 1/2] net/cxgbe: add support for xstats API for the VF Rahul Lakkireddy
2021-09-30 17:09 ` [dpdk-dev] [PATCH v2 2/2] net/cxgbe: add support to get firmware version Rahul Lakkireddy
2021-10-05 17:35 ` [dpdk-dev] [PATCH v2 0/2] net/cxgbe: add VF xstats and " Ferruh Yigit
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).