From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 584BDE72 for ; Tue, 9 Jun 2015 18:20:58 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 09 Jun 2015 08:59:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,581,1427785200"; d="scan'208";a="505581939" Received: from kmsmsx152.gar.corp.intel.com ([172.21.73.87]) by FMSMGA003.fm.intel.com with ESMTP; 09 Jun 2015 08:59:34 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by KMSMSX152.gar.corp.intel.com (172.21.73.87) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 9 Jun 2015 23:59:33 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.246]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.129]) with mapi id 14.03.0224.002; Tue, 9 Jun 2015 23:59:32 +0800 From: "Qiu, Michael" To: "He, Shaopeng" , "dev@dpdk.org" Thread-Topic: [PATCH 2/3] fm10k: add MAC filter Thread-Index: AQHQnOAnTWAznxCZ5kqE7ZRSNUQymg== Date: Tue, 9 Jun 2015 15:59:31 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286046959F8@SHSMSX101.ccr.corp.intel.com> References: <1433213937-21690-1-git-send-email-shaopeng.he@intel.com> <1433213937-21690-3-git-send-email-shaopeng.he@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 2/3] fm10k: add MAC filter 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: Tue, 09 Jun 2015 16:20:59 -0000 On 2015/6/2 10:59, He, Shaopeng wrote:=0A= > MAC filter function was newly added, each PF and VF can have up to 64 MAC= =0A= > addresses. VF filter needs support from PF host, which is not available n= ow.=0A= >=0A= > Signed-off-by: Shaopeng He =0A= > ---=0A= > drivers/net/fm10k/fm10k.h | 3 +-=0A= > drivers/net/fm10k/fm10k_ethdev.c | 90 ++++++++++++++++++++++++++++++++++= ++----=0A= > 2 files changed, 85 insertions(+), 8 deletions(-)=0A= =0A= ...=0A= =0A= > ;=0A= > +=0A= > + fm10k_mbx_lock(hw);=0A= > + i =3D 0;=0A= > + for (j =3D 0; j < FM10K_VFTA_SIZE; j++) {=0A= > + if (macvlan->vfta[j]) {=0A= > + for (k =3D 0; k < FM10K_UINT32_BIT_SIZE; k++) {=0A= > + if (macvlan->vfta[j] & (1 << k)) {=0A= > + if (i + 1 > macvlan->vlan_num) {=0A= > + PMD_INIT_LOG(ERR, "vlan number "=0A= > + "not match");=0A= > + fm10k_mbx_unlock(hw);=0A= > + return;=0A= > + }=0A= > + fm10k_update_uc_addr(hw,=0A= > + hw->mac.dglort_map, mac,=0A= =0A= Here before 'mac', does it has a incident? if no, please ignore, maybe=0A= my mail client's issue.=0A= =0A= Thanks,=0A= Michael=0A= > + j * FM10K_UINT32_BIT_SIZE + k,=0A= > + add, 0);=0A= > + i++;=0A= > + }=0A= > + }=0A= > + }=0A= > + }=0A= > + fm10k_mbx_unlock(hw);=0A= > +=0A= > + if (add)=0A= > + macvlan->mac_num++;=0A= > + else=0A= > + macvlan->mac_num--;=0A= > +}=0A= > +=0A= > +/* Add a MAC address, and update filters */=0A= > +static void=0A= > +fm10k_macaddr_add(struct rte_eth_dev *dev,=0A= > + struct ether_addr *mac_addr,=0A= > + __rte_unused uint32_t index,=0A= > + __rte_unused uint32_t pool)=0A= > +{=0A= > + fm10k_MAC_filter_set(dev, mac_addr->addr_bytes, TRUE);=0A= > +}=0A= > +=0A= > +/* Remove a MAC address, and update filters */=0A= > +static void=0A= > +fm10k_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)=0A= > +{=0A= > + struct rte_eth_dev_data *data =3D dev->data;=0A= > +=0A= > + if (index < FM10K_MAX_MACADDR_NUM)=0A= > + fm10k_MAC_filter_set(dev, data->mac_addrs[index].addr_bytes,=0A= > + FALSE);=0A= > +}=0A= > +=0A= > static inline int=0A= > check_nb_desc(uint16_t min, uint16_t max, uint16_t mult, uint16_t reques= t)=0A= > {=0A= > @@ -1728,6 +1801,8 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = =3D {=0A= > .link_update =3D fm10k_link_update,=0A= > .dev_infos_get =3D fm10k_dev_infos_get,=0A= > .vlan_filter_set =3D fm10k_vlan_filter_set,=0A= > + .mac_addr_add =3D fm10k_macaddr_add,=0A= > + .mac_addr_remove =3D fm10k_macaddr_remove,=0A= > .rx_queue_start =3D fm10k_dev_rx_queue_start,=0A= > .rx_queue_stop =3D fm10k_dev_rx_queue_stop,=0A= > .tx_queue_start =3D fm10k_dev_tx_queue_start,=0A= > @@ -1809,7 +1884,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)=0A= > }=0A= > =0A= > /* Initialize MAC address(es) */=0A= > - dev->data->mac_addrs =3D rte_zmalloc("fm10k", ETHER_ADDR_LEN, 0);=0A= > + dev->data->mac_addrs =3D rte_zmalloc("fm10k",=0A= > + ETHER_ADDR_LEN * FM10K_MAX_MACADDR_NUM, 0);=0A= > if (dev->data->mac_addrs =3D=3D NULL) {=0A= > PMD_INIT_LOG(ERR, "Cannot allocate memory for MAC addresses");=0A= > return -ENOMEM;=0A= =0A=