On 23/12/2022 02:30, yangchang wrote:
For eth dev, dpdk X_rx_queue_start function will pre alloc mbufs
for rxq, if n_mbufs < n_rxq * rxq_size, the dev maybe start error
because of it cannot allocate memory. If dmp->mp is not NULL,
the new mempool should be enough, so that the dev will not be
broken due to configuration changes.
Signed-off-by: yangchang <[email protected]>
---
Notes:
v3:
- change some compilation errors
v4:
- add to determine whether mp is empty
- correct spelling errors
- change “break” to "return"
lib/netdev-dpdk.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 72e7a32..c04b824 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -757,6 +757,19 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu)
n_mbufs = dpdk_calculate_mbufs(dev, mtu);
do {
+ /* For eth dev, dpdk X_rx_queue_start function will pre alloc mbuf
+ * for rxq, if n_mbufs < n_rxq * rxq_size, dev maybe start error
+ * because of it cannot allocate memory.
+ */
+ if (!per_port_memory && dev->type == DPDK_DEV_ETH && dmp->mp &&
+ n_mbufs < dev->requested_n_rxq * dev->requested_rxq_size) {
Sorry, but I don't understand what you are trying to do. dmp->mp will
always be NULL here either because dmp was just allocated or it met the
condition of the loop 'do{..}while(!dmp->mp...)'
The issue i raised is the requested_rxqs you are using as a basis for
this check may not be the actual number of rxqs configured on the device
later.
+ VLOG_ERR("Port %s: a mempool of %u mbufs is not enough "
+ "for %d Rx queues of %d queue size",
+ netdev_name, n_mbufs, dev->requested_n_rxq,
+ dev->requested_rxq_size);
+ return NULL;
Returning here leaks dmp.
+
This patch doesn't apply as it seems to be corrupt and the code is
missing a trailing '}' brace. It seems to have been caught by the CI
[0], not sure if you saw it.
Please try and test out before sending as it is easy to miss things in
reviews on the mailing list. Thanks.
[0] https://mail.openvswitch.org/pipermail/ovs-dev/2022-December/400729.html
/* Full DPDK memory pool name must be unique and cannot be
* longer than RTE_MEMPOOL_NAMESIZE. Note that for the shared
* mempool case this can result in one device using a mempool
--
1.8.3.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev