From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by dpdk.org (Postfix) with ESMTP id 3CC955952 for ; Sun, 4 Jan 2015 09:38:48 +0100 (CET) Received: by mail-we0-f178.google.com with SMTP id p10so6354052wes.9 for ; Sun, 04 Jan 2015 00:38:48 -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=QrNG22B76yXowy3kwgAO/0aabO5163jxwDSrjn1GmkI=; b=OsxSfqfB3MiHOaZxh90TE3kPXN19NJvQ7ZYg2nGP5djzz+c9efBaSYdBvdyDJDvvTn nPTIHPKb3TOmWuqMRmdqYMxuHF2BpdtzDuJYtIN0f3wLW4cVTEFq50BRpo977n43I6yF +3TZX8mOU5aUMzTECD57aMU9tp/RiWS1wMciJzW52Fs6ojRdhnim212ADPXl+qmLYn9U a8fhSiCb4ZA3Ejkkx1LKVSaHMZCdgYAkJqc25S6Jjvz1e6QzKgv9xpMvSdC4Duy28x6Z tju/PHc1Z1ytbx5GO2v401fthVC8xN/cvPXjl+QQfeZcB9gp+ATxdYtOffhgxYjdz1XV QbMg== X-Gm-Message-State: ALoCoQlaCRHg7XbQBKjK7Wk5XmyyIjLmfzAQTDZbKSvqFhIBDkEihGyMvTdhmGfzFcshl7uL3Wjm X-Received: by 10.180.207.10 with SMTP id ls10mr14060490wic.7.1420360728148; Sun, 04 Jan 2015 00:38:48 -0800 (PST) Received: from [10.0.0.3] (bzq-79-179-0-199.red.bezeqint.net. [79.179.0.199]) by mx.google.com with ESMTPSA id u1sm5270465wif.6.2015.01.04.00.38.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Jan 2015 00:38:47 -0800 (PST) Message-ID: <54A8FC16.40402@cloudius-systems.com> Date: Sun, 04 Jan 2015 10:38:46 +0200 From: Vlad Zolotarov 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 , dev@dpdk.org References: <1419398584-19520-1-git-send-email-changchun.ouyang@intel.com> <1420355937-18484-1-git-send-email-changchun.ouyang@intel.com> <1420355937-18484-4-git-send-email-changchun.ouyang@intel.com> In-Reply-To: <1420355937-18484-4-git-send-email-changchun.ouyang@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4 3/6] ixgbe: Get VF queue number 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: Sun, 04 Jan 2015 08:38:48 -0000 On 01/04/15 09:18, Ouyang Changchun wrote: > Get the available Rx and Tx queue number when receiving IXGBE_VF_GET_QUEUES message from VF. > > Signed-off-by: Changchun Ouyang > --- > lib/librte_pmd_ixgbe/ixgbe_pf.c | 35 ++++++++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_pmd_ixgbe/ixgbe_pf.c b/lib/librte_pmd_ixgbe/ixgbe_pf.c > index 495aff5..cbb0145 100644 > --- a/lib/librte_pmd_ixgbe/ixgbe_pf.c > +++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c > @@ -53,6 +53,8 @@ > #include "ixgbe_ethdev.h" > > #define IXGBE_MAX_VFTA (128) > +#define IXGBE_VF_MSG_SIZE_DEFAULT 1 > +#define IXGBE_VF_GET_QUEUE_MSG_SIZE 5 > > static inline uint16_t > dev_num_vf(struct rte_eth_dev *eth_dev) > @@ -491,9 +493,36 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) > } > > static int > +ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) > +{ > + struct ixgbe_vf_info *vfinfo = > + *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private); > + uint32_t default_q = vf * RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool; > + > + /* Verify if the PF supports the mbox APIs version or not */ > + switch (vfinfo[vf].api_version) { > + case ixgbe_mbox_api_20: > + case ixgbe_mbox_api_11: > + break; > + default: > + return -1; > + } > + > + /* Notify VF of Rx and Tx queue number */ > + msgbuf[IXGBE_VF_RX_QUEUES] = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool; > + msgbuf[IXGBE_VF_TX_QUEUES] = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool; > + > + /* Notify VF of default queue */ > + msgbuf[IXGBE_VF_DEF_QUEUE] = default_q; What about IXGBE_VF_TRANS_VLAN field? > + > + return 0; > +} > + > +static int > ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf) > { > uint16_t mbx_size = IXGBE_VFMAILBOX_SIZE; > + uint16_t msg_size = IXGBE_VF_MSG_SIZE_DEFAULT; > uint32_t msgbuf[IXGBE_VFMAILBOX_SIZE]; > int32_t retval; > struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > @@ -537,6 +566,10 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf) > case IXGBE_VF_API_NEGOTIATE: > retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf); > break; > + case IXGBE_VF_GET_QUEUES: > + retval = ixgbe_get_vf_queues(dev, vf, msgbuf); > + msg_size = IXGBE_VF_GET_QUEUE_MSG_SIZE; Although the msg_size semantics and motivation is clear, if u want to do then do it all the way - add it to all other cases too not just to IXGBE_VF_GET_QUEUES. For instance, why do u write all 16 DWORDS for API negotiation (only 2 are required) and only here u decided to get "greedy"? ;) My point is: either drop it completely or fix all other places as well. > + break; > default: > PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]); > retval = IXGBE_ERR_MBX; > @@ -551,7 +584,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf) > > msgbuf[0] |= IXGBE_VT_MSGTYPE_CTS; > > - ixgbe_write_mbx(hw, msgbuf, 1, vf); > + ixgbe_write_mbx(hw, msgbuf, msg_size, vf); > > return retval; > }