Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/42130/?format=api
http://patches.dpdk.org/api/patches/42130/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180702212750.16758-2-thomas@monjalon.net/", "project": { "id": 1, "url": "http://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": "<20180702212750.16758-2-thomas@monjalon.net>", "list_archive_url": "https://inbox.dpdk.org/dev/20180702212750.16758-2-thomas@monjalon.net", "date": "2018-07-02T21:27:46", "name": "[v2,1/5] doc: remove code from KNI example guide", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "ad3d1d95c55cec35660f12a9bac8f1e5524adbd2", "submitter": { "id": 685, "url": "http://patches.dpdk.org/api/people/685/?format=api", "name": "Thomas Monjalon", "email": "thomas@monjalon.net" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180702212750.16758-2-thomas@monjalon.net/mbox/", "series": [ { "id": 366, "url": "http://patches.dpdk.org/api/series/366/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=366", "date": "2018-07-02T21:27:45", "name": "remove old ethdev offload API", "version": 2, "mbox": "http://patches.dpdk.org/series/366/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/42130/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/42130/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 528EA1BDD8;\n\tMon, 2 Jul 2018 23:28:04 +0200 (CEST)", "from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com\n\t[66.111.4.25]) by dpdk.org (Postfix) with ESMTP id C36A31BDD1\n\tfor <dev@dpdk.org>; Mon, 2 Jul 2018 23:28:00 +0200 (CEST)", "from compute1.internal (compute1.nyi.internal [10.202.2.41])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 632FD21BB7;\n\tMon, 2 Jul 2018 17:27:59 -0400 (EDT)", "from mailfrontend2 ([10.202.2.163])\n\tby compute1.internal (MEProxy); Mon, 02 Jul 2018 17:27:59 -0400", "from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id 179C51026B;\n\tMon, 2 Jul 2018 17:27:58 -0400 (EDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n\tcc:date:from:in-reply-to:message-id:references:subject:to\n\t:x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=rTQIFK4CJzM41W\n\tPA73eqY7k05hQo3OjQdBem2LOEG8k=; b=N2tkpyb6S47Zr8KRnAWyXdSVbOuH6a\n\tBIk5gSUrwQliRbyN03YOrLHqIKDfDnPJcuej8ACISwOHVlCGCCW2Z+7Rgdkp/M/P\n\twciuuwVNPWNfcF6TCDPW36MmMEtTvPfNrwO53ITiORLvbNzAOVoGfl+ajxfK+8O2\n\to+8pzc6EkoNl0=", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:date:from:in-reply-to:message-id\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=\n\tfm3; bh=rTQIFK4CJzM41WPA73eqY7k05hQo3OjQdBem2LOEG8k=; b=egcEZhJS\n\tId3kjKdQzWDF2I3EMtbL2UYQm36SV4Wg03WMb9/QIesRzvNuKxM2MeOh0NZ98pD6\n\t6hioK5EhGRpLsHI2jxtpzqF75eZ766UCkxUhPh2vntPuoD8cGVDJ5K4B7KSfIrMX\n\t2EJWoezM1O2z4mTMFZJVji0Km7q8A/9PTqZ0lcabEgR3T7TdeX0ylnWRqk73Jaif\n\tT8yPTS8PMXoLVdYXPIrcxvaUlMy9Q7IrXu6WQvpo5JfAz7wktruZxPFdfAXozAFG\n\teRwDuVfJjeTKJ/1MuTOHLeArupH/kZPUDF4XF08Cjmw9NgRS87FSGGziTIR5cPCj\n\tQa10/dGYcdwWMw==" ], "X-ME-Proxy": "<xmx:35g6Wyc7OFAn5YOZ2vlTSVqUkcBsVFIaNgq-Z3ZO2Pke7mLdmXzhKw>\n\t<xmx:35g6WwlzW8-cKxBPBHGHxdUO50Q9gdzlqvpO4YzK_iRvDd1QuwYFlw>\n\t<xmx:35g6WxZORIAy_v-LHPWLgMSLFRuSUci5-qOq2xhQUo0PYq0moQuaUw>\n\t<xmx:35g6W96ZD1ICCVynaDDodiN9RSKsQDpYwFKvfizK6HbdrDEhUI1ytw>\n\t<xmx:35g6WzDJiHw5usZUPVeJcdf2kLVfLWvVnJXrXaiL2-Ccc_BDreOKVg>\n\t<xmx:35g6W_Z6rv5t6QjDLwoXo1S6bGlQxF95w7bbDm0VFmJa9_6fVI83ZA>", "X-ME-Sender": "<xms:35g6W2Ovg1B0BP6z-zt7J6ILO6mB00DWHuL14NBsob1ZwUBIVzQGeg>", "From": "Thomas Monjalon <thomas@monjalon.net>", "To": "ferruh.yigit@intel.com, arybchenko@solarflare.com, shahafs@mellanox.com", "Cc": "dev@dpdk.org, ravi1.kumar@amd.com, rasesh.mody@cavium.com,\n\tmaxime.coquelin@redhat.com", "Date": "Mon, 2 Jul 2018 23:27:46 +0200", "Message-Id": "<20180702212750.16758-2-thomas@monjalon.net>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20180702212750.16758-1-thomas@monjalon.net>", "References": "<1571938.317irMz1sZ@xps>\n\t<20180702212750.16758-1-thomas@monjalon.net>", "Subject": "[dpdk-dev] [PATCH v2 1/5] doc: remove code from KNI example guide", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "The example code is showing how to use KNI, and can be found in\n\texamples/kni/\nThe documentation guide for this example is explaining the code\nto ease the understanding of the example.\nAnd inside this documentation, there are a lot of examples code\nwhich are copy/pasted. It is really too much and hard to maintain.\n\nThe code inside this documentation is replaced by the name\nof the functions.\n\nSigned-off-by: Thomas Monjalon <thomas@monjalon.net>\n---\n .../sample_app_ug/kernel_nic_interface.rst | 353 +-----------------\n 1 file changed, 8 insertions(+), 345 deletions(-)", "diff": "diff --git a/doc/guides/sample_app_ug/kernel_nic_interface.rst b/doc/guides/sample_app_ug/kernel_nic_interface.rst\nindex fc110997f..1b3ee9a5e 100644\n--- a/doc/guides/sample_app_ug/kernel_nic_interface.rst\n+++ b/doc/guides/sample_app_ug/kernel_nic_interface.rst\n@@ -202,74 +202,8 @@ Setup of mbuf pool, driver and queues is similar to the setup done in the :doc:`\n In addition, one or more kernel NIC interfaces are allocated for each\n of the configured ports according to the command line parameters.\n \n-The code for allocating the kernel NIC interfaces for a specific port is as follows:\n-\n-.. code-block:: c\n-\n- static int\n- kni_alloc(uint16_t port_id)\n- {\n- uint8_t i;\n- struct rte_kni *kni;\n- struct rte_kni_conf conf;\n- struct kni_port_params **params = kni_port_params_array;\n-\n- if (port_id >= RTE_MAX_ETHPORTS || !params[port_id])\n- return -1;\n-\n- params[port_id]->nb_kni = params[port_id]->nb_lcore_k ? params[port_id]->nb_lcore_k : 1;\n-\n- for (i = 0; i < params[port_id]->nb_kni; i++) {\n-\n- /* Clear conf at first */\n-\n- memset(&conf, 0, sizeof(conf));\n- if (params[port_id]->nb_lcore_k) {\n- snprintf(conf.name, RTE_KNI_NAMESIZE, \"vEth%u_%u\", port_id, i);\n- conf.core_id = params[port_id]->lcore_k[i];\n- conf.force_bind = 1;\n- } else\n- snprintf(conf.name, RTE_KNI_NAMESIZE, \"vEth%u\", port_id);\n- conf.group_id = (uint16_t)port_id;\n- conf.mbuf_size = MAX_PACKET_SZ;\n-\n- /*\n- * The first KNI device associated to a port\n- * is the master, for multiple kernel thread\n- * environment.\n- */\n-\n- if (i == 0) {\n- struct rte_kni_ops ops;\n- struct rte_eth_dev_info dev_info;\n-\n- memset(&dev_info, 0, sizeof(dev_info)); rte_eth_dev_info_get(port_id, &dev_info);\n-\n- conf.addr = dev_info.pci_dev->addr;\n- conf.id = dev_info.pci_dev->id;\n-\n- /* Get the interface default mac address */\n- rte_eth_macaddr_get(port_id, (struct ether_addr *)&conf.mac_addr);\n-\n- memset(&ops, 0, sizeof(ops));\n-\n- ops.port_id = port_id;\n- ops.change_mtu = kni_change_mtu;\n- ops.config_network_if = kni_config_network_interface;\n- ops.config_mac_address = kni_config_mac_address;\n-\n- kni = rte_kni_alloc(pktmbuf_pool, &conf, &ops);\n- } else\n- kni = rte_kni_alloc(pktmbuf_pool, &conf, NULL);\n-\n- if (!kni)\n- rte_exit(EXIT_FAILURE, \"Fail to create kni for \"\n- \"port: %d\\n\", port_id);\n-\n- params[port_id]->kni[i] = kni;\n- }\n- return 0;\n- }\n+The code for allocating the kernel NIC interfaces for a specific port is\n+in the function ``kni_alloc``.\n \n The other step in the initialization process that is unique to this sample application\n is the association of each port with lcores for RX, TX and kernel threads.\n@@ -280,105 +214,8 @@ is the association of each port with lcores for RX, TX and kernel threads.\n \n * Other lcores for pinning the kernel threads on one by one\n \n-This is done by using the`kni_port_params_array[]` array, which is indexed by the port ID.\n-The code is as follows:\n-\n-.. code-block:: console\n-\n- static int\n- parse_config(const char *arg)\n- {\n- const char *p, *p0 = arg;\n- char s[256], *end;\n- unsigned size;\n- enum fieldnames {\n- FLD_PORT = 0,\n- FLD_LCORE_RX,\n- FLD_LCORE_TX,\n- _NUM_FLD = KNI_MAX_KTHREAD + 3,\n- };\n- int i, j, nb_token;\n- char *str_fld[_NUM_FLD];\n- unsigned long int_fld[_NUM_FLD];\n- uint16_t port_id, nb_kni_port_params = 0;\n-\n- memset(&kni_port_params_array, 0, sizeof(kni_port_params_array));\n-\n- while (((p = strchr(p0, '(')) != NULL) && nb_kni_port_params < RTE_MAX_ETHPORTS) {\n- p++;\n- if ((p0 = strchr(p, ')')) == NULL)\n- goto fail;\n-\n- size = p0 - p;\n-\n- if (size >= sizeof(s)) {\n- printf(\"Invalid config parameters\\n\");\n- goto fail;\n- }\n-\n- snprintf(s, sizeof(s), \"%.*s\", size, p);\n- nb_token = rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',');\n-\n- if (nb_token <= FLD_LCORE_TX) {\n- printf(\"Invalid config parameters\\n\");\n- goto fail;\n- }\n-\n- for (i = 0; i < nb_token; i++) {\n- errno = 0;\n- int_fld[i] = strtoul(str_fld[i], &end, 0);\n- if (errno != 0 || end == str_fld[i]) {\n- printf(\"Invalid config parameters\\n\");\n- goto fail;\n- }\n- }\n-\n- i = 0;\n- port_id = (uint8_t)int_fld[i++];\n-\n- if (port_id >= RTE_MAX_ETHPORTS) {\n- printf(\"Port ID %u could not exceed the maximum %u\\n\", port_id, RTE_MAX_ETHPORTS);\n- goto fail;\n- }\n-\n- if (kni_port_params_array[port_id]) {\n- printf(\"Port %u has been configured\\n\", port_id);\n- goto fail;\n- }\n-\n- kni_port_params_array[port_id] = (struct kni_port_params*)rte_zmalloc(\"KNI_port_params\", sizeof(struct kni_port_params), RTE_CACHE_LINE_SIZE);\n- kni_port_params_array[port_id]->port_id = port_id;\n- kni_port_params_array[port_id]->lcore_rx = (uint8_t)int_fld[i++];\n- kni_port_params_array[port_id]->lcore_tx = (uint8_t)int_fld[i++];\n-\n- if (kni_port_params_array[port_id]->lcore_rx >= RTE_MAX_LCORE || kni_port_params_array[port_id]->lcore_tx >= RTE_MAX_LCORE) {\n- printf(\"lcore_rx %u or lcore_tx %u ID could not \"\n- \"exceed the maximum %u\\n\",\n- kni_port_params_array[port_id]->lcore_rx, kni_port_params_array[port_id]->lcore_tx, RTE_MAX_LCORE);\n- goto fail;\n- }\n-\n- for (j = 0; i < nb_token && j < KNI_MAX_KTHREAD; i++, j++)\n- kni_port_params_array[port_id]->lcore_k[j] = (uint8_t)int_fld[i];\n- kni_port_params_array[port_id]->nb_lcore_k = j;\n- }\n-\n- print_config();\n-\n- return 0;\n-\n- fail:\n-\n- for (i = 0; i < RTE_MAX_ETHPORTS; i++) {\n- if (kni_port_params_array[i]) {\n- rte_free(kni_port_params_array[i]);\n- kni_port_params_array[i] = NULL;\n- }\n- }\n-\n- return -1;\n-\n- }\n+This is done by using the ``kni_port_params_array[]`` array, which is indexed by the port ID.\n+The code is in the function ``parse_config``.\n \n Packet Forwarding\n ~~~~~~~~~~~~~~~~~\n@@ -387,99 +224,18 @@ After the initialization steps are completed, the main_loop() function is run on\n This function first checks the lcore_id against the user provided lcore_rx and lcore_tx\n to see if this lcore is reading from or writing to kernel NIC interfaces.\n \n-For the case that reads from a NIC port and writes to the kernel NIC interfaces,\n+For the case that reads from a NIC port and writes to the kernel NIC interfaces (``kni_ingress``),\n the packet reception is the same as in L2 Forwarding sample application\n (see :ref:`l2_fwd_app_rx_tx_packets`).\n The packet transmission is done by sending mbufs into the kernel NIC interfaces by rte_kni_tx_burst().\n The KNI library automatically frees the mbufs after the kernel successfully copied the mbufs.\n \n-.. code-block:: c\n-\n- /**\n- * Interface to burst rx and enqueue mbufs into rx_q\n- */\n-\n- static void\n- kni_ingress(struct kni_port_params *p)\n- {\n- uint8_t i, nb_kni, port_id;\n- unsigned nb_rx, num;\n- struct rte_mbuf *pkts_burst[PKT_BURST_SZ];\n-\n- if (p == NULL)\n- return;\n-\n- nb_kni = p->nb_kni;\n- port_id = p->port_id;\n-\n- for (i = 0; i < nb_kni; i++) {\n- /* Burst rx from eth */\n- nb_rx = rte_eth_rx_burst(port_id, 0, pkts_burst, PKT_BURST_SZ);\n- if (unlikely(nb_rx > PKT_BURST_SZ)) {\n- RTE_LOG(ERR, APP, \"Error receiving from eth\\n\");\n- return;\n- }\n-\n- /* Burst tx to kni */\n- num = rte_kni_tx_burst(p->kni[i], pkts_burst, nb_rx);\n- kni_stats[port_id].rx_packets += num;\n- rte_kni_handle_request(p->kni[i]);\n-\n- if (unlikely(num < nb_rx)) {\n- /* Free mbufs not tx to kni interface */\n- kni_burst_free_mbufs(&pkts_burst[num], nb_rx - num);\n- kni_stats[port_id].rx_dropped += nb_rx - num;\n- }\n- }\n- }\n-\n-For the other case that reads from kernel NIC interfaces and writes to a physical NIC port, packets are retrieved by reading\n-mbufs from kernel NIC interfaces by `rte_kni_rx_burst()`.\n+For the other case that reads from kernel NIC interfaces\n+and writes to a physical NIC port (``kni_egress``),\n+packets are retrieved by reading mbufs from kernel NIC interfaces by ``rte_kni_rx_burst()``.\n The packet transmission is the same as in the L2 Forwarding sample application\n (see :ref:`l2_fwd_app_rx_tx_packets`).\n \n-.. code-block:: c\n-\n- /**\n- * Interface to dequeue mbufs from tx_q and burst tx\n- */\n-\n- static void\n-\n- kni_egress(struct kni_port_params *p)\n- {\n- uint8_t i, nb_kni, port_id;\n- unsigned nb_tx, num;\n- struct rte_mbuf *pkts_burst[PKT_BURST_SZ];\n-\n- if (p == NULL)\n- return;\n-\n- nb_kni = p->nb_kni;\n- port_id = p->port_id;\n-\n- for (i = 0; i < nb_kni; i++) {\n- /* Burst rx from kni */\n- num = rte_kni_rx_burst(p->kni[i], pkts_burst, PKT_BURST_SZ);\n- if (unlikely(num > PKT_BURST_SZ)) {\n- RTE_LOG(ERR, APP, \"Error receiving from KNI\\n\");\n- return;\n- }\n-\n- /* Burst tx to eth */\n-\n- nb_tx = rte_eth_tx_burst(port_id, 0, pkts_burst, (uint16_t)num);\n-\n- kni_stats[port_id].tx_packets += nb_tx;\n-\n- if (unlikely(nb_tx < num)) {\n- /* Free mbufs not tx to NIC */\n- kni_burst_free_mbufs(&pkts_burst[nb_tx], num - nb_tx);\n- kni_stats[port_id].tx_dropped += num - nb_tx;\n- }\n- }\n- }\n-\n Callbacks for Kernel Requests\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \n@@ -492,96 +248,3 @@ Application may choose to not implement following callbacks:\n \n - ``config_mac_address``\n - ``config_promiscusity``\n-\n-\n-.. code-block:: c\n-\n- static struct rte_kni_ops kni_ops = {\n- .change_mtu = kni_change_mtu,\n- .config_network_if = kni_config_network_interface,\n- .config_mac_address = kni_config_mac_address,\n- .config_promiscusity = kni_config_promiscusity,\n- };\n-\n- /* Callback for request of changing MTU */\n-\n- static int\n- kni_change_mtu(uint16_t port_id, unsigned new_mtu)\n- {\n- int ret;\n- struct rte_eth_conf conf;\n-\n- RTE_LOG(INFO, APP, \"Change MTU of port %d to %u\\n\", port_id, new_mtu);\n-\n- /* Stop specific port */\n-\n- rte_eth_dev_stop(port_id);\n-\n- memcpy(&conf, &port_conf, sizeof(conf));\n-\n- /* Set new MTU */\n-\n- if (new_mtu > ETHER_MAX_LEN)\n- conf.rxmode.jumbo_frame = 1;\n- else\n- conf.rxmode.jumbo_frame = 0;\n-\n- /* mtu + length of header + length of FCS = max pkt length */\n-\n- conf.rxmode.max_rx_pkt_len = new_mtu + KNI_ENET_HEADER_SIZE + KNI_ENET_FCS_SIZE;\n-\n- ret = rte_eth_dev_configure(port_id, 1, 1, &conf);\n- if (ret < 0) {\n- RTE_LOG(ERR, APP, \"Fail to reconfigure port %d\\n\", port_id);\n- return ret;\n- }\n-\n- /* Restart specific port */\n-\n- ret = rte_eth_dev_start(port_id);\n- if (ret < 0) {\n- RTE_LOG(ERR, APP, \"Fail to restart port %d\\n\", port_id);\n- return ret;\n- }\n-\n- return 0;\n- }\n-\n- /* Callback for request of configuring network interface up/down */\n-\n- static int\n- kni_config_network_interface(uint16_t port_id, uint8_t if_up)\n- {\n- int ret = 0;\n-\n- RTE_LOG(INFO, APP, \"Configure network interface of %d %s\\n\",\n-\n- port_id, if_up ? \"up\" : \"down\");\n-\n- if (if_up != 0) {\n- /* Configure network interface up */\n- rte_eth_dev_stop(port_id);\n- ret = rte_eth_dev_start(port_id);\n- } else /* Configure network interface down */\n- rte_eth_dev_stop(port_id);\n-\n- if (ret < 0)\n- RTE_LOG(ERR, APP, \"Failed to start port %d\\n\", port_id);\n- return ret;\n- }\n-\n- /* Callback for request of configuring device mac address */\n-\n- static int\n- kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])\n- {\n- .....\n- }\n-\n- /* Callback for request of configuring promiscuous mode */\n-\n- static int\n- kni_config_promiscusity(uint16_t port_id, uint8_t to_on)\n- {\n- .....\n- }\n", "prefixes": [ "v2", "1/5" ] }{ "id": 42130, "url": "