From: Andriy Berestovskyy <Andriy.Berestovskyy@caviumnetworks.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3] ether: use a default for max Rx frame size in configure()
Date: Fri, 7 Apr 2017 13:02:05 +0200 [thread overview]
Message-ID: <1491562925-27247-1-git-send-email-Andriy.Berestovskyy@caviumnetworks.com> (raw)
In-Reply-To: <1490288768-8114-1-git-send-email-Andriy.Berestovskyy@cavium.com>
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 <Andriy.Berestovskyy@caviumnetworks.com>
---
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
next prev parent reply other threads:[~2017-04-07 11:02 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 17:06 [dpdk-dev] [PATCH] ether: fix configure() to use a default for max_rx_pkt_len Andriy Berestovskyy
2017-03-24 11:52 ` [dpdk-dev] [PATCH v2] ether: use a default for max Rx frame size in configure() Andriy Berestovskyy
2017-03-27 6:15 ` Yang, Qiming
2017-03-27 8:38 ` Andriy Berestovskyy
2017-04-07 8:24 ` Bruce Richardson
2017-04-06 20:48 ` Thomas Monjalon
2017-04-07 8:09 ` Andriy Berestovskyy
2017-04-07 8:34 ` Thomas Monjalon
2017-04-07 8:55 ` Andriy Berestovskyy
2017-04-07 11:02 ` Andriy Berestovskyy [this message]
2017-04-07 12:15 ` [dpdk-dev] [PATCH v3] " Thomas Monjalon
2017-04-07 12:29 ` Bruce Richardson
2017-04-07 14:18 ` Andriy Berestovskyy
2017-04-07 14:47 ` Thomas Monjalon
2017-04-07 15:27 ` Andriy Berestovskyy
2017-04-20 22:25 ` Thomas Monjalon
2017-04-24 14:50 ` Andriy Berestovskyy
2017-07-31 22:33 ` Thomas Monjalon
2018-05-22 22:30 ` Thomas Monjalon
2018-05-23 5:21 ` Shahaf Shuler
2018-05-23 5:23 ` Jerin Jacob
2018-05-24 9:20 ` Andriy Berestovskyy
2019-01-23 18:36 ` Ferruh Yigit
2019-01-25 21:15 ` Andriy Berestovskyy
2017-04-10 14:30 ` [dpdk-dev] [PATCH 1/3] examples/ip_fragmentation: limit max frame size Andriy Berestovskyy
2017-04-10 14:30 ` [dpdk-dev] [PATCH 2/3] examples/ip_reassembly: " Andriy Berestovskyy
2017-04-10 14:30 ` [dpdk-dev] [PATCH 3/3] examples/ipv4_multicast: " Andriy Berestovskyy
2017-04-21 0:21 ` [dpdk-dev] [PATCH 1/3] examples/ip_fragmentation: " Thomas Monjalon
2023-06-08 16:51 ` [PATCH v3] ether: use a default for max Rx frame size in configure() Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491562925-27247-1-git-send-email-Andriy.Berestovskyy@caviumnetworks.com \
--to=andriy.berestovskyy@caviumnetworks.com \
--cc=dev@dpdk.org \
--cc=thomas.monjalon@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).