get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/3310/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 3310,
    "url": "https://patches.dpdk.org/api/patches/3310/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1423840570-6452-4-git-send-email-michalx.k.jastrzebski@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1423840570-6452-4-git-send-email-michalx.k.jastrzebski@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1423840570-6452-4-git-send-email-michalx.k.jastrzebski@intel.com",
    "date": "2015-02-13T15:16:07",
    "name": "[dpdk-dev,v2,3/6] bond: add debug info for mode 6 link bonding",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d0524342c625059b79968d5250c31eb834690e72",
    "submitter": {
        "id": 74,
        "url": "https://patches.dpdk.org/api/people/74/?format=api",
        "name": "Michal Jastrzebski",
        "email": "michalx.k.jastrzebski@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1423840570-6452-4-git-send-email-michalx.k.jastrzebski@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/3310/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/3310/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 869C8B4D2;\n\tFri, 13 Feb 2015 16:18:06 +0100 (CET)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 45122B4C5\n\tfor <dev@dpdk.org>; Fri, 13 Feb 2015 16:18:04 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga103.fm.intel.com with ESMTP; 13 Feb 2015 07:10:49 -0800",
            "from unknown (HELO Sent) ([10.217.248.74])\n\tby orsmga001.jf.intel.com with SMTP; 13 Feb 2015 07:18:01 -0800",
            "by Sent (sSMTP sendmail emulation); Fri, 13 Feb 2015 16:17:38 +0200"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.09,571,1418112000\"; d=\"scan'208\";a=\"651789317\"",
        "From": "Michal Jastrzebski <michalx.k.jastrzebski@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 13 Feb 2015 16:16:07 +0100",
        "Message-Id": "<1423840570-6452-4-git-send-email-michalx.k.jastrzebski@intel.com>",
        "X-Mailer": "git-send-email 2.1.1",
        "In-Reply-To": "<1423840570-6452-1-git-send-email-michalx.k.jastrzebski@intel.com>",
        "References": "<1423840570-6452-1-git-send-email-michalx.k.jastrzebski@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 3/6] bond: add debug info for mode 6 link\n\tbonding",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "v2 changes\n- add IPv4 RX/TX information\n- add mode6_debug(..) function  \n\nThis patch add some debug information when using link bonding mode 6.\nIt prints basic information about ARP packets on RX and TX (MAC, ip,\npacket number, arp packet type).\nIf CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB == y.\nIf CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1 is enabled instead of previous\none, use show command to see IPv4 balancing from clients.\n\nSigned-off-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>\n---\n config/common_linuxapp                 |    3 +-\n lib/librte_pmd_bond/rte_eth_bond_pmd.c |  199 +++++++++++++++++++++++++++++++-\n 2 files changed, 198 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/config/common_linuxapp b/config/common_linuxapp\nindex d428f84..7c54edf 100644\n--- a/config/common_linuxapp\n+++ b/config/common_linuxapp\n@@ -220,7 +220,8 @@ CONFIG_RTE_LIBRTE_PMD_PCAP=n\n # Compile link bonding PMD library\n #\n CONFIG_RTE_LIBRTE_PMD_BOND=y\n-\n+CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB=n\n+CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1=n\n #\n # Compile software PMD backed by AF_PACKET sockets (Linux only)\n #\ndiff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c\nindex 40e4ccb..f469b5c 100644\n--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c\n+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c\n@@ -192,17 +192,185 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,\n \treturn num_rx_total;\n }\n \n+#if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1)\n+uint32_t burstnumberRX;\n+uint32_t burstnumberTX;\n+\n+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB\n+\n+static void\n+arp_op_name(uint16_t arp_op, char *buf)\n+{\n+\tswitch (arp_op) {\n+\tcase ARP_OP_REQUEST:\n+\t\tsnprintf(buf, sizeof(\"ARP Request\"), \"%s\", \"ARP Request\");\n+\t\treturn;\n+\tcase ARP_OP_REPLY:\n+\t\tsnprintf(buf, sizeof(\"ARP Reply\"), \"%s\", \"ARP Reply\");\n+\t\treturn;\n+\tcase ARP_OP_REVREQUEST:\n+\t\tsnprintf(buf, sizeof(\"Reverse ARP Request\"), \"%s\", \"Reverse ARP Request\");\n+\t\treturn;\n+\tcase ARP_OP_REVREPLY:\n+\t\tsnprintf(buf, sizeof(\"Reverse ARP Reply\"), \"%s\", \"Reverse ARP Reply\");\n+\t\treturn;\n+\tcase ARP_OP_INVREQUEST:\n+\t\tsnprintf(buf, sizeof(\"Peer Identify Request\"), \"%s\", \"Peer Identify Request\");\n+\t\treturn;\n+\tcase ARP_OP_INVREPLY:\n+\t\tsnprintf(buf, sizeof(\"Peer Identify Reply\"), \"%s\", \"Peer Identify Reply\");\n+\t\treturn;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\tsnprintf(buf, sizeof(\"Unknown\"), \"%s\", \"Unknown\");\n+\treturn;\n+}\n+#endif\n+#define MaxIPv4String\t16\n+static void\n+ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf, uint8_t buf_size)\n+{\n+\tuint32_t ipv4_addr;\n+\n+\tipv4_addr = rte_be_to_cpu_32(be_ipv4_addr);\n+\tsnprintf(buf, buf_size, \"%d.%d.%d.%d\", (ipv4_addr >> 24) & 0xFF,\n+\t\t(ipv4_addr >> 16) & 0xFF, (ipv4_addr >> 8) & 0xFF,\n+\t\tipv4_addr & 0xFF);\n+}\n+\n+#define MAX_CLIENTS_NUMBER\t128\n+uint8_t active_clients;\n+struct client_stats_t {\n+\tuint8_t port;\n+\tuint32_t ipv4_addr;\n+\tuint32_t ipv4_rx_packets;\n+\tuint32_t ipv4_tx_packets;\n+};\n+struct client_stats_t client_stats[MAX_CLIENTS_NUMBER];\n+\n+static void\n+update_client_stats(uint32_t addr, uint8_t port, uint32_t *TXorRXindicator)\n+{\n+\tint i = 0;\n+\tfor (; i < MAX_CLIENTS_NUMBER; i++)\t{\n+\t\tif ((client_stats[i].ipv4_addr == addr) && (client_stats[i].port == port))\t{\n+\t\t\t/* Just update RX packets number for this client */\n+\t\t\tif (TXorRXindicator == &burstnumberRX)\t{\n+\t\t\t\tclient_stats[i].ipv4_rx_packets++;\n+\t\t\t} else {\n+\t\t\t\tclient_stats[i].ipv4_tx_packets++;\n+\t\t\t}\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\t\t\t/* We have a new client. Insert him to the table, and increment stats */\n+\tif (TXorRXindicator == &burstnumberRX)\t{\n+\t\tclient_stats[active_clients].ipv4_rx_packets++;\n+\t} else {\n+\t\tclient_stats[active_clients].ipv4_tx_packets++;\n+\t}\n+\tclient_stats[active_clients].ipv4_addr = addr;\n+\tclient_stats[active_clients].port = port;\n+\tactive_clients++;\n+\n+\treturn;\n+}\n+\n+void print_client_stats(void);\n+void print_client_stats(void)\n+{\n+\tint i = 0;\n+\tchar buf[MaxIPv4String];\n+\n+\tfor (; i < active_clients; i++)\t{\n+\t\tipv4_addr_to_dot(client_stats[i].ipv4_addr, buf, MaxIPv4String);\n+\t\tprintf(\"port:%d client:%s RX:%d TX:%d\\n\", \\\n+\t\t\t\tclient_stats[i].port, \\\n+\t\t\t\tbuf, \\\n+\t\t\t\tclient_stats[i].ipv4_rx_packets, \\\n+\t\t\t\tclient_stats[i].ipv4_tx_packets);\n+\t}\n+}\n+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB\n+#define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_op, port, burstnumber)\t\\\n+\t\tRTE_LOG(DEBUG, PMD, \\\n+\t\t\"%s \" \\\n+\t\t\"port:%d \" \\\n+\t\t\"SrcMAC:%02X:%02X:%02X:%02X:%02X:%02X \" \\\n+\t\t\"SrcIP:%s \" \\\n+\t\t\"DstMAC:%02X:%02X:%02X:%02X:%02X:%02X \" \\\n+\t\t\"DstIP:%s \" \\\n+\t\t\"%s \" \\\n+\t\t\"%d\\n\", \\\n+\t\tinfo, \\\n+\t\tport, \\\n+\t\teth_h->s_addr.addr_bytes[0], \\\n+\t\teth_h->s_addr.addr_bytes[1], \\\n+\t\teth_h->s_addr.addr_bytes[2], \\\n+\t\teth_h->s_addr.addr_bytes[3], \\\n+\t\teth_h->s_addr.addr_bytes[4], \\\n+\t\teth_h->s_addr.addr_bytes[5], \\\n+\t\tsrc_ip, \\\n+\t\teth_h->d_addr.addr_bytes[0], \\\n+\t\teth_h->d_addr.addr_bytes[1], \\\n+\t\teth_h->d_addr.addr_bytes[2], \\\n+\t\teth_h->d_addr.addr_bytes[3], \\\n+\t\teth_h->d_addr.addr_bytes[4], \\\n+\t\teth_h->d_addr.addr_bytes[5], \\\n+\t\tdst_ip, \\\n+\t\tarp_op, \\\n+\t\t++burstnumber)\n+#endif\n+\n+static void\n+mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, uint8_t port, uint32_t __attribute__((unused)) *burstnumber)\n+{\n+\tstruct ipv4_hdr *ipv4_h;\n+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB\n+\tstruct arp_hdr *arp_h;\n+\tchar dst_ip[16];\n+\tchar ArpOp[24];\n+\tchar buf[16];\n+#endif\n+\tchar src_ip[16];\n+\n+\tuint16_t ether_type = eth_h->ether_type;\n+\tuint16_t offset = get_vlan_offset(eth_h, &ether_type);\n+\n+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB\n+\tsnprintf(buf, 16, \"%s\", info);\n+#endif\n+\n+\tif (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) {\n+\t\tipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset);\n+\t\tipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String);\n+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB\n+\t\tipv4_addr_to_dot(ipv4_h->dst_addr, dst_ip, MaxIPv4String);\n+\t\tMODE6_DEBUG(buf, src_ip, dst_ip, eth_h, \"\", port, *burstnumber);\n+#endif\n+\t\tupdate_client_stats(ipv4_h->src_addr, port, burstnumber);\n+\t}\n+#ifdef RTE_LIBRTE_BOND_DEBUG_ALB\n+\telse if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) {\n+\t\tarp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset);\n+\t\tipv4_addr_to_dot(arp_h->arp_data.arp_sip, src_ip, MaxIPv4String);\n+\t\tipv4_addr_to_dot(arp_h->arp_data.arp_tip, dst_ip, MaxIPv4String);\n+\t\tarp_op_name(rte_be_to_cpu_16(arp_h->arp_op), ArpOp);\n+\t\tMODE6_DEBUG(buf, src_ip, dst_ip, eth_h, ArpOp, port, *burstnumber);\n+\t}\n+#endif\n+}\n+#endif\n+\n static uint16_t\n bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)\n {\n \tstruct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue;\n \tstruct bond_dev_private *internals = bd_tx_q->dev_private;\n-\n \tstruct ether_hdr *eth_h;\n-\n \tuint16_t ether_type, offset;\n \tuint16_t nb_recv_pkts;\n-\n \tint i;\n \n \tnb_recv_pkts = bond_ethdev_rx_burst(queue, bufs, nb_pkts);\n@@ -213,8 +381,16 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)\n \t\toffset = get_vlan_offset(eth_h, &ether_type);\n \n \t\tif (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) {\n+#if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1)\n+\t\tmode6_debug(\"RX ARP:\", eth_h, bufs[i]->port, &burstnumberRX);\n+#endif\n \t\t\tbond_mode_alb_arp_recv(eth_h, offset, internals);\n \t\t}\n+#if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1)\n+\t\telse if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) {\n+\t\t\tmode6_debug(\"RX IPv4:\", eth_h, bufs[i]->port, &burstnumberRX);\n+\t\t}\n+#endif\n \t}\n \n \treturn nb_recv_pkts;\n@@ -552,6 +728,9 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)\n \t\t\tether_hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *);\n \t\t\tif (is_same_ether_addr(&ether_hdr->s_addr, &primary_slave_addr))\n \t\t\t\tether_addr_copy(&active_slave_addr, &ether_hdr->s_addr);\n+#if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1)\n+\t\t\t\t\tmode6_debug(\"TX IPv4:\", ether_hdr, slaves[i], &burstnumberTX);\n+#endif\n \t\t}\n \n \t\tnum_tx_total += rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id,\n@@ -673,6 +852,14 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)\n \n \t\t\tnum_tx_total += num_send;\n \t\t\tnum_not_send += slave_bufs_pkts[i] - num_send;\n+\n+#if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1)\n+\t/* Print TX stats including update packets */\n+\t\t\tfor (j = 0; j < slave_bufs_pkts[i]; j++) {\n+\t\t\t\teth_h = rte_pktmbuf_mtod(slave_bufs[i][j], struct ether_hdr *);\n+\t\t\t\tmode6_debug(\"TX ARP:\", eth_h, i, &burstnumberTX);\n+\t\t\t}\n+#endif\n \t\t}\n \t}\n \n@@ -684,6 +871,12 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)\n \t\t\tfor (j = num_send; j < update_bufs_pkts[i]; j++) {\n \t\t\t\trte_pktmbuf_free(update_bufs[i][j]);\n \t\t\t}\n+#if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1)\n+\t\t\tfor (j = 0; j < update_bufs_pkts[i]; j++) {\n+\t\t\t\teth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct ether_hdr *);\n+\t\t\t\tmode6_debug(\"TX ARPupd:\", eth_h, i, &burstnumberTX);\n+\t\t\t}\n+#endif\n \t\t}\n \t}\n \n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "3/6"
    ]
}