From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7DB2EA0352; Mon, 23 Dec 2019 09:41:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1F2052BA3; Mon, 23 Dec 2019 09:41:49 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 53AFF1C01 for ; Mon, 23 Dec 2019 09:41:46 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Dec 2019 00:41:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,346,1571727600"; d="scan'208";a="219109915" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 23 Dec 2019 00:41:43 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Dec 2019 00:41:43 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 23 Dec 2019 00:41:42 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.19]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.164]) with mapi id 14.03.0439.000; Mon, 23 Dec 2019 16:41:41 +0800 From: "Sun, GuinanX" To: "Ye, Xiaolong" CC: "dev@dpdk.org" , "Lu, Wenzhuo" , "Yang, Qiming" , "Xing, Beilei" Thread-Topic: [dpdk-dev] [PATCH] net/ixgbe: add or remove MAC address Thread-Index: AQHVqabXth/fKDalH0u8DzoTi+civ6fG6s8AgACZnjA= Date: Mon, 23 Dec 2019 08:41:40 +0000 Message-ID: <05758BDAD7FC8E4BAED63D0390A8A9557EF573@SHSMSX101.ccr.corp.intel.com> References: <20191203145457.72154-1-guinanx.sun@intel.com> <20191223072512.GC14498@intel.com> In-Reply-To: <20191223072512.GC14498@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: add or remove MAC address 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Xiaolong > -----Original Message----- > From: Ye, Xiaolong > Sent: Monday, December 23, 2019 3:25 PM > To: Sun, GuinanX > Cc: dev@dpdk.org; Lu, Wenzhuo ; Yang, Qiming > ; Xing, Beilei > Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: add or remove MAC address >=20 > Hi, guinan >=20 > For the title, better to use >=20 > Add support for vf MAC address add and remove >=20 > or something like so. I agree with you and I will fix it in V2's patch >=20 > On 12/03, Guinan Sun wrote: > >Ixgbe PMD pf host code needs to support ixgbevf mac address add and > >remove. For this purpose, a response was added between pf and vf to > >update the mac address. >=20 > Does this mean each one vf can have multiple MAC addresses after this pat= ch, or > this `add` actually means to replace the old mac address with the new one= ? It means each one vf can have multiple MAC addresses after this patch >=20 > > > >Signed-off-by: Guinan Sun > >--- > > drivers/net/ixgbe/ixgbe_ethdev.h | 1 + > > drivers/net/ixgbe/ixgbe_pf.c | 35 ++++++++++++++++++++++++++++++++ > > 2 files changed, 36 insertions(+) > > > >diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h > >b/drivers/net/ixgbe/ixgbe_ethdev.h > >index 76a1b9d18..e1cd8fd16 100644 > >--- a/drivers/net/ixgbe/ixgbe_ethdev.h > >+++ b/drivers/net/ixgbe/ixgbe_ethdev.h > >@@ -270,6 +270,7 @@ struct ixgbe_vf_info { > > uint8_t api_version; > > uint16_t switch_domain_id; > > uint16_t xcast_mode; > >+ uint16_t mac_count; >=20 > How is this mac_count initialized? This variable is initialized to 0 when the ixgbe_adapter structure is initi= alized, and the method is similar to vlan_count. >=20 > > }; > > > > /* > >diff --git a/drivers/net/ixgbe/ixgbe_pf.c > >b/drivers/net/ixgbe/ixgbe_pf.c index d0d85e138..76dbed2ab 100644 > >--- a/drivers/net/ixgbe/ixgbe_pf.c > >+++ b/drivers/net/ixgbe/ixgbe_pf.c > >@@ -748,6 +748,37 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, > uint32_t vf, uint32_t *msgbuf) > > return 0; > > } > > > >+static int > >+ixgbe_set_vf_macvlan_msg(struct rte_eth_dev *dev, uint32_t vf, > >+uint32_t *msgbuf) { > >+ struct ixgbe_hw *hw =3D IXGBE_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > >+ struct ixgbe_vf_info *vf_info =3D > >+ *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data- > >dev_private)); > >+ uint8_t *new_mac =3D (uint8_t *)(&msgbuf[1]); > >+ int index =3D (msgbuf[0] & IXGBE_VT_MSGINFO_MASK) >> > >+ IXGBE_VT_MSGINFO_SHIFT; > >+ > >+ if (index) { > >+ if (!rte_is_valid_assigned_ether_addr( > >+ (struct rte_ether_addr *)new_mac)) { > >+ RTE_LOG(ERR, PMD, "set invalid mac vf:%d\n", vf); > >+ return -1; > >+ } > >+ > >+ if (new_mac =3D=3D NULL) > >+ return -1; >=20 > I feel the null check should be in front of valid ether addr check, other= wise there > might be null pointer reference issue. Ok,I will fix it in V2's patch. >=20 > Thanks, > Xiaolong >=20 > >+ > >+ vf_info[vf].mac_count++; > >+ > >+ hw->mac.ops.set_rar(hw, vf_info[vf].mac_count, > >+ new_mac, vf, IXGBE_RAH_AV); > >+ } else { > >+ hw->mac.ops.clear_rar(hw, vf_info[vf].mac_count); > >+ vf_info[vf].mac_count =3D 0; > >+ } > >+ return 0; > >+} > >+ > > static int > > ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf) { @@ > >-835,6 +866,10 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_= t > vf) > > if (retval =3D=3D RTE_PMD_IXGBE_MB_EVENT_PROCEED) > > retval =3D ixgbe_set_vf_mc_promisc(dev, vf, msgbuf); > > break; > >+ case IXGBE_VF_SET_MACVLAN: > >+ if (retval =3D=3D RTE_PMD_IXGBE_MB_EVENT_PROCEED) > >+ retval =3D ixgbe_set_vf_macvlan_msg(dev, vf, msgbuf); > >+ break; > > default: > > PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", > (unsigned)msgbuf[0]); > > retval =3D IXGBE_ERR_MBX; > >-- > >2.17.1 > >