Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/48202/?format=api
http://patches.dpdk.org/api/patches/48202/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1542709592-215007-3-git-send-email-tiago.lam@intel.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": "<1542709592-215007-3-git-send-email-tiago.lam@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1542709592-215007-3-git-send-email-tiago.lam@intel.com", "date": "2018-11-20T10:26:31", "name": "[v2,3/3] net/af_packet: get 'framesz' from the iface's MTU", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "83a53e8195f9ad20b03f43b4bbbc5c91a92ab8bf", "submitter": { "id": 1166, "url": "http://patches.dpdk.org/api/people/1166/?format=api", "name": "Lam, Tiago", "email": "tiago.lam@intel.com" }, "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/1542709592-215007-3-git-send-email-tiago.lam@intel.com/mbox/", "series": [ { "id": 2498, "url": "http://patches.dpdk.org/api/series/2498/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2498", "date": "2018-11-20T10:26:29", "name": "[v2,1/3] net/af_packet: set_mtu() decrements sockaddr twice", "version": 2, "mbox": "http://patches.dpdk.org/series/2498/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/48202/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/48202/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 19A485681;\n\tTue, 20 Nov 2018 11:26:54 +0100 (CET)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 54FC8322C\n\tfor <dev@dpdk.org>; Tue, 20 Nov 2018 11:26:50 +0100 (CET)", "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t20 Nov 2018 02:26:49 -0800", "from silpixa00399125.ir.intel.com ([10.237.223.34])\n\tby orsmga007.jf.intel.com with ESMTP; 20 Nov 2018 02:26:48 -0800" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.56,256,1539673200\"; d=\"scan'208\";a=\"90712036\"", "From": "Tiago Lam <tiago.lam@intel.com>", "To": "dev@dpdk.org", "Cc": "ferruh.yigit@intel.com, linville@tuxdriver.com,\n\tTiago Lam <tiago.lam@intel.com>", "Date": "Tue, 20 Nov 2018 10:26:31 +0000", "Message-Id": "<1542709592-215007-3-git-send-email-tiago.lam@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1542709592-215007-1-git-send-email-tiago.lam@intel.com>", "References": "<1542707697-175836-1-git-send-email-tiago.lam@intel.com>\n\t<1542709592-215007-1-git-send-email-tiago.lam@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 3/3] net/af_packet: get 'framesz' from the\n\tiface's MTU", "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": "Use the underlying MTU to calculate the framsize to be used for the mmap\nRINGs. This is to make it more flexible on deployments with different\nMTU requirements, instead of using a pre-defined value of 2048B.\n\nIf a 'framsz' option is provided, that value is used instead and the MTU\nof the underlying interface is ignored.\n\nSigned-off-by: Tiago Lam <tiago.lam@intel.com>\n---\n\nv2: Fix checkpatches.sh and check-git-log.sh warnings.\n\n---\n drivers/net/af_packet/rte_eth_af_packet.c | 33 ++++++++++++++++++++++++++-----\n 1 file changed, 28 insertions(+), 5 deletions(-)", "diff": "diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c\nindex 8d749a2..5549211 100644\n--- a/drivers/net/af_packet/rte_eth_af_packet.c\n+++ b/drivers/net/af_packet/rte_eth_af_packet.c\n@@ -788,7 +788,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev,\n \tunsigned k_idx;\n \tunsigned int blockcount;\n \tunsigned int blocksize = DFLT_BLOCK_SIZE;\n-\tunsigned int framesize = DFLT_FRAME_SIZE;\n+\tunsigned int framesize = 0;\n \tunsigned int framecount = DFLT_FRAME_COUNT;\n \tunsigned int qpairs = 1;\n \tunsigned int qdisc_bypass = 1;\n@@ -877,17 +877,40 @@ rte_eth_from_packet(struct rte_vdev_device *dev,\n \t}\n \n \tifnamelen = strlen(ifname);\n-\tif (ifnamelen >= sizeof(ifr.ifr_name)) {\n+\tif (ifnamelen < sizeof(ifr.ifr_name)) {\n+\t\tmemcpy(ifr.ifr_name, ifname, ifnamelen);\n+\t\tifr.ifr_name[ifnamelen] = '\\0';\n+\t} else {\n \t\tRTE_LOG(ERR, PMD,\n \t\t\t\"%s: I/F name too long (%s)\\n\",\n \t\t\tname, ifname);\n \t\treturn -1;\n \t}\n \n+\t/*\n+\t * Base framesize on the MTU of the underlying interface, if no\n+\t * 'framesz' option is given\n+\t */\n+\tif (!framesize) {\n+\t\tif (ioctl(*sockfd, SIOCGIFMTU, &ifr) == -1) {\n+\t\t\tRTE_LOG(ERR, PMD,\n+\t\t\t\t\"%s: ioctl failed (SIOCGIFMTU)\",\n+\t\t\t\tname);\n+\t\t\tframesize = DFLT_FRAME_SIZE;\n+\t\t} else {\n+\t\t\tframesize = ifr.ifr_mtu;\n+\t\t\t/*\n+\t\t\t * Align to TPACKET_ALIGNMENT and add TPACKET2_HDRLEN,\n+\t\t\t * to account for the extra needed space\n+\t\t\t */\n+\t\t\tframesize = TPACKET_ALIGN(framesize + TPACKET2_HDRLEN);\n+\t\t}\n+\t}\n+\n \tif (framesize > blocksize) {\n-\t\tPMD_LOG(ERR,\n-\t\t\t\"%s: AF_PACKET MMAP frame size exceeds block size!\",\n-\t\t name);\n+\t\tRTE_LOG(ERR, PMD,\n+\t\t\t\"%s: AF_PACKET MMAP frame size (%u) exceeds block size (%u)!\",\n+\t\t\tname, framesize, blocksize);\n \t\treturn -1;\n \t}\n \n", "prefixes": [ "v2", "3/3" ] }{ "id": 48202, "url": "