From patchwork Fri Apr 29 22:30:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Kinzie X-Patchwork-Id: 12327 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id CE19E559A; Fri, 29 Apr 2016 23:31:02 +0200 (CEST) Received: from mail-pa0-f67.google.com (mail-pa0-f67.google.com [209.85.220.67]) by dpdk.org (Postfix) with ESMTP id 1C57E39EA for ; Fri, 29 Apr 2016 23:31:00 +0200 (CEST) Received: by mail-pa0-f67.google.com with SMTP id yl2so13676604pac.1 for ; Fri, 29 Apr 2016 14:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=kxd/s0WN3gF/O6oPR3cvBLA5KZbccAt8mmhrtQp9LHk=; b=J8NTx5dGNWlZstFcsLmuoaiFK/P9ZHUmMFKZvHw4yEOTVZNWBAErle1R/iCrKQjfsj iibELy/0WvnBZOoMmPSU/1/TKSBoOmQv2TKLZmATpbsQChiVoFYx49aZgaJU0y8d+7F5 hp3VOj4VyTOJw+ZdbbsugF26I0j2jJaI6itpll1HStWQaeyu3yeUEMtgFpMzAZ4qTd5S bDTp21gltAdCumwUCyPDjDcFhjq0OxoIavKioQWBgnZz6nmeFS/HBRPdRYcWioF94dRO 3H7/+A2VxwhqFMy4CpAFGk+z2Gp5Y+XusNPVQqLEXKNHXtaP2M9QLmjiuSNe/32mCo76 hdOA== 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:in-reply-to :references:in-reply-to:references; bh=kxd/s0WN3gF/O6oPR3cvBLA5KZbccAt8mmhrtQp9LHk=; b=S5H9TJFAPcTW/TvKsyjsp9EhKDdCj5OMV0dr+nllHT7la5KK44Oy+GoBEHniwB5qDI yDTJqAvEJFCBY0u20who8KV5XpmJ2wRKOCWrMj1ZRPAKDXSMyPi4EEW/2G6K5+XmbXq9 7+e2B/mo28SKS3Xnu6X4yu0SpS5iNJuCkf/IBdLDY5mYqsn+U86rLm+L9TydMMp0CjVh ph+hYzGxLYgBuMMAke/7VAG1VOOCNzfzagJcgTV4bHgt1BgNOCg4nNb52Fv4r0H7ZENL GWXcQkGMSnO7sh11CE/MOydkJGBe/maBvvwunY+KgvxaYjN+m8GBVrGQdfeCCnTPF7E0 JvJQ== X-Gm-Message-State: AOPr4FUuzEyKDGyP1EdNs7TRKiAiDg/gmdmWXdGLJq00VIaBA1s1fjaIfDVAeO06+3LF/A== X-Received: by 10.66.75.97 with SMTP id b1mr32082048paw.54.1461965459457; Fri, 29 Apr 2016 14:30:59 -0700 (PDT) Received: from buildhost2.vyatta.com. ([144.49.132.22]) by smtp.gmail.com with ESMTPSA id m190sm25832774pfm.29.2016.04.29.14.30.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Apr 2016 14:30:58 -0700 (PDT) From: Eric Kinzie To: dev@dpdk.org Cc: declan.doherty@intel.com Date: Fri, 29 Apr 2016 15:30:05 -0700 Message-Id: <1461969005-18106-2-git-send-email-ehkinzie@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1461969005-18106-1-git-send-email-ehkinzie@gmail.com> References: <1461969005-18106-1-git-send-email-ehkinzie@gmail.com> In-Reply-To: <571F4849.5030509@intel.com> References: <571F4849.5030509@intel.com> Subject: [dpdk-dev] [PATCH v2] bond: inherit maximum rx packet length 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Instead of a hard-coded maximum receive length, allow the bond interface to inherit this limit from the first slave added. This allows an application that uses jumbo frames to pass realistic values to rte_eth_dev_configure without causing an error. Signed-off-by: Eric Kinzie --- drivers/net/bonding/rte_eth_bond_api.c | 12 +++++++++++- drivers/net/bonding/rte_eth_bond_pmd.c | 2 +- drivers/net/bonding/rte_eth_bond_private.h | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index e9247b5..acc1c32 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -247,6 +247,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) internals->active_slave_count = 0; internals->rx_offload_capa = 0; internals->tx_offload_capa = 0; + internals->max_rx_pktlen = 2048; /* Initially allow to choose any offload type */ internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK; @@ -331,9 +332,15 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id) /* Add slave details to bonded device */ slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE; - slave_add(internals, slave_eth_dev); rte_eth_dev_info_get(slave_port_id, &dev_info); + if (dev_info.max_rx_pktlen < internals->max_rx_pktlen) { + RTE_BOND_LOG(ERR, "Slave (port %u) max_rx_pktlen too small", + slave_port_id); + return -1; + } + + slave_add(internals, slave_eth_dev); /* We need to store slaves reta_size to be able to synchronize RETA for all * slave devices even if its sizes are different. @@ -365,6 +372,9 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id) internals->tx_offload_capa = dev_info.tx_offload_capa; internals->flow_type_rss_offloads = dev_info.flow_type_rss_offloads; + /* Inherit first slave's max rx packet size */ + internals->max_rx_pktlen = dev_info.max_rx_pktlen; + } else { /* Check slave link properties are supported if props are set, * all slaves must be the same */ diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 54788cf..189fb47 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1650,7 +1650,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_mac_addrs = 1; - dev_info->max_rx_pktlen = (uint32_t)2048; + dev_info->max_rx_pktlen = internals->max_rx_pktlen; dev_info->max_rx_queues = (uint16_t)128; dev_info->max_tx_queues = (uint16_t)512; diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 8312397..79ca69d 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -169,6 +169,8 @@ struct bond_dev_private { struct rte_kvargs *kvlist; uint8_t slave_update_idx; + + uint32_t max_rx_pktlen; }; extern const struct eth_dev_ops default_dev_ops;