From patchwork Tue Mar 22 08:09:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuya Mukawa X-Patchwork-Id: 11643 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 608412B93; Tue, 22 Mar 2016 09:09:52 +0100 (CET) Received: from mail-pf0-f170.google.com (mail-pf0-f170.google.com [209.85.192.170]) by dpdk.org (Postfix) with ESMTP id 139E72949 for ; Tue, 22 Mar 2016 09:09:51 +0100 (CET) Received: by mail-pf0-f170.google.com with SMTP id x3so299708406pfb.1 for ; Tue, 22 Mar 2016 01:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=aGSibLF1VpGPAyXZOFN4nR6BzCtcxa2xSmdbQlNIiEA=; b=YE4wE6gIUhYKRypTjyVZ3/IhNKNJeHIw0yPIJI48bxLRoZhcE5+f+U+wMvyuluX80Q MsFJvjvauWGPfF/rZ/ziU5RbNFTmwARY+xOsxnO3gZDOZC5Y17u76/e3CLBGOavofvel FXcQi5qRpjknHGXtTvchXocOUGN4pW0dk9wIxuYuO2XTYkmFeKUYZKUVbxH2EUlSZgdO tirHv/MfBKYDapVH7UlXNQZkz0UvDOWjnqgc6brCBvb1arb0yPjk4VHpJGIZiTyIThzj 8+QTR4MRYYFPJjlRDLd89Re7E3DSinuQSJkXn2dzrYNjkyrnbXdRpUwgiDrnaD2RNmlW A66w== 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=aGSibLF1VpGPAyXZOFN4nR6BzCtcxa2xSmdbQlNIiEA=; b=eG79pgJtPTkTutJ50mE5AEvS9Z28tKwsXLvXxrgHQe7I+04pGsWvJfYhKhcM4w5pUp oBtwzbXRQdK3GJeyfmB5e0Q1VDn2Fszj1Xywgs7ZbMjUlhHXSH4SSNHhBnMaPcejVVd0 /zL5mACJYH6U0wFqMKacTQwwcPkmSIAc4ZUs8Bw9NmAFZAC0p/3u44xQ4zMKAdZ/RHJV YjSW3FmB5xyJ8ue7i284Dbq6AHKMx/bRLBDh3bfiKjthF96NgYSX6RgaKRHjg0sdPyVU navihq57A49A4qdPin3IxyU80OWc4Hfz2frug+AosJ78QliFEjjfjJlo1jvni2kp4zCD x/pA== X-Gm-Message-State: AD7BkJIZGaR3icFZzZ42DDq/Zw2Iwq6G0RCIbtrPZtsiowMG18pgdNkenqU4NtYWVOxfOw== X-Received: by 10.98.89.7 with SMTP id n7mr50709922pfb.81.1458634190505; Tue, 22 Mar 2016 01:09:50 -0700 (PDT) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id ll7sm46107712pab.6.2016.03.22.01.09.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Mar 2016 01:09:49 -0700 (PDT) From: Tetsuya Mukawa To: dev@dpdk.org, ciara.loftus@intel.com Cc: ann.zhuangyanying@huawei.com, bruce.richardson@intel.com, yuanhan.liu@linux.intel.com, Tetsuya Mukawa Date: Tue, 22 Mar 2016 17:09:45 +0900 Message-Id: <1458634185-2526-1-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] vhost PMD: Fix wrong handling of maximum value of rx/tx queues 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" Currently, the maximum value of rx/tx queueus are kept by EAL. But, the value are used like below different meanings in vhost PMD. - The maximum value of current enabled queues. - The maximum value of current supported queues. This wrong double meaning will cause an issue like below steps. * Invoke application with below option. --vdev 'eth_vhost0,iface=,queues=4' * Configure queues like below. rte_eth_dev_configure(portid, 2, 2, ...); * Configure queues again like below. rte_eth_dev_configure(portid, 4, 4, ...); The second rte_eth_dev_configure() will be failed because both the maximum value of current enabled queues and supported queues will be '2' after calling first rte_eth_dev_configure(). To fix the issue, the patch prepare one more variable to keep the number of maximum supported queues in vhost PMD. Signed-off-by: Tetsuya Mukawa Acked-by: Ciara Loftus --- drivers/net/vhost/rte_eth_vhost.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 6b9d287..5fd8c70 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -88,6 +88,7 @@ struct vhost_queue { struct pmd_internal { char *dev_name; char *iface_name; + uint16_t max_queues; volatile uint16_t once; }; @@ -555,11 +556,19 @@ static void eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { + struct pmd_internal *internal; + + internal = dev->data->dev_private; + if (internal == NULL) { + RTE_LOG(ERR, PMD, "Invalid device specified\n"); + return; + } + dev_info->driver_name = drivername; dev_info->max_mac_addrs = 1; dev_info->max_rx_pktlen = (uint32_t)-1; - dev_info->max_rx_queues = dev->data->nb_rx_queues; - dev_info->max_tx_queues = dev->data->nb_tx_queues; + dev_info->max_rx_queues = internal->max_queues; + dev_info->max_tx_queues = internal->max_queues; dev_info->min_rx_bufsize = 0; } @@ -751,6 +760,7 @@ eth_dev_vhost_create(const char *name, char *iface_name, int16_t queues, memmove(data->name, eth_dev->data->name, sizeof(data->name)); data->nb_rx_queues = queues; data->nb_tx_queues = queues; + internal->max_queues = queues; data->dev_link = pmd_link; data->mac_addrs = eth_addr;