net/bonding: LACP Packet statistics support
Checks
Commit Message
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(+)
--
2.16.6
Juniper Business Use Only
Comments
On 10/10/2020 11:20 AM, Kiran KN wrote:
> 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
No change id in the upstream patches please.
<...>
> @@ -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;
> +}
> +
Hi Kiran,
Something seems went wrong with the formatting, can you please send a new version?
Also can you please cc all bonding maintainers in next version?
@@ -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).
*/
@@ -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];
+}
@@ -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_ */