* [PATCH] net/octeontx_ep: updated ethdev ops
@ 2022-06-09 15:19 Sathesh B Edara
2022-06-15 17:10 ` Jerin Jacob
0 siblings, 1 reply; 2+ messages in thread
From: Sathesh B Edara @ 2022-06-09 15:19 UTC (permalink / raw)
To: sburla, jerinj, sedara, Nalla Pradeep, Radha Mohan Chintakuntla,
Veerasenareddy Burru
Cc: dev
Updated ethdev ops support for link_update(),
stats_get() and stats_reset()
Signed-off-by: Sathesh B Edara <sedara@marvell.com>
---
drivers/net/octeontx_ep/otx_ep_ethdev.c | 69 +++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/drivers/net/octeontx_ep/otx_ep_ethdev.c b/drivers/net/octeontx_ep/otx_ep_ethdev.c
index 806add246b..b8a3da63c0 100644
--- a/drivers/net/octeontx_ep/otx_ep_ethdev.c
+++ b/drivers/net/octeontx_ep/otx_ep_ethdev.c
@@ -337,6 +337,72 @@ otx_ep_tx_queue_release(struct rte_eth_dev *dev, uint16_t q_no)
otx_ep_delete_iqs(tq->otx_ep_dev, tq->q_no);
}
+static int otx_ep_dev_stats_reset(struct rte_eth_dev *dev)
+{
+ struct otx_ep_device *otx_epvf = OTX_EP_DEV(dev);
+ uint32_t i;
+
+ for (i = 0; i < otx_epvf->nb_tx_queues; i++)
+ memset(&otx_epvf->instr_queue[i]->stats, 0,
+ sizeof(struct otx_ep_iq_stats));
+
+ for (i = 0; i < otx_epvf->nb_rx_queues; i++)
+ memset(&otx_epvf->droq[i]->stats, 0,
+ sizeof(struct otx_ep_droq_stats));
+
+ return 0;
+}
+
+static int otx_ep_dev_stats_get(struct rte_eth_dev *eth_dev,
+ struct rte_eth_stats *stats)
+{
+ struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+ struct otx_ep_iq_stats *ostats;
+ struct otx_ep_droq_stats *istats;
+ uint32_t i;
+
+ memset(stats, 0, sizeof(struct rte_eth_stats));
+
+ for (i = 0; i < otx_epvf->nb_tx_queues; i++) {
+ ostats = &otx_epvf->instr_queue[i]->stats;
+ stats->q_opackets[i] = ostats->tx_pkts;
+ stats->q_obytes[i] = ostats->tx_bytes;
+ stats->opackets += ostats->tx_pkts;
+ stats->obytes += ostats->tx_bytes;
+ stats->oerrors += ostats->instr_dropped;
+ }
+ for (i = 0; i < otx_epvf->nb_rx_queues; i++) {
+ istats = &otx_epvf->droq[i]->stats;
+ stats->q_ipackets[i] = istats->pkts_received;
+ stats->q_ibytes[i] = istats->bytes_received;
+ stats->q_errors[i] = istats->rx_err;
+ stats->ipackets += istats->pkts_received;
+ stats->ibytes += istats->bytes_received;
+ stats->imissed += istats->rx_alloc_failure;
+ stats->ierrors += istats->rx_err;
+ stats->rx_nombuf += istats->rx_alloc_failure;
+ }
+ return 0;
+}
+
+static int
+otx_ep_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
+{
+ struct rte_eth_link link;
+
+ RTE_SET_USED(wait_to_complete);
+
+ if (!eth_dev->data->dev_started)
+ return 0;
+
+ link.link_speed = RTE_ETH_SPEED_NUM_10G;
+ link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+ link.link_autoneg = RTE_ETH_LINK_AUTONEG;
+ link.link_status = RTE_ETH_LINK_UP;
+
+ return rte_eth_linkstatus_set(eth_dev, &link);
+}
+
/* Define our ethernet definitions */
static const struct eth_dev_ops otx_ep_eth_dev_ops = {
.dev_configure = otx_ep_dev_configure,
@@ -347,6 +413,9 @@ static const struct eth_dev_ops otx_ep_eth_dev_ops = {
.tx_queue_setup = otx_ep_tx_queue_setup,
.tx_queue_release = otx_ep_tx_queue_release,
.dev_infos_get = otx_ep_dev_info_get,
+ .link_update = otx_ep_link_update,
+ .stats_get = otx_ep_dev_stats_get,
+ .stats_reset = otx_ep_dev_stats_reset,
};
static int
--
2.36.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net/octeontx_ep: updated ethdev ops
2022-06-09 15:19 [PATCH] net/octeontx_ep: updated ethdev ops Sathesh B Edara
@ 2022-06-15 17:10 ` Jerin Jacob
0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2022-06-15 17:10 UTC (permalink / raw)
To: Sathesh B Edara
Cc: Satananda Burla, Jerin Jacob, Nalla Pradeep,
Radha Mohan Chintakuntla, Veerasenareddy Burru, dpdk-dev
On Thu, Jun 9, 2022 at 8:50 PM Sathesh B Edara <sedara@marvell.com> wrote:
>
> Updated ethdev ops support for link_update(),
> stats_get() and stats_reset()
a) Split as two patches (Suggested heading)
1) net/octeontx_ep: support basic stats
2) net/octeontx_ep: support link status
b) Update doc/guides/nics/features/octeontx_ep.ini
See doc/guides/nics/features.rst
>
> Signed-off-by: Sathesh B Edara <sedara@marvell.com>
Since this is your first path, you may consider changing to "Sathesh
Edara <sedara@marvell.com>"
> +static int
> +otx_ep_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
> +{
> + struct rte_eth_link link;
> +
> + RTE_SET_USED(wait_to_complete);
> +
> + if (!eth_dev->data->dev_started)
> + return 0;
> +
> + link.link_speed = RTE_ETH_SPEED_NUM_10G;
Isn't this RTE_ETH_SPEED_NUM_NONE? as its speed is "Not defined"
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-15 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 15:19 [PATCH] net/octeontx_ep: updated ethdev ops Sathesh B Edara
2022-06-15 17:10 ` Jerin Jacob
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).