From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <vladz@cloudius-systems.com>
Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com
 [209.85.212.182]) by dpdk.org (Postfix) with ESMTP id C6A4F12A8
 for <dev@dpdk.org>; Thu,  8 Jan 2015 19:48:54 +0100 (CET)
Received: by mail-wi0-f182.google.com with SMTP id h11so5241081wiw.3
 for <dev@dpdk.org>; Thu, 08 Jan 2015 10:48:54 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
 :subject:references:in-reply-to:content-type
 :content-transfer-encoding;
 bh=HSQqI/AXguhmm4Egw9Ezm0iVGqT0tyQUkGqqt9pyvFA=;
 b=RtBoB9qZmPxKrRUrAhudLGI3VJqfzqk2cu2nu9u+RaY1or/XDh9gKLEnqcZDg7BK0k
 7h2TzEEgSnmEXpOPr6F/xZKnlpwyW7kyGbVOhxWZy2zYTreab9DDtCMruVexae9aa9zp
 UkBKdmB5KhLFeM6RV2HmK/T6BWHMTf0RezxaotoQlgUiz+MLAD7uu4PT3AucDqo25srw
 JWMOt1s8iGOmqwhGAlhFtTAIug765SV/9djlwrvMry0DSwf25vYrd9lwIXq50KYVg7Uv
 NrtICqP0pZeFuKYGHp0rVBUXL1j7RTgwAR/9wA6Ic5sRcd5DRY7OubT76sSF5nTvBXwE
 ebtg==
X-Gm-Message-State: ALoCoQkOGwOp7p8PoOGHene0BuPBhlts2geWvuZxdKIFYAFS8H07hwhzTSAIiPXL3r81tWp03UxZ
X-Received: by 10.194.20.67 with SMTP id l3mr23028757wje.94.1420742934599;
 Thu, 08 Jan 2015 10:48:54 -0800 (PST)
Received: from [10.0.0.4] ([109.66.137.113])
 by mx.google.com with ESMTPSA id qg11sm22891122wic.17.2015.01.08.10.48.53
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 08 Jan 2015 10:48:54 -0800 (PST)
Message-ID: <54AED114.5070907@cloudius-systems.com>
Date: Thu, 08 Jan 2015 20:48:52 +0200
From: Vlad Zolotarov <vladz@cloudius-systems.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.3.0
MIME-Version: 1.0
To: Ouyang Changchun <changchun.ouyang@intel.com>, dev@dpdk.org
References: <1420355937-18484-1-git-send-email-changchun.ouyang@intel.com>
 <1420612355-6666-1-git-send-email-changchun.ouyang@intel.com>
 <1420612355-6666-5-git-send-email-changchun.ouyang@intel.com>
 <54AE4BA2.9040802@cloudius-systems.com>
In-Reply-To: <54AE4BA2.9040802@cloudius-systems.com>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v5 4/6] ether: Check VMDq RSS mode
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 08 Jan 2015 18:48:54 -0000


On 01/08/15 11:19, Vlad Zolotarov wrote:
>
> On 01/07/15 08:32, Ouyang Changchun wrote:
>> Check mq mode for VMDq RSS, handle it correctly instead of returning 
>> an error;
>> Also remove the limitation of per pool queue number has max value of 
>> 1, because
>> the per pool queue number could be 2 or 4 if it is VMDq RSS mode;
>>
>> The number of rxq specified in config will determine the mq mode for 
>> VMDq RSS.
>>
>> Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
>>
>> changes in v5:
>>    - Fix '<' issue, it should be '<=' to test rxq number;
>>    - Extract a function to remove the embeded switch-case statement.
>>
>> ---
>>   lib/librte_ether/rte_ethdev.c | 50 
>> ++++++++++++++++++++++++++++++++++++++-----
>>   1 file changed, 45 insertions(+), 5 deletions(-)
>>
>> diff --git a/lib/librte_ether/rte_ethdev.c 
>> b/lib/librte_ether/rte_ethdev.c
>> index 95f2ceb..8363e26 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -503,6 +503,31 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev 
>> *dev, uint16_t nb_queues)
>>   }
>>     static int
>> +rte_eth_dev_check_vf_rss_rxq_num(uint8_t port_id, uint16_t nb_rx_q)
>> +{
>> +    struct rte_eth_dev *dev = &rte_eth_devices[port_id];
>> +    switch (nb_rx_q) {
>> +    case 1:
>> +    case 2:
>> +        RTE_ETH_DEV_SRIOV(dev).active =
>> +            ETH_64_POOLS;
>> +        break;
>> +    case 4:
>> +        RTE_ETH_DEV_SRIOV(dev).active =
>> +            ETH_32_POOLS;
>> +        break;
>> +    default:
>> +        return -EINVAL;
>> +    }
>> +
>> +    RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = nb_rx_q;
>> +    RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx =
>> +        dev->pci_dev->max_vfs * nb_rx_q;
>> +
>> +    return 0;
>> +}
>> +
>> +static int
>>   rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, 
>> uint16_t nb_tx_q,
>>                 const struct rte_eth_conf *dev_conf)
>>   {
>> @@ -510,8 +535,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, 
>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>         if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
>>           /* check multi-queue mode */
>> -        if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_RSS) ||
>> -            (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
>> +        if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
>>               (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB_RSS) ||
>>               (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB)) {
>>               /* SRIOV only works in VMDq enable mode */
>> @@ -525,7 +549,6 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, 
>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>           }
>>             switch (dev_conf->rxmode.mq_mode) {
>> -        case ETH_MQ_RX_VMDQ_RSS:
>>           case ETH_MQ_RX_VMDQ_DCB:
>>           case ETH_MQ_RX_VMDQ_DCB_RSS:
>>               /* DCB/RSS VMDQ in SRIOV mode, not implement yet */
>> @@ -534,6 +557,25 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, 
>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>                       "unsupported VMDQ mq_mode rx %u\n",
>>                       port_id, dev_conf->rxmode.mq_mode);
>>               return (-EINVAL);
>> +        case ETH_MQ_RX_RSS:
>> +            PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
>> +                    " SRIOV active, "
>> +                    "Rx mq mode is changed from:"
>> +                    "mq_mode %u into VMDQ mq_mode %u\n",
>> +                    port_id,
>> +                    dev_conf->rxmode.mq_mode,
>> +                    dev->data->dev_conf.rxmode.mq_mode);
>> +        case ETH_MQ_RX_VMDQ_RSS:
>> +            dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_RSS;
>> +            if (nb_rx_q <= RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)
>> +                if (rte_eth_dev_check_vf_rss_rxq_num(port_id, 
>> nb_rx_q) != 0) {
>> +                    PMD_DEBUG_TRACE("ethdev port_id=%d"
>> +                        " SRIOV active, invalid queue"
>> +                        " number for VMDQ RSS\n",
>> +                        port_id);
>
> Some nitpicking here: I'd add the allowed values descriptions to the 
> error message. Something like: "invalid queue number for VMDQ RSS. 
> Allowed values are 1, 2 or 4\n".
>
>> +                    return -EINVAL;
>> +                }
>> +            break;
>>           default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */
>>               /* if nothing mq mode configure, use default scheme */
>>               dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_ONLY;
>> @@ -553,8 +595,6 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, 
>> uint16_t nb_rx_q, uint16_t nb_tx_q,
>>           default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
>>               /* if nothing mq mode configure, use default scheme */
>>               dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_ONLY;
>> -            if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
>> -                RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;
>
> I'm not sure u may just remove it. These lines originally belong to a 
> different flow. Are u sure u can remove them like that? What if the 
> mq_mode is ETH_MQ_RX_NONE and nb_q_per_pool has been initialized to 4 
> or 8 in ixgbe_pf_host_init()?

I misread the patch - these lines belong to the txmode.mq_mode switch 
case. I think it's ok to remove these really strange lines here. And 
when I look at it i think for the similar reasons the similar lines 
should be removed in the Rx case too: consider non-RSS case with MQ DCB 
Tx configuration.

>
>>               break;
>>           }
>