From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f67.google.com (mail-pa0-f67.google.com [209.85.220.67]) by dpdk.org (Postfix) with ESMTP id 12B8F2BDF for ; Sat, 7 May 2016 04:45:45 +0200 (CEST) Received: by mail-pa0-f67.google.com with SMTP id i5so11560926pag.3 for ; Fri, 06 May 2016 19:45:45 -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; bh=squalw9WWx3Eqz8Rl5Z8nm+05SA9RB1t0viwEpJmwY4=; b=H94zlN6BAyYh5kV03iS0wgy4eSE0V87903ff13tkAINQyjy+mQfcvFLKh4oZUqbrBR RFBQc7SjQeE923l+2BonJrZR8kQg/d7m5VErZ1E1tYHw8fZgx4qrUE7w2zxv9ip2MVIn XyeD+Oh6emV/CU5mN94aI5npowg8TDHebLGYLlYMD2jy1KXwkmGfrEv8q3b7MX1qc05c 2GJUbeysD/7+1Ui48EvlWBSalzQ1VaPKaG6rKRI1hUPzY6SBvMY5hzJlAKxoKrxbGofE HomCemfNWSBroqxt98/NaaKGpMOgwpbObd42Yv2fR/atHT3sYaoz0DKCcZvzYnPTPqum 5JYA== 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; bh=squalw9WWx3Eqz8Rl5Z8nm+05SA9RB1t0viwEpJmwY4=; b=OYXOXIxhXw1r/motDkrtUosJsmoUjTO9VKmxveHEqdS4UyHvRNxBf5W0+UfYt9CeGv bvL+E4BW6QQtH5aBFKY3HzWXjV2Y6EzhWiKLhrnDZSXxemjHKVuHLyvB+KLg0ok9O6NG 06suCyaH33UfVNWNOgnKJyYrPrjdCeK6LBShjeEdlxcdBZzHPlmjYN6YHgRPMWVl35mj VCH8jys6/OZg05h5svw2OFR4ooVp3gKvdOtKV992pfce7bv9iDAhdzllXwEeAuNOLRyb 8pQsIqEG5OUibAPcBPA/mUesjDU5aK6+ukQlW/0/OzLmY3j7JS2o+Lr0VKdyJWSDEqB2 5Isg== X-Gm-Message-State: AOPr4FXg33t3LCV4u3KY9K/AwtJVYXK6UDGEJumqKTxKLwk7/ZDU6sOb3fD9qNUmxJ16uA== X-Received: by 10.66.66.42 with SMTP id c10mr33096169pat.119.1462589144498; Fri, 06 May 2016 19:45:44 -0700 (PDT) Received: from buildhost2.vyatta.com. ([144.49.132.22]) by smtp.gmail.com with ESMTPSA id fh14sm24047442pab.31.2016.05.06.19.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 May 2016 19:45:44 -0700 (PDT) From: Eric Kinzie To: dev@dpdk.org Cc: declan.doherty@intel.com Date: Fri, 6 May 2016 20:45:24 -0700 Message-Id: <1462592724-26199-2-git-send-email-ehkinzie@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1462592724-26199-1-git-send-email-ehkinzie@gmail.com> References: <1dba6088-f713-c894-793a-115ac10ffab6@intel.com> <1462592724-26199-1-git-send-email-ehkinzie@gmail.com> Subject: [dpdk-dev] [PATCH v3] 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: , X-List-Received-Date: Sat, 07 May 2016 02:45:45 -0000 Instead of a hard-coded maximum receive length, allow the bond interface to inherit this limit from the slave interfaces. This allows an application that uses jumbo frames to pass realistic values to rte_eth_dev_configure without causing an error. Before the bond interface is configured, allow slaves with any max_rx_pktlen to be added and remember the lowest of these values as a candidate value. During dev_configure, set the bond device's max_rx_pktlen to the candidate value. After this point only slaves with a max_rx_pktlen greater or equal to that of the bonding device can be added. If all slaves are removed, the bond device's pktlen is cleared. Signed-off-by: Eric Kinzie --- drivers/net/bonding/rte_eth_bond_api.c | 18 +++++++++++++++++- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++++- drivers/net/bonding/rte_eth_bond_private.h | 3 +++ 3 files changed, 25 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..aa0be5d 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -247,6 +247,8 @@ 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->candidate_max_rx_pktlen = 0; + internals->max_rx_pktlen = 0; /* Initially allow to choose any offload type */ internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK; @@ -331,9 +333,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 +373,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->candidate_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 */ @@ -391,6 +402,9 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id) if (internals->reta_size > dev_info.reta_size) internals->reta_size = dev_info.reta_size; + if (!internals->max_rx_pktlen + && dev_info.max_rx_pktlen < internals->candidate_max_rx_pktlen) + internals->candidate_max_rx_pktlen = dev_info.max_rx_pktlen; } bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &= @@ -536,6 +550,8 @@ __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id) internals->tx_offload_capa = 0; internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK; internals->reta_size = 0; + internals->candidate_max_rx_pktlen = 0; + internals->max_rx_pktlen = 0; } return 0; } diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 54788cf..0d39191 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1650,7 +1650,8 @@ 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->candidate_max_rx_pktlen ? + internals->candidate_max_rx_pktlen : 2048; dev_info->max_rx_queues = (uint16_t)128; dev_info->max_tx_queues = (uint16_t)512; @@ -2294,6 +2295,9 @@ bond_ethdev_configure(struct rte_eth_dev *dev) } } + /* set the max_rx_pktlen */ + internals->max_rx_pktlen = internals->candidate_max_rx_pktlen; + /* * if no kvlist, it means that this bonded device has been created * through the bonding api. diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 8312397..2bdc9ef 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -169,6 +169,9 @@ struct bond_dev_private { struct rte_kvargs *kvlist; uint8_t slave_update_idx; + + uint32_t candidate_max_rx_pktlen; + uint32_t max_rx_pktlen; }; extern const struct eth_dev_ops default_dev_ops; -- 2.1.4