From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by dpdk.org (Postfix) with ESMTP id DB6A23195 for ; Tue, 8 Dec 2015 14:23:25 +0100 (CET) Received: by lbbkw15 with SMTP id kw15so10960047lbb.0 for ; Tue, 08 Dec 2015 05:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=Z7HFnChhmcqTS/zUxYYAJkAx4D3yp3TXAcEqWUrzA34=; b=ZSjsDUaZhSOv9oER9bJngxOJ2EDxBm5fedEqO0Z5Ah8Osg4wUuXKRxxylpMhJlkQOi apEcJAKNZF4B041/0zEqb8cmEQer0aNyk0bYq4AjkRb5FjAIQtISLdatG35GwpAtmA+N arYV36yj5Zj5MB5x631DwdFecGIXdFgs6qHKcYQLildj+HP3sv4EuHRJPWZSWtlDk9E7 gH1+adQRUozI8slpXO9RDTy912oRsYsE83X224+zrY13HRJJkMq3Yl6H1s3dcyVjykpM 4LiDWX884/bep5LWN0vGUFmDOX4lzKetTuxgd+bpaaJyft9920eZtaxp6ys136F4H9E3 vfMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Z7HFnChhmcqTS/zUxYYAJkAx4D3yp3TXAcEqWUrzA34=; b=L15r/mY3iFEcqSbir6xCDidKOZF1eSt3NHD4L+j+JWerCRjQmdBLufQgAjf+GJfGLW 3iQI3EJViLh14IjSPqRmi+bHVw0BEBnPi18khioOPH/cK7FNNWcZ0YQ9Fje2FRkxj1FT bVAmZB4VAgGDvprgv5InQCSscVIYYNrXYUOqqOK76V2w/g0+6YzJHm0veGIzNcp0UiAp +M42BBXAQIjVRVFOlo7s624hcpJqJcHOx1YrUGJmoFzw2+mUxKkkfoeXK8MuncKizAen Lvro24RaBO5mMZdR38gPOKMUKBZAy83QPDSpFKtKOW7PZTsOIE5QLEJ0oHdoAvNZq/Iq CeJw== X-Gm-Message-State: ALoCoQnE6ZSjrWvmY2wA6Pk0hTk97kc5puGNn40P5M/EUll0vU1brIglTbEKSnRXOuo/1mTp6dI4VyrlrL2KGlbzxMBrV5FF0w== X-Received: by 10.112.134.169 with SMTP id pl9mr1391548lbb.145.1449581005498; Tue, 08 Dec 2015 05:23:25 -0800 (PST) Received: from b.semihalf.local ([80.82.22.190]) by smtp.gmail.com with ESMTPSA id pd9sm575951lbc.48.2015.12.08.05.23.24 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Dec 2015 05:23:24 -0800 (PST) From: Andriy Berestovskyy To: dev@dpdk.org Date: Tue, 8 Dec 2015 14:23:05 +0100 Message-Id: <1449580985-2692-1-git-send-email-aber@semihalf.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] bond: fix LACP mempool size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 13:23:26 -0000 The following messages might appear after some idle time: "PMD: Failed to allocate LACP packet from pool" The fix ensures the mempool size is greater than the sum of TX descriptors. --- drivers/net/bonding/rte_eth_bond_8023ad.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index ee2964a..b3b30f6 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -851,6 +851,9 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id) char mem_name[RTE_ETH_NAME_MAX_LEN]; int socket_id; unsigned element_size; + uint32_t total_tx_desc; + struct bond_tx_queue *bd_tx_q; + uint16_t q_id; /* Given slave mus not be in active list */ RTE_VERIFY(find_slave_by_id(internals->active_slaves, @@ -884,14 +887,17 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id) element_size = sizeof(struct slow_protocol_frame) + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM; - /* How big memory pool should be? If driver will not - * free packets quick enough there will be ENOMEM in tx_machine. - * For now give 511 pkts * max number of queued TX packets per slave. - * Hope it will be enough. */ + /* The size of the mempool should be at least: + * the sum of the TX descriptors + BOND_MODE_8023AX_SLAVE_TX_PKTS */ + total_tx_desc = BOND_MODE_8023AX_SLAVE_TX_PKTS; + for (q_id = 0; q_id < bond_dev->data->nb_rx_queues; q_id++) { + bd_tx_q = (struct bond_tx_queue*)bond_dev->data->tx_queues[q_id]; + total_tx_desc += bd_tx_q->nb_tx_desc; + } + snprintf(mem_name, RTE_DIM(mem_name), "slave_port%u_pool", slave_id); port->mbuf_pool = rte_mempool_create(mem_name, - BOND_MODE_8023AX_SLAVE_TX_PKTS * 512 - 1, - element_size, + total_tx_desc, element_size, RTE_MEMPOOL_CACHE_MAX_SIZE >= 32 ? 32 : RTE_MEMPOOL_CACHE_MAX_SIZE, sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, socket_id, MEMPOOL_F_NO_SPREAD); @@ -932,12 +938,12 @@ bond_mode_8023ad_deactivate_slave(struct rte_eth_dev *bond_dev, struct port *port; uint8_t i; - /* Given slave mus be in active list */ + /* Given slave must be in active list */ RTE_VERIFY(find_slave_by_id(internals->active_slaves, internals->active_slave_count, slave_id) < internals->active_slave_count); /* Exclude slave from transmit policy. If this slave is an aggregator - * make all aggregated slaves unselected to force sellection logic + * make all aggregated slaves unselected to force selection logic * to select suitable aggregator for this port. */ for (i = 0; i < internals->active_slave_count; i++) { port = &mode_8023ad_ports[internals->active_slaves[i]]; @@ -1095,7 +1101,7 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals, goto free_out; } - /* Setup marker timer. Do it in loop in case concurent access. */ + /* Setup marker timer. Do it in loop in case concurrent access. */ do { old_marker_timer = port->rx_marker_timer; if (!timer_is_expired(&old_marker_timer)) { -- 1.9.1