From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 3E3695A82 for ; Fri, 30 Jan 2015 12:09:27 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 30 Jan 2015 03:03:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="447484166" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by FMSMGA003.fm.intel.com with ESMTP; 30 Jan 2015 02:55:30 -0800 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.11]) by IRSMSX104.ger.corp.intel.com ([169.254.5.229]) with mapi id 14.03.0195.001; Fri, 30 Jan 2015 11:09:21 +0000 From: "Jastrzebski, MichalX K" To: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 3/4] bond: add debug info for mode 6 link bonding Thread-Index: AQHQPHvmez5jNNl+dEiFkHeUg9fJn5zYgTvA Date: Fri, 30 Jan 2015 11:09:20 +0000 Message-ID: <60ABE07DBB3A454EB7FAD707B4BB1582138D6581@IRSMSX109.ger.corp.intel.com> References: <1422615464-4432-1-git-send-email-michalx.k.jastrzebski@intel.com> <1422615464-4432-4-git-send-email-michalx.k.jastrzebski@intel.com> In-Reply-To: <1422615464-4432-4-git-send-email-michalx.k.jastrzebski@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 3/4] bond: add debug info for mode 6 link bonding X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2015 11:09:28 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michal Jastrzebski > Sent: Friday, January 30, 2015 11:58 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH 3/4] bond: add debug info for mode 6 link > bonding >=20 >=20 > Signed-off-by: Michal Jastrzebski > --- > config/common_linuxapp | 2 +- > lib/librte_pmd_bond/rte_eth_bond_pmd.c | 124 > ++++++++++++++++++++++++++++++++ > 2 files changed, 125 insertions(+), 1 deletion(-) >=20 > 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=3Dn > # Compile link bonding PMD library > # > CONFIG_RTE_LIBRTE_PMD_BOND=3Dy > - > +CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB=3Dn > # > # 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; > } >=20 > +#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 =3D 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; >=20 > nb_recv_pkts =3D 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 >=20 > for (i =3D 0; i < nb_recv_pkts; i++) { > eth_h =3D 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 =3D get_vlan_ethertype(eth_h); >=20 > if (ether_type =3D=3D rte_cpu_to_be_16(ETHER_TYPE_ARP)) { > +#ifdef RTE_LIBRTE_BOND_DEBUG_ALB > + arp_h =3D (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 =3D=3D rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { > + ipv4_h =3D (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 > } >=20 > 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 =3D 0; > } >=20 > +#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 =3D 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) >=20 > num_tx_total +=3D num_send; > num_not_send +=3D slave_bufs_pkts[i] - num_send; > + > +#ifdef RTE_LIBRTE_BOND_DEBUG_ALB > + /* Print TX stats including update packets */ > + for (j =3D 0; j < slave_bufs_pkts[i]; j++) { > + eth_h =3D rte_pktmbuf_mtod(slave_bufs[i][j], > struct ether_hdr *); > + offset =3D get_vlan_offset(eth_h); > + arp_h =3D (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 > } > } >=20 > @@ -676,6 +789,17 @@ bond_ethdev_tx_burst_alb(void *queue, struct > rte_mbuf **bufs, uint16_t nb_pkts) > for (j =3D num_send; j < update_bufs_pkts[i]; j++) { > rte_pktmbuf_free(update_bufs[i][j]); > } > +#ifdef RTE_LIBRTE_BOND_DEBUG_ALB > + for (j =3D 0; j < update_bufs_pkts[i]; j++) { > + eth_h =3D rte_pktmbuf_mtod(update_bufs[i][j], > struct ether_hdr *); > + offset =3D get_vlan_offset(eth_h); > + arp_h =3D (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 > } > } >=20 > -- > 1.7.9.5 This patch add some debug information when using link bonding mode 6. It prints basic information about ARP packets on RX and TX (MAC, ip, packet= number, arp packet type).