Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/59419/?format=api
http://patches.dpdk.org/api/patches/59419/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190919092603.5485-5-pbhagavatula@marvell.com/", "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": "<20190919092603.5485-5-pbhagavatula@marvell.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190919092603.5485-5-pbhagavatula@marvell.com", "date": "2019-09-19T09:25:58", "name": "[v2,04/10] examples/l2fwd-event: add eth port setup for eventdev", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "b95c5f58f3b52a1a7dd4102a20b0c0b3a92ac8fb", "submitter": { "id": 1183, "url": "http://patches.dpdk.org/api/people/1183/?format=api", "name": "Pavan Nikhilesh Bhagavatula", "email": "pbhagavatula@marvell.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190919092603.5485-5-pbhagavatula@marvell.com/mbox/", "series": [ { "id": 6446, "url": "http://patches.dpdk.org/api/series/6446/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6446", "date": "2019-09-19T09:25:54", "name": "example/l2fwd-event: introduce l2fwd-event example", "version": 2, "mbox": "http://patches.dpdk.org/series/6446/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/59419/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/59419/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 715891ECED;\n\tThu, 19 Sep 2019 11:26:27 +0200 (CEST)", "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n\t[67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 1F7341EC62\n\tfor <dev@dpdk.org>; Thu, 19 Sep 2019 11:26:26 +0200 (CEST)", "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n\tby mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n\tx8J9PaXS027666; Thu, 19 Sep 2019 02:26:25 -0700", "from sc-exch04.marvell.com ([199.233.58.184])\n\tby mx0b-0016f401.pphosted.com with ESMTP id 2v3vcfj5wn-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tThu, 19 Sep 2019 02:26:25 -0700", "from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com\n\t(10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tThu, 19 Sep 2019 02:26:23 -0700", "from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com\n\t(10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend\n\tTransport; Thu, 19 Sep 2019 02:26:23 -0700", "from BG-LT7430.marvell.com (unknown [10.28.17.12])\n\tby maili.marvell.com (Postfix) with ESMTP id 6D7E23F7040;\n\tThu, 19 Sep 2019 02:26:20 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n\th=from : to : cc :\n\tsubject : date : message-id : in-reply-to : references : mime-version\n\t: content-transfer-encoding : content-type; s=pfpt0818;\n\tbh=hkrxcdjbsvQcN3JwllrzShWdQKDvJevKl7mKO8SKVR0=;\n\tb=F3kn4TmBiT1zrYgO5iV1cXh4xiPRXKVFFTjxRqs0ouXzFnQLT/J4Ot0jaWQwfjqgQet7\n\tcaaFR07AiEju84EmlTG2vVlJvOYk/njs2UBUZjQch+Ds+AE+nDMpM4+C8zRq3kMtsEla\n\twYGq7ngjBKiOJrhxXTyZy1SSA2oSUDounD5AQhvBYmk+0GSwkFHnTpgfQXcHhCw6Kufq\n\t2IkqzfFE8uGU44TkSXQDTcrdobclTBKAiTpTbS6U4+NmOjLTJ3ugmH7l47EZsmtfu0ra\n\tB0WFyBdDqFEoHHAGcT1pxEGcJ728RFSaqxWrSmKqaJlkaTa95C79jERHU/2nutFTd6dF\n\txw== ", "From": "<pbhagavatula@marvell.com>", "To": "<jerinj@marvell.com>, <bruce.richardson@intel.com>, <akhil.goyal@nxp.com>,\n\tMarko Kovacevic <marko.kovacevic@intel.com>,\n\tOri Kam <orika@mellanox.com>, Radu Nicolau <radu.nicolau@intel.com>, \n\tTomasz Kantecki <tomasz.kantecki@intel.com>,\n\tSunil Kumar Kori <skori@marvell.com>, \"Pavan\n\tNikhilesh\" <pbhagavatula@marvell.com>", "CC": "<dev@dpdk.org>", "Date": "Thu, 19 Sep 2019 14:55:58 +0530", "Message-ID": "<20190919092603.5485-5-pbhagavatula@marvell.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190919092603.5485-1-pbhagavatula@marvell.com>", "References": "<20190919092603.5485-1-pbhagavatula@marvell.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.70,1.0.8\n\tdefinitions=2019-09-19_03:2019-09-18,2019-09-19 signatures=0", "Subject": "[dpdk-dev] [PATCH v2 04/10] examples/l2fwd-event: add eth port\n\tsetup for eventdev", "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": "From: Sunil Kumar Kori <skori@marvell.com>\n\nAdd ethernet port Rx/Tx queue setup for event device which are later\nused for setting up event eth Rx/Tx adapters.\n\nSigned-off-by: Sunil Kumar Kori <skori@marvell.com>\n---\n examples/l2fwd-event/l2fwd_eventdev.c | 114 ++++++++++++++++++++++++++\n examples/l2fwd-event/l2fwd_eventdev.h | 1 +\n examples/l2fwd-event/main.c | 17 ++++\n 3 files changed, 132 insertions(+)", "diff": "diff --git a/examples/l2fwd-event/l2fwd_eventdev.c b/examples/l2fwd-event/l2fwd_eventdev.c\nindex df76f1c1f..0d0d3b8b9 100644\n--- a/examples/l2fwd-event/l2fwd_eventdev.c\n+++ b/examples/l2fwd-event/l2fwd_eventdev.c\n@@ -18,6 +18,14 @@\n #include \"l2fwd_common.h\"\n #include \"l2fwd_eventdev.h\"\n \n+static void\n+print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr)\n+{\n+\tchar buf[RTE_ETHER_ADDR_FMT_SIZE];\n+\trte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, eth_addr);\n+\tprintf(\"%s%s\", name, buf);\n+}\n+\n static void\n parse_mode(const char *optarg)\n {\n@@ -76,6 +84,108 @@ parse_eventdev_args(char **argv, int argc)\n \treturn 0;\n }\n \n+static void\n+eth_dev_port_setup(uint16_t ethdev_count __rte_unused)\n+{\n+\tstruct eventdev_resources *eventdev_rsrc = get_eventdev_rsrc();\n+\tstatic struct rte_eth_conf port_config = {\n+\t\t.rxmode = {\n+\t\t\t.mq_mode = ETH_MQ_RX_RSS,\n+\t\t\t.max_rx_pkt_len = RTE_ETHER_MAX_LEN,\n+\t\t\t.split_hdr_size = 0,\n+\t\t\t.offloads = DEV_RX_OFFLOAD_CHECKSUM\n+\t\t},\n+\t\t.rx_adv_conf = {\n+\t\t\t.rss_conf = {\n+\t\t\t\t.rss_key = NULL,\n+\t\t\t\t.rss_hf = ETH_RSS_IP,\n+\t\t\t}\n+\t\t},\n+\t\t.txmode = {\n+\t\t\t.mq_mode = ETH_MQ_TX_NONE,\n+\t\t}\n+\t};\n+\tstruct rte_eth_conf local_port_conf;\n+\tstruct rte_eth_dev_info dev_info;\n+\tstruct rte_eth_txconf txconf;\n+\tstruct rte_eth_rxconf rxconf;\n+\tuint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;\n+\tuint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;\n+\tuint16_t port_id;\n+\tint32_t ret;\n+\n+\t/* initialize all ports */\n+\tRTE_ETH_FOREACH_DEV(port_id) {\n+\t\tlocal_port_conf = port_config;\n+\t\t/* skip ports that are not enabled */\n+\t\tif ((eventdev_rsrc->port_mask & (1 << port_id)) == 0) {\n+\t\t\tprintf(\"\\nSkipping disabled port %d\\n\", port_id);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* init port */\n+\t\tprintf(\"Initializing port %d ... \", port_id);\n+\t\tfflush(stdout);\n+\t\trte_eth_dev_info_get(port_id, &dev_info);\n+\t\tif (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)\n+\t\t\tlocal_port_conf.txmode.offloads |=\n+\t\t\t\t\t\tDEV_TX_OFFLOAD_MBUF_FAST_FREE;\n+\n+\t\tlocal_port_conf.rx_adv_conf.rss_conf.rss_hf &=\n+\t\t\t\t\t\tdev_info.flow_type_rss_offloads;\n+\t\tif (local_port_conf.rx_adv_conf.rss_conf.rss_hf !=\n+\t\t\t\tport_config.rx_adv_conf.rss_conf.rss_hf) {\n+\t\t\tprintf(\"Port %u modified RSS hash function \"\n+\t\t\t \"based on hardware support,\"\n+\t\t\t \"requested:%#\"PRIx64\" configured:%#\"PRIx64\"\\n\",\n+\t\t\t port_id,\n+\t\t\t port_config.rx_adv_conf.rss_conf.rss_hf,\n+\t\t\t local_port_conf.rx_adv_conf.rss_conf.rss_hf);\n+\t\t}\n+\n+\t\tret = rte_eth_dev_configure(port_id, 1, 1, &local_port_conf);\n+\t\tif (ret < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"Cannot configure device: err=%d, port=%d\\n\",\n+\t\t\t\t ret, port_id);\n+\n+\t\tret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd,\n+\t\t\t\t\t\t &nb_txd);\n+\t\tif (ret < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"Cannot adjust number of descriptors: err=%d, \"\n+\t\t\t\t \"port=%d\\n\", ret, port_id);\n+\n+\t\trte_eth_macaddr_get(port_id,\n+\t\t\t\t &eventdev_rsrc->ports_eth_addr[port_id]);\n+\t\tprint_ethaddr(\" Address:\",\n+\t\t\t &eventdev_rsrc->ports_eth_addr[port_id]);\n+\t\tprintf(\"\\n\");\n+\n+\n+\t\t/* init one Rx queue per port */\n+\t\trxconf = dev_info.default_rxconf;\n+\t\trxconf.offloads = local_port_conf.rxmode.offloads;\n+\t\tret = rte_eth_rx_queue_setup(port_id, 0, nb_rxd, 0, &rxconf,\n+\t\t\t\t\t eventdev_rsrc->pkt_pool);\n+\t\tif (ret < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"rte_eth_rx_queue_setup: err=%d, \"\n+\t\t\t\t \"port=%d\\n\", ret, port_id);\n+\n+\t\t/* init one Tx queue per port */\n+\t\ttxconf = dev_info.default_txconf;\n+\t\ttxconf.offloads = local_port_conf.txmode.offloads;\n+\t\tret = rte_eth_tx_queue_setup(port_id, 0, nb_txd, 0, &txconf);\n+\t\tif (ret < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"rte_eth_tx_queue_setup: err=%d, \"\n+\t\t\t\t \"port=%d\\n\", ret, port_id);\n+\n+\t\trte_eth_promiscuous_enable(port_id);\n+\t}\n+}\n+\n static void\n eventdev_capability_setup(void)\n {\n@@ -105,6 +215,7 @@ void\n eventdev_resource_setup(void)\n {\n \tstruct eventdev_resources *eventdev_rsrc = get_eventdev_rsrc();\n+\tuint16_t ethdev_count = rte_eth_dev_count_avail();\n \tuint32_t service_id;\n \tint32_t ret;\n \n@@ -119,6 +230,9 @@ eventdev_resource_setup(void)\n \t/* Setup eventdev capability callbacks */\n \teventdev_capability_setup();\n \n+\t/* Ethernet device configuration */\n+\teth_dev_port_setup(ethdev_count);\n+\n \t/* Start event device service */\n \tret = rte_event_dev_service_id_get(eventdev_rsrc->event_d_id,\n \t\t\t&service_id);\ndiff --git a/examples/l2fwd-event/l2fwd_eventdev.h b/examples/l2fwd-event/l2fwd_eventdev.h\nindex 717f688ce..cc0bdd1ad 100644\n--- a/examples/l2fwd-event/l2fwd_eventdev.h\n+++ b/examples/l2fwd-event/l2fwd_eventdev.h\n@@ -51,6 +51,7 @@ struct eventdev_resources {\n \tuint8_t enabled;\n \tuint8_t nb_args;\n \tchar **args;\n+\tstruct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];\n };\n \n static inline struct eventdev_resources *\ndiff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c\nindex 661f0833f..f24bdd4a4 100644\n--- a/examples/l2fwd-event/main.c\n+++ b/examples/l2fwd-event/main.c\n@@ -602,6 +602,22 @@ main(int argc, char **argv)\n \n \t/* Configure eventdev parameters if user has requested */\n \teventdev_resource_setup();\n+\tif (eventdev_rsrc->enabled) {\n+\t\t/* All settings are done. Now enable eth devices */\n+\t\tRTE_ETH_FOREACH_DEV(portid) {\n+\t\t\t/* skip ports that are not enabled */\n+\t\t\tif ((l2fwd_enabled_port_mask & (1 << portid)) == 0)\n+\t\t\t\tcontinue;\n+\n+\t\t\tret = rte_eth_dev_start(portid);\n+\t\t\tif (ret < 0)\n+\t\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t \"rte_eth_dev_start:err=%d, port=%u\\n\",\n+\t\t\t\t\t ret, portid);\n+\t\t}\n+\n+\t\tgoto skip_port_config;\n+\t}\n \n \t/* Initialize the port/queue configuration of each logical core */\n \tRTE_ETH_FOREACH_DEV(portid) {\n@@ -733,6 +749,7 @@ main(int argc, char **argv)\n \t\t\t\"All available ports are disabled. Please set portmask.\\n\");\n \t}\n \n+skip_port_config:\n \tcheck_all_ports_link_status(l2fwd_enabled_port_mask);\n \n \tret = 0;\n", "prefixes": [ "v2", "04/10" ] }{ "id": 59419, "url": "