From: David Marchand <david.marchand@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 3/7] ethdev: store min rx buffer size
Date: Fri, 13 Jun 2014 15:37:39 +0200 [thread overview]
Message-ID: <1402666663-10260-4-git-send-email-david.marchand@6wind.com> (raw)
In-Reply-To: <1402666663-10260-1-git-send-email-david.marchand@6wind.com>
This avoids code duplication in PMD when dealing with mtu changes.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_ether/rte_ethdev.c | 19 ++++++++++++++-----
lib/librte_ether/rte_ethdev.h | 3 +++
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e881ebe..df18b7b 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -879,6 +879,8 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mp)
{
+ int ret;
+ uint32_t mbp_buf_size;
struct rte_eth_dev *dev;
struct rte_pktmbuf_pool_private *mbp_priv;
struct rte_eth_dev_info dev_info;
@@ -919,13 +921,14 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
return (-ENOSPC);
}
mbp_priv = rte_mempool_get_priv(mp);
- if ((uint32_t) (mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM) <
- dev_info.min_rx_bufsize) {
+ mbp_buf_size = mbp_priv->mbuf_data_room_size;
+
+ if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) < dev_info.min_rx_bufsize) {
PMD_DEBUG_TRACE("%s mbuf_data_room_size %d < %d "
"(RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)"
"=%d)\n",
mp->name,
- (int)mbp_priv->mbuf_data_room_size,
+ (int)mbp_buf_size,
(int)(RTE_PKTMBUF_HEADROOM +
dev_info.min_rx_bufsize),
(int)RTE_PKTMBUF_HEADROOM,
@@ -933,8 +936,14 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
return (-EINVAL);
}
- return (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc,
- socket_id, rx_conf, mp);
+ ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc,
+ socket_id, rx_conf, mp);
+ if (!ret) {
+ if (dev->data->min_rx_buf_size > mbp_buf_size)
+ dev->data->min_rx_buf_size = mbp_buf_size;
+ }
+
+ return ret;
}
int
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 5113b7a..3701023 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1262,6 +1262,9 @@ struct rte_eth_dev_data {
struct rte_eth_conf dev_conf; /**< Configuration applied to device. */
uint16_t max_frame_size; /**< Default is ETHER_MAX_LEN (1518). */
+ uint32_t min_rx_buf_size;
+ /**< Common rx buffer size handled by all queues */
+
uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */
struct ether_addr* mac_addrs;/**< Device Ethernet Link address. */
uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
--
1.7.10.4
next prev parent reply other threads:[~2014-06-13 13:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 13:37 [dpdk-dev] [PATCH v2 0/7] add mtu and flow control handlers David Marchand
2014-06-13 13:37 ` [dpdk-dev] [PATCH v2 1/7] ethdev: retrieve flow control configuration David Marchand
2014-06-13 13:37 ` [dpdk-dev] [PATCH v2 2/7] ethdev: add autoneg parameter in flow ctrl accessors David Marchand
2014-06-13 13:37 ` David Marchand [this message]
2014-06-13 13:37 ` [dpdk-dev] [PATCH v2 4/7] ethdev: introduce enable_scatter rx mode David Marchand
2014-06-13 13:37 ` [dpdk-dev] [PATCH v2 5/7] ethdev: add mtu accessors David Marchand
2014-06-13 13:37 ` [dpdk-dev] [PATCH v2 6/7] ixgbe: add set_mtu to ixgbevf David Marchand
2014-06-13 13:37 ` [dpdk-dev] [PATCH v2 7/7] app/testpmd: allow to configure mtu David Marchand
2014-06-16 17:07 ` [dpdk-dev] [PATCH v2 0/7] add mtu and flow control handlers Ananyev, Konstantin
2014-06-17 8:42 ` David Marchand
2014-06-17 8:57 ` Ananyev, Konstantin
2014-06-17 9:25 ` Thomas Monjalon
2014-06-17 11:42 ` Ananyev, Konstantin
2014-06-17 13:39 ` David Marchand
2014-06-17 15:26 ` Ananyev, Konstantin
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=1402666663-10260-4-git-send-email-david.marchand@6wind.com \
--to=david.marchand@6wind.com \
--cc=dev@dpdk.org \
/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).