From: Kiran KN <kirankn@juniper.net>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: "chas3@att.com" <chas3@att.com>,
David Marchand <david.marchand@redhat.com>,
Thomas Monjalon <thomas@monjalon.net>
Subject: [dpdk-dev] [PATCH] net/bonding: LACP Packet statistics support
Date: Sat, 10 Oct 2020 10:20:09 +0000 [thread overview]
Message-ID: <96073106-5E60-4CBC-8885-B2A6CDDD40B8@juniper.net> (raw)
net/bonding: LACP Packet statistics support
Store the LACP packets sent and received for each slave.
This can be used for debug purposes from any DPDK application.
Signed-Off-By: Kiran K N <kirankn@juniper.net>
Change-Id: Iae82bd7d0879a4c4333a292c96d431798c56e301
---
drivers/net/bonding/eth_bond_8023ad_private.h | 2 ++
drivers/net/bonding/rte_eth_bond_8023ad.c | 39 +++++++++++++++++++++++++++
drivers/net/bonding/rte_eth_bond_8023ad.h | 20 ++++++++++++++
3 files changed, 61 insertions(+)
diff --git a/drivers/net/bonding/eth_bond_8023ad_private.h b/drivers/net/bonding/eth_bond_8023ad_private.h
index ef0b56850..500640b28 100644
--- a/drivers/net/bonding/eth_bond_8023ad_private.h
+++ b/drivers/net/bonding/eth_bond_8023ad_private.h
@@ -19,6 +19,8 @@
#define BOND_MODE_8023AX_SLAVE_RX_PKTS 3
/** Maximum number of LACP packets from one slave queued in TX ring. */
#define BOND_MODE_8023AX_SLAVE_TX_PKTS 1
+/** maximum number of slaves for each port */
+#define BOND_MODE_8023AD_MAX_SLAVES 6
/**
* Timeouts deffinitions (5.4.4 in 802.1AX documentation).
*/
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index ea79a1344..37eb29847 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -132,6 +132,9 @@ static const struct rte_ether_addr lacp_mac_addr = {
struct port bond_mode_8023ad_ports[RTE_MAX_ETHPORTS];
+static uint64_t lacpdu_tx_count[BOND_MODE_8023AD_MAX_SLAVES];
+static uint64_t lacpdu_rx_count[BOND_MODE_8023AD_MAX_SLAVES];
+
static void
timer_cancel(uint64_t *timer)
{
@@ -629,6 +632,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id)
set_warning_flags(port, WRN_TX_QUEUE_FULL);
return;
}
+lacpdu_tx_count[slave_id]++;
} else {
uint16_t pkts_sent = rte_eth_tx_burst(slave_id,
internals->mode4.dedicated_queues.tx_qid,
@@ -638,6 +642,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id)
set_warning_flags(port, WRN_TX_QUEUE_FULL);
return;
}
+lacpdu_tx_count[slave_id] += pkts_sent;
}
@@ -896,6 +901,10 @@ bond_mode_8023ad_periodic_cb(void *arg)
lacp_pkt = NULL;
rx_machine_update(internals, slave_id, lacp_pkt);
+
+if (retval == 0) {
+ lacpdu_rx_count[slave_id]++;
+ }
} else {
uint16_t rx_count = rte_eth_rx_burst(slave_id,
internals->mode4.dedicated_queues.rx_qid,
@@ -906,6 +915,8 @@ bond_mode_8023ad_periodic_cb(void *arg)
slave_id, lacp_pkt);
else
rx_machine_update(internals, slave_id, NULL);
+
+lacpdu_rx_count[slave_id] += rx_count;
}
periodic_machine(internals, slave_id);
@@ -1715,3 +1726,31 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
return retval;
}
+
+uint64_t
+rte_eth_bond_8023ad_lacp_tx_count(uint16_t port_id, uint8_t clear)
+{
+if(port_id > BOND_MODE_8023AD_MAX_SLAVES)
+return -1;
+
+if(clear) {
+lacpdu_tx_count[port_id] = 0;
+return 0;
+}
+
+ return lacpdu_tx_count[port_id];
+}
+
+uint64_t
+rte_eth_bond_8023ad_lacp_rx_count(uint16_t port_id, uint8_t clear)
+{
+if(port_id > BOND_MODE_8023AD_MAX_SLAVES)
+return -1;
+
+if(clear) {
+lacpdu_rx_count[port_id] = 0;
+return 0;
+}
+
+return lacpdu_rx_count[port_id];
+}
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
index 5623e1424..7163de381 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
@@ -340,4 +340,24 @@ rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id,
*/
int
rte_eth_bond_8023ad_ext_set_fast(uint16_t port_id, uint16_t slave_id);
+
+/**
+ * Get Lacp statistics counter for slaves
+ * @param port_id Bonding slave device id
+ * @param clear, reset statistics
+ * @return
+ * 0 on success, negative value otherwise
+ */
+uint64_t
+rte_eth_bond_8023ad_lacp_tx_count(uint16_t port_id, uint8_t clear);
+
+/**
+ * Get Lacp statistics counter for slaves
+ * @param port_id Bonding slave device id
+ * @param clear, reset statistics
+ * @return
+ * 0 on success, negative value otherwise
+ */
+uint64_t
+rte_eth_bond_8023ad_lacp_rx_count(uint16_t port_id, uint8_t clear);
#endif /* RTE_ETH_BOND_8023AD_H_ */
--
2.16.6
Juniper Business Use Only
next reply other threads:[~2020-10-10 10:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-10 10:20 Kiran KN [this message]
2020-10-13 14:59 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=96073106-5E60-4CBC-8885-B2A6CDDD40B8@juniper.net \
--to=kirankn@juniper.net \
--cc=chas3@att.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).