From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id F2CC61B1B3 for ; Wed, 10 Jan 2018 15:04:16 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2018 06:04:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,340,1511856000"; d="scan'208";a="18152830" Received: from awalabdu-mobl.ger.corp.intel.com (HELO [163.33.228.183]) ([163.33.228.183]) by FMSMGA003.fm.intel.com with ESMTP; 10 Jan 2018 06:04:14 -0800 To: "Xing, Beilei" , "Horton, Remy" , "dev@dpdk.org" Cc: "Mcnamara, John" , "Lu, Wenzhuo" , "Wu, Jingjing" , "Doherty, Declan" References: <20180108143720.7994-1-remy.horton@intel.com> <20180108143720.7994-4-remy.horton@intel.com> <94479800C636CB44BD422CB454846E0132089D9F@SHSMSX101.ccr.corp.intel.com> <94479800C636CB44BD422CB454846E013208A24F@SHSMSX101.ccr.corp.intel.com> From: Mohammad Abdul Awal Message-ID: <09bba38d-694f-ea43-64db-930347d8feca@intel.com> Date: Wed, 10 Jan 2018 14:04:13 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <94479800C636CB44BD422CB454846E013208A24F@SHSMSX101.ccr.corp.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v4 3/5] drivers/net/i40e: add Port Representor functionality X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 14:04:17 -0000 On 10/01/2018 12:37, Xing, Beilei wrote: > -----Original Message----- >> From: Awal, Mohammad Abdul >> On 10/01/2018 07:56, Xing, Beilei wrote: >>> <...> >>> >>>> +static const struct ether_addr null_mac_addr; >>>> + >>>> +int >>>> +rte_pmd_i40e_remove_vf_mac_addr(uint8_t port, uint16_t vf_id, >>>> + struct ether_addr *mac_addr) >>>> +{ >>>> + struct rte_eth_dev *dev; >>>> + struct i40e_pf_vf *vf; >>>> + struct i40e_vsi *vsi; >>>> + struct i40e_pf *pf; >>>> + >>>> + if (i40e_validate_mac_addr((u8 *)mac_addr) != I40E_SUCCESS) >>>> + return -EINVAL; >>>> + >>>> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); >>>> + >>>> + dev = &rte_eth_devices[port]; >>>> + >>>> + if (!is_i40e_supported(dev)) >>>> + return -ENOTSUP; >>>> + >>>> + pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); >>>> + >>>> + if (vf_id >= pf->vf_num || !pf->vfs) >>>> + return -EINVAL; >>>> + >>>> + vf = &pf->vfs[vf_id]; >>>> + vsi = vf->vsi; >>>> + if (!vsi) { >>>> + PMD_DRV_LOG(ERR, "Invalid VSI."); >>>> + return -EINVAL; >>>> + } >>>> + >>>> + if (!is_same_ether_addr(mac_addr, &vf->mac_addr)) { >>>> + PMD_DRV_LOG(ERR, "Mac address does not match."); >>>> + return -EINVAL; >>>> + } >>> Not very understand why only vf->mac_addr can be moved? >> It it checks if the mac address we want to delete, similar to the function >> rte_pmd_i40e_set_vf_mac_addr where we set the mac address of a VF. > But in this way, seems we can't delete the mac address added by rte_pmd_i40e_add_vf_mac_addr. > set_vf_mac_addr should be used for setting default mac address, right? OK, I understand what you mean. I have fixed it now. We reset the vf->mac_addr only if the mac address is matched. Then we delete it from the vsi->mac_list. Thanks, Awal. > >>> I think any mac address in vsi->mac_list can be removed. >> Yes, it is removed from the vsi->mac_list in the next line if the mac address is >> matched in the previous checking. >> >>>> + >>>> + /* reset the mac with null mac */ >>>> + ether_addr_copy(&null_mac_addr, &vf->mac_addr); >> Here we reset the mac address of a VF with null address, reverting the >> operation of function rte_pmd_i40e_set_vf_mac_addr where we set the >> mac address of a VF. >>>> + >>>> + /* Remove the mac */ >>>> + i40e_vsi_delete_mac(vsi, mac_addr); >>>> + >>>> + return 0; >>>> +} >>>> +