From: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/4] bond: add debug info for mode 6 link bonding
Date: Fri, 30 Jan 2015 11:57:43 +0100 [thread overview]
Message-ID: <1422615464-4432-4-git-send-email-michalx.k.jastrzebski@intel.com> (raw)
In-Reply-To: <1422615464-4432-1-git-send-email-michalx.k.jastrzebski@intel.com>
Signed-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
---
config/common_linuxapp | 2 +-
lib/librte_pmd_bond/rte_eth_bond_pmd.c | 124 ++++++++++++++++++++++++++++++++
2 files changed, 125 insertions(+), 1 deletion(-)
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 2f9643b..1cc2d7e 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -220,7 +220,7 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=n
# Compile link bonding PMD library
#
CONFIG_RTE_LIBRTE_PMD_BOND=y
-
+CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB=n
#
# Compile software PMD backed by AF_PACKET sockets (Linux only)
#
diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index b0525cc..348c653 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -208,6 +208,78 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
return num_rx_total;
}
+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB
+uint32_t burstnumberRX;
+uint32_t burstnumberTX;
+
+static void
+arp_op_name(uint16_t arp_op, char *buf)
+{
+ switch (arp_op) {
+ case ARP_OP_REQUEST:
+ snprintf(buf, sizeof("ARP Request"), "%s", "ARP Request");
+ return;
+ case ARP_OP_REPLY:
+ snprintf(buf, sizeof("ARP Reply"), "%s", "ARP Reply");
+ return;
+ case ARP_OP_REVREQUEST:
+ snprintf(buf, sizeof("Reverse ARP Request"), "%s", "Reverse ARP Request");
+ return;
+ case ARP_OP_REVREPLY:
+ snprintf(buf, sizeof("Reverse ARP Reply"), "%s", "Reverse ARP Reply");
+ return;
+ case ARP_OP_INVREQUEST:
+ snprintf(buf, sizeof("Peer Identify Request"), "%s", "Peer Identify Request");
+ return;
+ case ARP_OP_INVREPLY:
+ snprintf(buf, sizeof("Peer Identify Reply"), "%s", "Peer Identify Reply");
+ return;
+ default:
+ break;
+ }
+ snprintf(buf, sizeof("Unknown"), "%s", "Unknown");
+ return;
+}
+#define MaxIPv4String 16
+static void
+ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf, uint8_t buf_size)
+{
+ uint32_t ipv4_addr;
+
+ ipv4_addr = rte_be_to_cpu_32(be_ipv4_addr);
+ snprintf(buf, buf_size, "%d.%d.%d.%d", (ipv4_addr >> 24) & 0xFF,
+ (ipv4_addr >> 16) & 0xFF, (ipv4_addr >> 8) & 0xFF,
+ ipv4_addr & 0xFF);
+}
+
+#define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_op, port, burstnumber) \
+ RTE_LOG(DEBUG, PMD, info \
+ "port:%d " \
+ "SrcMAC:%02X:%02X:%02X:%02X:%02X:%02X " \
+ "SrcIP:%s " \
+ "DstMAC:%02X:%02X:%02X:%02X:%02X:%02X " \
+ "DstIP:%s " \
+ "%s " \
+ "%d\n", \
+ port, \
+ eth_h->s_addr.addr_bytes[0], \
+ eth_h->s_addr.addr_bytes[1], \
+ eth_h->s_addr.addr_bytes[2], \
+ eth_h->s_addr.addr_bytes[3], \
+ eth_h->s_addr.addr_bytes[4], \
+ eth_h->s_addr.addr_bytes[5], \
+ src_ip, \
+ eth_h->d_addr.addr_bytes[0], \
+ eth_h->d_addr.addr_bytes[1], \
+ eth_h->d_addr.addr_bytes[2], \
+ eth_h->d_addr.addr_bytes[3], \
+ eth_h->d_addr.addr_bytes[4], \
+ eth_h->d_addr.addr_bytes[5], \
+ dst_ip, \
+ arp_op, \
+ ++burstnumber)
+#endif
+
static uint16_t
bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
{
@@ -222,6 +294,13 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
int i;
nb_recv_pkts = bond_ethdev_rx_burst(queue, bufs, nb_pkts);
+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB
+ struct arp_hdr *arp_h;
+ struct ipv4_hdr *ipv4_h;
+ char src_ip[16];
+ char dst_ip[16];
+ char ArpOp[24];
+#endif
for (i = 0; i < nb_recv_pkts; i++) {
eth_h = rte_pktmbuf_mtod(bufs[i], struct ether_hdr *);
@@ -229,8 +308,23 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
ether_type = get_vlan_ethertype(eth_h);
if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) {
+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB
+ arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset);
+ ipv4_addr_to_dot(arp_h->arp_data.arp_sip, src_ip, MaxIPv4String);
+ ipv4_addr_to_dot(arp_h->arp_data.arp_tip, dst_ip, MaxIPv4String);
+ arp_op_name(rte_be_to_cpu_16(arp_h->arp_op), ArpOp);
+ MODE6_DEBUG("RX ARP:", src_ip, dst_ip, eth_h, ArpOp, bufs[i]->port, burstnumberRX);
+#endif
bond_mode_alb_arp_recv(eth_h, offset, internals);
}
+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB
+ else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) {
+ ipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset);
+ ipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String);
+ ipv4_addr_to_dot(ipv4_h->dst_addr, dst_ip, MaxIPv4String);
+ MODE6_DEBUG("RX IPv4:", src_ip, dst_ip, eth_h, "", bufs[i]->port, burstnumberRX);
+ }
+#endif
}
return nb_recv_pkts;
@@ -653,6 +747,12 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
internals->mode6.ntt = 0;
}
+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB
+ struct arp_hdr *arp_h;
+ char src_ip[16];
+ char dst_ip[16];
+ char ArpOp[24];
+#endif
/* Send ARP packets on proper slaves */
for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
if (slave_bufs_pkts[i] > 0) {
@@ -665,6 +765,19 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
num_tx_total += num_send;
num_not_send += slave_bufs_pkts[i] - num_send;
+
+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB
+ /* Print TX stats including update packets */
+ for (j = 0; j < slave_bufs_pkts[i]; j++) {
+ eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], struct ether_hdr *);
+ offset = get_vlan_offset(eth_h);
+ arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset);
+ ipv4_addr_to_dot(arp_h->arp_data.arp_sip, src_ip, MaxIPv4String);
+ ipv4_addr_to_dot(arp_h->arp_data.arp_tip, dst_ip, MaxIPv4String);
+ arp_op_name(rte_be_to_cpu_16(arp_h->arp_op), ArpOp);
+ MODE6_DEBUG("TX ARP:", src_ip, dst_ip, eth_h, ArpOp, i, burstnumberTX);
+ }
+#endif
}
}
@@ -676,6 +789,17 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
for (j = num_send; j < update_bufs_pkts[i]; j++) {
rte_pktmbuf_free(update_bufs[i][j]);
}
+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB
+ for (j = 0; j < update_bufs_pkts[i]; j++) {
+ eth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct ether_hdr *);
+ offset = get_vlan_offset(eth_h);
+ arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset);
+ ipv4_addr_to_dot(arp_h->arp_data.arp_sip, src_ip, MaxIPv4String);
+ ipv4_addr_to_dot(arp_h->arp_data.arp_tip, dst_ip, MaxIPv4String);
+ arp_op_name(rte_be_to_cpu_16(arp_h->arp_op), ArpOp);
+ MODE6_DEBUG("TX ARPupd:", src_ip, dst_ip, eth_h, ArpOp, i, burstnumberTX);
+ }
+#endif
}
}
--
1.7.9.5
next prev parent reply other threads:[~2015-01-30 10:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 10:57 [dpdk-dev] [PATCH 0/4] Link Bonding mode 6 support (ALB) Michal Jastrzebski
2015-01-30 10:57 ` [dpdk-dev] [PATCH 1/4] net: changed arp_hdr struct declaration Michal Jastrzebski
2015-01-30 10:57 ` [dpdk-dev] [PATCH 2/4] bond: added link bonding mode 6 implementation Michal Jastrzebski
2015-01-30 10:57 ` Michal Jastrzebski [this message]
2015-01-30 11:09 ` [dpdk-dev] [PATCH 3/4] bond: add debug info for mode 6 link bonding Jastrzebski, MichalX K
2015-01-30 10:57 ` [dpdk-dev] [PATCH 4/4] bond: added example application for link bonding mode 6 Michal Jastrzebski
2015-01-30 11:27 ` Jastrzebski, MichalX K
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=1422615464-4432-4-git-send-email-michalx.k.jastrzebski@intel.com \
--to=michalx.k.jastrzebski@intel.com \
--cc=dev@dpdk.org \
/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).