From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0079.outbound.protection.outlook.com [104.47.32.79]) by dpdk.org (Postfix) with ESMTP id 3C7A02BD1 for ; Fri, 7 Apr 2017 13:02:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=pX7CUS0m+HtoY6ixZloW7zK4hpZpB9YaVsHiZnsO6Xk=; b=FwAOpCxf9EU1Kfi62bo0/RNW9EvY+fAmKyeUI/gHP4Z7VzJQaSEh9ajBt6IOyZurLpm9R53ZJtHa7DtgVKmO5jJLXB0W2KN0UfOi18mWmjO4eSIfJMEsz+Gf00zdYOXC81EoyIlFzA6LvwRQaIXnXo5V+gtcS0ef/G9AS9R3TPM= Authentication-Results: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from b.semihalf.local (31.172.191.173) by SN2PR0701MB1039.namprd07.prod.outlook.com (10.160.58.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Fri, 7 Apr 2017 11:02:32 +0000 From: Andriy Berestovskyy To: Thomas Monjalon Cc: dev@dpdk.org Date: Fri, 7 Apr 2017 13:02:05 +0200 Message-Id: <1491562925-27247-1-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490288768-8114-1-git-send-email-Andriy.Berestovskyy@cavium.com> References: <1490288768-8114-1-git-send-email-Andriy.Berestovskyy@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: HE1PR0202CA0006.eurprd02.prod.outlook.com (10.168.182.16) To SN2PR0701MB1039.namprd07.prod.outlook.com (10.160.58.146) X-MS-Office365-Filtering-Correlation-Id: 5c590ffd-6111-413a-500e-08d47da59768 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:SN2PR0701MB1039; X-Microsoft-Exchange-Diagnostics: 1; SN2PR0701MB1039; 3:QEmK2PxUcL7h33eCufGxPP0USHUdgnROZ2fvfQl1AfVxaLx5r1z1BAUuR23upCUryFSuejAiicWHUMA1vUP3E8EqMnatdokpLxTYuZQMV7dgx5qYN1TB8ZZ5GH0o6x6sw3vbAXAuqItSVy51LoyG2mDUeZzAVDvLROAd2RMLx2kCpBRPIONNbTD0bVY3CdCxl/cv7Xmb9iSs/NbGxPHsnq/8WXMOTZUIWg7I8plkazrfdd/0ZyBvsbrH12SmbQQo/hdOScUaLPKFMOIdBIWgd3AORqNGvl6xAYQzUBDUQtQ3hU16S8iSZ9lK8yKqCr98043h+29UZHrQS47PRCMOhw==; 25:GbFOfQX+tpIOpSB3kEtLaqeX+77MXN23BVO/NmWyZITrqen0Qm2sUwK1t/TrgNYIPbEGNaGbxljFNUwYqEb0STLvlECAwISGLPmBRwJ669xemClqQ4AhxK0wFEfU91cTUWZZhjL95WgCWu0R1w5245ZxegN9ebPyDjB32QrCDogGv/M5EWsfjegytJ8NnpB3/TYfucEesUvKdO1xbIhyK+Xjagcjsyu0Oh8884w+Bmxq9LPM6FUsRtLWL1kV77OMfXrYxL/+5ptytYkx/zUUXJOhfccjs0zXRvtnwHsvvZpb5q46tLVBKI/ebjh857mY7vZnYn/4EMl/O72XH6tKbuiinYh0cgk1H53OSp8gkV9YcatmwsjLCIZbNoRiwwPmJEP6a+87CgWVdownaN2GM3VmTh6rnk/UwBdV7eEZWew6uzZk4U+KBHcGSfcbeiDWe6Bx4xd5mpS/3M3pNQDrUQ== X-Microsoft-Exchange-Diagnostics: 1; SN2PR0701MB1039; 31:K2nDvi21aJzXwZktIDA8kiVkMmtGUd0YjWl8PUMTlCiY7AKa4wH2eyez0go7v67uLIWxrQh1rJFp6J0+o3KJpAdNGm8NH7INrHWl7fbm24nhEB/wykar4ARaqyCHod40F+pCCFVh9/FDM+crMsqbjhZcGoTiaQ9bSIseJfQcd1QZBbEEtTXSoSRUGU7ijOjF8jEyMGdsfuwATYT+EgQUo1fjswRj6CXAca/lsyTQJbEnvpPsLQKrCCiYjNN6fzlyyISe7czVsqwvkjo1uLgRs+GG9xY2UxYD0wkTBSFZxhw=; 20:KA8BiwHjmDvuWddkQ29N1TV8G+CgUwcSwTsLGi0qdq9A0fjJps2ZrNCz2Bgt+EyUax0ROEt6e5wsLPL1J+86erHPVRGlXg+q8vTqOZI7nq0D3fSM7gD9qtjChm3eTR3BAId5z9tVyiAwqjrUpwwM8+1gER4+Zg1v5X0m/0OkijreUZbn0/rCZ0rarE2Dx6bNqMExeHjMAypj8GyPaAgVYP6xkOnNZyG60G/njbafPMdCI+xKE5i447WIYhX6eRhtzvO/+EYLHsGK1DYlX5ZA9YkryCUX2KSrkbcxf/izHr0SMOj/KGuJk1iGcnQHYPv+Q7CMC76tNq07e+csQBV5TELkZhurb4UIZXc4Krh1Imf1RVoO63WV9RvGU4z7tSKsWBoI6sKBSb2bD97CjxcJtfDBNn/F7/AHlEsOlCOxdbcoTwz8X/6omx01gziAsziD4KjcjLlI/TSahoFItUvc3lZGBR3ErtorCrhFDLgqmZOMzx9S93FNI6QYyamRPRlYWiVFWTczyY5nIcg9IHGqzwkHOFEKv7FscVa2ys/gHaCH29eRNS7hPy6COxP9k0skBs9gb7xVpFLMnSs2IfRylGihtO6kGOrvF23NufQKWMw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3002001)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123564025)(20161123560025)(6072148); SRVR:SN2PR0701MB1039; BCL:0; PCL:0; RULEID:; SRVR:SN2PR0701MB1039; X-Microsoft-Exchange-Diagnostics: 1; SN2PR0701MB1039; 4:Unz5/fj28eYts0dD/2bpQ7IAUbmYWb8bY5EPloN9u3pS17QgIsZQgJjLVerh6R2Q2gqiiH/PVyCD60LykND4AHpxCS6x0wZFphyM3LQaSAIVRV3C8ADB6t4sohaf5jKgwTNOYnNxfNyrtDAXCp3sQw3a8L/N8FCvBZM2+C8MdmD+fsw83NzoFccU1rjEXdXLh8GLviKuEJvZveZ3QS+vAYzCtpTtqoPaAszRNa33MkMbuT+AM9Myfq7w7SsCgl/loziZTIEx5WPafRDkbMxcK46jbxOO9uoZzQIQXXMIwXVJFWOqQPtA67g0RETku3vUMJBPhYkGxPonTrZPXvWGjjsXLR6ngYUV4sBozT7C/ToGbiMwMC1DXy/TOy3eRA7BgA0vVFBQEqdizBcPN6NyxvC7IplqMHN1m+wWjYV+QL0ylKRu2Vgak3uvJfFlXZ+WO+ZBYJMPufLsBog6FdXou18TekURDR/I8kJUEoJBijYmQNWuyk/qqo3jd+cHk69o38mjjqrXbRw66Xpd6doMHf4COjpL619LycqRz+Mfsh8mD3pr9p6hgZ/dotfCgIZudsGC1ESA4xQbEVzIAJHW+3bJns7v1hDJKmCWBUlD9TN6NOznyW6mDuDnp3UEtoP/+W8obNeHeEqc5cipucg4Cj4646R5cac2L3KaD/nMwQtj7B5+K+JSeY3ptSM2G/4o X-Forefront-PRVS: 0270ED2845 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39850400002)(39410400002)(39450400003)(39400400002)(39840400002)(6486002)(48376002)(6116002)(3846002)(53936002)(8676002)(110136004)(38730400002)(81166006)(5003940100001)(42186005)(25786009)(50466002)(66066001)(189998001)(50226002)(4326008)(47776003)(2950100002)(42882006)(6916009)(6666003)(5660300001)(2906002)(6506006)(6512007)(50986999)(36756003)(76176999)(7736002)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR0701MB1039; H:b.semihalf.local; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR0701MB1039; 23:tzwQcl8TtUy7qFq3CBw9/H9+9w7EoWAoH3KS/AH?= =?us-ascii?Q?EH99js9D6QAavoyr6Aku0AnBUZqDlwyacmbc9FansADSRsmyGcuqn+mliC3v?= =?us-ascii?Q?4o77tnl3s5ifRaujGtCC+XmjoGrp8YYKff1l4CnYtbpG1pbw/EhkmMxURKBi?= =?us-ascii?Q?fbjT7A9Y1MIGRd54kDLjpptbRegnLGsfpWT95ZR9TYqJHlexMFleG+Gi+xax?= =?us-ascii?Q?P2MlQRaiZMw7zvXwQG9l6M7oDtHSMgkhLudZN32pFBCLWqwwzxDp8qK0uuZ3?= =?us-ascii?Q?3nQcB1nnRIjjh4IBpViDimpdKwJHw3o3NJZajrcCVkFPS6qcgL2T20h3DgK5?= =?us-ascii?Q?cG5CJ5U3wdvvSlHisaS5bV+t6DF4PVJlVS4IueX73PPL4eRO+VehGYievGZz?= =?us-ascii?Q?5uAiiKG0mLPV8wK2gWMImAVl+AnT5ctaMQHspjZfPoIb/+mDt/iUokHw5IAY?= =?us-ascii?Q?4dFLtjg69mza3pxSHf70yuCJhcYNZyj8ztiV8zNBj7red8DUqAiRb/lb+CdL?= =?us-ascii?Q?GSRSiFoX4SUecDcXdplsPRNoeUMA9SOE1My5uX4pQ6XpyEZtlv1hggzAaFxi?= =?us-ascii?Q?xW1hTv0S5xYC3KkUo+S1iii5xNnJbuUtOdk7niHyDMnQMuZfH2O5PIwVwh5P?= =?us-ascii?Q?pDvh23lHzjag5bqFN7z9M8wlNM4+pLUctC2XEXGrqxL1x1ruoOMRKyJX6jYj?= =?us-ascii?Q?fbJzfq1cMMx5TspBJCF2WpFTaHkK2eYVxGt5J6YWSzlyntfFOOZoJXiJ3FLr?= =?us-ascii?Q?izcW03oLmaB3Vx26bjR50+tgWte3CTi2i8+22LVllIBUPT4bual9BtqM200t?= =?us-ascii?Q?PGjESje5V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PR0701MB1039; 7:cPJJJxC/6c3rRlRRK78Szg5BYfKASdQsB7X702RN6cAwRJY1HQezX6hEILuLVpLiFsi8XQD+0o8Jjx6EHLUJgAnNDtqlBWfydfByVWhlfp51KPykOjFYHrTnBlpdAcawYlQNmDVomr2Bb5RWWKHWTUivH1cp/T2g2nSj2Foh8a6AmZC3kGN+3it5pTBZrgGjxWfPBzsT3fcPiQHKEG1wniC0aJ96s2tI1mekJkOlU2n8ccuv7gS1qGkUC+0wOclm8MZ07yTLJNpi2ontXNq/Fs9dlodj4v8IZ2uaYVQRBI8BiLnwkEE+BDOQENTF2B4TkAfwS33Cf5ES8LAb5PY6mQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2017 11:02:32.1858 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR0701MB1039 Subject: [dpdk-dev] [PATCH v3] ether: use a default for max Rx frame size in configure() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2017 11:02:35 -0000 At the moment rte_eth_dev_configure() behaves inconsistent: - for normal frames: zero max_rx_pkt_len uses a default - for jumbo frames: zero max_rx_pkt_len gives an error This patch fixes this inconsistency by using a default value if max_rx_pkt_len is zero both for normal and jumbo frames. Signed-off-by: Andriy Berestovskyy --- Notes: v3 changes: - use a default only if max_rx_pkt_len is zero v2 changes: - reword the commit title according to the check-git-log.sh lib/librte_ether/rte_ethdev.c | 23 ++++++++++++----------- lib/librte_ether/rte_ethdev.h | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 4e1e6dc..2700c69 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -790,6 +790,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; + uint32_t max_len; int diag; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); @@ -858,17 +859,23 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, } /* - * If jumbo frames are enabled, check that the maximum RX packet - * length is supported by the configured device. + * Check that the maximum RX packet length is supported + * by the configured device. */ if (dev_conf->rxmode.jumbo_frame == 1) { - if (dev_conf->rxmode.max_rx_pkt_len > - dev_info.max_rx_pktlen) { + max_len = dev_info.max_rx_pktlen; + } else { + max_len = ETHER_MAX_LEN; + } + if (dev_conf->rxmode.max_rx_pkt_len == 0) { + dev->data->dev_conf.rxmode.max_rx_pkt_len = max_len; + } else { + if (dev_conf->rxmode.max_rx_pkt_len > max_len) { RTE_PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u" " > max valid value %u\n", port_id, (unsigned)dev_conf->rxmode.max_rx_pkt_len, - (unsigned)dev_info.max_rx_pktlen); + (unsigned int)max_len); return -EINVAL; } else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) { RTE_PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u" @@ -878,12 +885,6 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, (unsigned)ETHER_MIN_LEN); return -EINVAL; } - } else { - if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN || - dev_conf->rxmode.max_rx_pkt_len > ETHER_MAX_LEN) - /* Use default value */ - dev->data->dev_conf.rxmode.max_rx_pkt_len = - ETHER_MAX_LEN; } /* diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index d072538..ea760dc 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -349,7 +349,7 @@ enum rte_eth_tx_mq_mode { struct rte_eth_rxmode { /** The multi-queue packet distribution mode to be used, e.g. RSS. */ enum rte_eth_rx_mq_mode mq_mode; - uint32_t max_rx_pkt_len; /**< Only used if jumbo_frame enabled. */ + uint32_t max_rx_pkt_len; /**< If zero, use a default packet length. */ uint16_t split_hdr_size; /**< hdr buf size (header_split enabled).*/ __extension__ uint16_t header_split : 1, /**< Header Split enable. */ -- 2.7.4