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 3AFDF2A6C for ; Wed, 4 Jan 2017 03:03:40 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 03 Jan 2017 18:03:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,457,1477983600"; d="scan'208";a="209368451" Received: from pgsmsx102.gar.corp.intel.com ([10.221.44.80]) by fmsmga004.fm.intel.com with ESMTP; 03 Jan 2017 18:03:38 -0800 Received: from pgsmsx110.gar.corp.intel.com (10.221.44.111) by PGSMSX102.gar.corp.intel.com (10.221.44.80) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 4 Jan 2017 10:03:38 +0800 Received: from pgsmsx103.gar.corp.intel.com ([169.254.2.52]) by PGSMSX110.gar.corp.intel.com ([10.221.44.111]) with mapi id 14.03.0248.002; Wed, 4 Jan 2017 10:03:38 +0800 From: "Zhao1, Wei" To: "Dai, Wei" , "dev@dpdk.org" CC: "Lu, Wenzhuo" Thread-Topic: [dpdk-dev] [PATCH v2 02/18] net/ixgbe: store flow director filter Thread-Index: AQHSYnJv2IjTp9/KsU+ptm0s91k2+aEmUEEAgAFIExA= Date: Wed, 4 Jan 2017 02:03:37 +0000 Message-ID: References: <1483084390-53159-1-git-send-email-wei.zhao1@intel.com> <1483084390-53159-3-git-send-email-wei.zhao1@intel.com> <49759EB36A64CF4892C1AFEC9231E8D63A322651@PGSMSX106.gar.corp.intel.com> In-Reply-To: <49759EB36A64CF4892C1AFEC9231E8D63A322651@PGSMSX106.gar.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.30.20.206] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 02/18] net/ixgbe: store flow director filter 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, 04 Jan 2017 02:03:42 -0000 Hi, weid > -----Original Message----- > From: Dai, Wei > Sent: Tuesday, January 3, 2017 10:28 PM > To: Zhao1, Wei ; dev@dpdk.org > Cc: Lu, Wenzhuo ; Zhao1, Wei > > Subject: RE: [dpdk-dev] [PATCH v2 02/18] net/ixgbe: store flow director f= ilter >=20 > Hi, Wei Zhao >=20 > Would you please do git rebase master for this patch set? > When I do git pull and then git apply this patch, following errors are re= ported: > [root@dpdk4 dpdk-org]# git am ../patches/bundle-488-zhaowei-ixgbe-filter- > api-v2.mbox >=20 This patch is based on dpdk_next_net lib. > Applying: net/ixgbe: store SYN filter > Applying: net/ixgbe: store flow director filter > error: patch failed: drivers/net/ixgbe/ixgbe_ethdev.c:1284 > error: drivers/net/ixgbe/ixgbe_ethdev.c: patch does not apply Patch faile= d at > 0002 net/ixgbe: store flow director filter The copy of the patch that fai= led is > found in: .git/rebase-apply/patch When you have resolved this problem, ru= n > "git am --continue". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao > > Sent: Friday, December 30, 2016 3:53 PM > > To: dev@dpdk.org > > Cc: Lu, Wenzhuo ; Zhao1, Wei > > > > Subject: [dpdk-dev] [PATCH v2 02/18] net/ixgbe: store flow director > > filter > > > > Add support for storing flow director filter in SW. > > > > Signed-off-by: Wenzhuo Lu > > Signed-off-by: Wei Zhao > > --- > > > > v2: > > --add a fdir initialization function in device start process > > --- > > drivers/net/ixgbe/ixgbe_ethdev.c | 55 ++++++++++++++++++++ > > drivers/net/ixgbe/ixgbe_ethdev.h | 19 ++++++- > > drivers/net/ixgbe/ixgbe_fdir.c | 105 > > ++++++++++++++++++++++++++++++++++++++- > > 3 files changed, 176 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index 316e560..de27a73 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -60,6 +60,7 @@ > > #include > > #include > > #include > > +#include > > > > #include "ixgbe_logs.h" > > #include "base/ixgbe_api.h" > > @@ -165,6 +166,7 @@ enum ixgbevf_xcast_modes { > > > > static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev); static > > int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev); > > +static int ixgbe_fdir_filter_init(struct rte_eth_dev *eth_dev); > > static int ixgbe_dev_configure(struct rte_eth_dev *dev); static int > > ixgbe_dev_start(struct rte_eth_dev *dev); static void > > ixgbe_dev_stop(struct rte_eth_dev *dev); @@ -1276,6 +1278,9 @@ > > eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) > > > > /* initialize SYN filter */ > > filter_info->syn_info =3D 0; > > + /* initialize flow director filter list & hash */ > > + ixgbe_fdir_filter_init(eth_dev); > > + > > return 0; > > } > > > > @@ -1284,6 +1289,9 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev > > *eth_dev) { > > struct rte_pci_device *pci_dev; > > struct ixgbe_hw *hw; > > + struct ixgbe_hw_fdir_info *fdir_info =3D > > + IXGBE_DEV_PRIVATE_TO_FDIR_INFO(eth_dev->data- > >dev_private); > > + struct ixgbe_fdir_filter *fdir_filter; > > > > PMD_INIT_FUNC_TRACE(); > > > > @@ -1317,9 +1325,56 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev > > *eth_dev) > > rte_free(eth_dev->data->hash_mac_addrs); > > eth_dev->data->hash_mac_addrs =3D NULL; > > > > + /* remove all the fdir filters & hash */ > > + if (fdir_info->hash_map) > > + rte_free(fdir_info->hash_map); > > + if (fdir_info->hash_handle) > > + rte_hash_free(fdir_info->hash_handle); > > + > > + while ((fdir_filter =3D TAILQ_FIRST(&fdir_info->fdir_list))) { > > + TAILQ_REMOVE(&fdir_info->fdir_list, > > + fdir_filter, > > + entries); > > + rte_free(fdir_filter); > > + } > > + > > return 0; > > } > > > > +static int ixgbe_fdir_filter_init(struct rte_eth_dev *eth_dev) { > > + struct ixgbe_hw_fdir_info *fdir_info =3D > > + IXGBE_DEV_PRIVATE_TO_FDIR_INFO(eth_dev->data- > >dev_private); > > + char fdir_hash_name[RTE_HASH_NAMESIZE]; > > + struct rte_hash_parameters fdir_hash_params =3D { > > + .name =3D fdir_hash_name, > > + .entries =3D IXGBE_MAX_FDIR_FILTER_NUM, > > + .key_len =3D sizeof(union ixgbe_atr_input), > > + .hash_func =3D rte_hash_crc, > > + .hash_func_init_val =3D 0, > > + .socket_id =3D rte_socket_id(), > > + }; > > + > > + TAILQ_INIT(&fdir_info->fdir_list); > > + snprintf(fdir_hash_name, RTE_HASH_NAMESIZE, > > + "fdir_%s", eth_dev->data->name); > > + fdir_info->hash_handle =3D rte_hash_create(&fdir_hash_params); > > + if (!fdir_info->hash_handle) { > > + PMD_INIT_LOG(ERR, "Failed to create fdir hash table!"); > > + return -EINVAL; > > + } > > + fdir_info->hash_map =3D rte_zmalloc("ixgbe", > > + sizeof(struct ixgbe_fdir_filter *) * > > + IXGBE_MAX_FDIR_FILTER_NUM, > > + 0); > > + if (!fdir_info->hash_map) { > > + PMD_INIT_LOG(ERR, > > + "Failed to allocate memory for fdir hash map!"); > > + return -ENOMEM; > > + } > > + > > + return 0; > > +} > > /* > > * Negotiate mailbox API version with the PF. > > * After reset API version is always set to the basic one > (ixgbe_mbox_api_10). > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h > > b/drivers/net/ixgbe/ixgbe_ethdev.h > > index 827026c..8310220 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.h > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h > > @@ -38,6 +38,7 @@ > > #include "base/ixgbe_dcb_82598.h" > > #include "ixgbe_bypass.h" > > #include > > +#include > > > > /* need update link, bit flag */ > > #define IXGBE_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0) @@ -130,10 > > +131,11 @@ > > #define IXGBE_MISC_VEC_ID > > RTE_INTR_VEC_ZERO_OFFSET > > #define IXGBE_RX_VEC_START > > RTE_INTR_VEC_RXTX_OFFSET > > > > +#define IXGBE_MAX_FDIR_FILTER_NUM (1024 * 32) > > + > > /* > > * Information about the fdir mode. > > */ > > - > > struct ixgbe_hw_fdir_mask { > > uint16_t vlan_tci_mask; > > uint32_t src_ipv4_mask; > > @@ -148,6 +150,17 @@ struct ixgbe_hw_fdir_mask { > > uint8_t tunnel_type_mask; > > }; > > > > +struct ixgbe_fdir_filter { > > + TAILQ_ENTRY(ixgbe_fdir_filter) entries; > > + union ixgbe_atr_input ixgbe_fdir; /* key of fdir filter*/ > > + uint32_t fdirflags; /* drop or forward */ > > + uint32_t fdirhash; /* hash value for fdir */ > > + uint8_t queue; /* assigned rx queue */ }; > > + > > +/* list of fdir filters */ > > +TAILQ_HEAD(ixgbe_fdir_filter_list, ixgbe_fdir_filter); > > + > > struct ixgbe_hw_fdir_info { > > struct ixgbe_hw_fdir_mask mask; > > uint8_t flex_bytes_offset; > > @@ -159,6 +172,10 @@ struct ixgbe_hw_fdir_info { > > uint64_t remove; > > uint64_t f_add; > > uint64_t f_remove; > > + struct ixgbe_fdir_filter_list fdir_list; /* filter list*/ > > + /* store the pointers of the filters, index is the hash value. */ > > + struct ixgbe_fdir_filter **hash_map; > > + struct rte_hash *hash_handle; /* cuckoo hash handler */ > > }; > > > > /* structure for interrupt relative data */ diff --git > > a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c > > index > > 4b81ee3..bfcd294 100644 > > --- a/drivers/net/ixgbe/ixgbe_fdir.c > > +++ b/drivers/net/ixgbe/ixgbe_fdir.c > > @@ -43,6 +43,7 @@ > > #include > > #include > > #include > > +#include > > > > #include "ixgbe_logs.h" > > #include "base/ixgbe_api.h" > > @@ -1075,6 +1076,65 @@ fdir_erase_filter_82599(struct ixgbe_hw *hw, > > uint32_t fdirhash) > > > > } > > > > +static inline struct ixgbe_fdir_filter * > > +ixgbe_fdir_filter_lookup(struct ixgbe_hw_fdir_info *fdir_info, > > + union ixgbe_atr_input *key) > > +{ > > + int ret =3D 0; > > + > > + ret =3D rte_hash_lookup(fdir_info->hash_handle, (const void *)key); > > + if (ret < 0) > > + return NULL; > > + > > + return fdir_info->hash_map[ret]; > > +} > > + > > +static inline int > > +ixgbe_insert_fdir_filter(struct ixgbe_hw_fdir_info *fdir_info, > > + struct ixgbe_fdir_filter *fdir_filter) { > > + int ret =3D 0; > > + > > + ret =3D rte_hash_add_key(fdir_info->hash_handle, > > + &fdir_filter->ixgbe_fdir); > > + > > + if (ret < 0) { > > + PMD_DRV_LOG(ERR, > > + "Failed to insert fdir filter to hash table %d!", > > + ret); > > + return ret; > > + } > > + > > + fdir_info->hash_map[ret] =3D fdir_filter; > > + > > + TAILQ_INSERT_TAIL(&fdir_info->fdir_list, fdir_filter, entries); > > + > > + return 0; > > +} > > + > > +static inline int > > +ixgbe_remove_fdir_filter(struct ixgbe_hw_fdir_info *fdir_info, > > + union ixgbe_atr_input *key) > > +{ > > + int ret =3D 0; > > + struct ixgbe_fdir_filter *fdir_filter; > > + > > + ret =3D rte_hash_del_key(fdir_info->hash_handle, key); > > + > > + if (ret < 0) { > > + PMD_DRV_LOG(ERR, "No such fdir filter to delete %d!", ret); > > + return ret; > > + } > > + > > + fdir_filter =3D fdir_info->hash_map[ret]; > > + fdir_info->hash_map[ret] =3D NULL; > > + > > + TAILQ_REMOVE(&fdir_info->fdir_list, fdir_filter, entries); > > + rte_free(fdir_filter); > > + > > + return 0; > > +} > > + > > /* > > * ixgbe_add_del_fdir_filter - add or remove a flow diretor filter. > > * @dev: pointer to the structure rte_eth_dev @@ -1098,6 +1158,8 @@ > > ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev, > > struct ixgbe_hw_fdir_info *info =3D > > IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data- > >dev_private); > > enum rte_fdir_mode fdir_mode =3D dev->data- > >dev_conf.fdir_conf.mode; > > + struct ixgbe_fdir_filter *node; > > + bool add_node =3D FALSE; > > > > if (fdir_mode =3D=3D RTE_FDIR_MODE_NONE) > > return -ENOTSUP; > > @@ -1148,6 +1210,10 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev > *dev, > > dev->data- > >dev_conf.fdir_conf.pballoc); > > > > if (del) { > > + err =3D ixgbe_remove_fdir_filter(info, &input); > > + if (err < 0) > > + return err; > > + > > err =3D fdir_erase_filter_82599(hw, fdirhash); > > if (err < 0) > > PMD_DRV_LOG(ERR, "Fail to delete FDIR filter!"); > @@ -1172,6 > > +1238,37 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev, > > else > > return -EINVAL; > > > > + node =3D ixgbe_fdir_filter_lookup(info, &input); > > + if (node) { > > + if (update) { > > + node->fdirflags =3D fdircmd_flags; > > + node->fdirhash =3D fdirhash; > > + node->queue =3D queue; > > + } else { > > + PMD_DRV_LOG(ERR, "Conflict with existing fdir > filter!"); > > + return -EINVAL; > > + } > > + } else { > > + add_node =3D TRUE; > > + node =3D rte_zmalloc("ixgbe_fdir", > > + sizeof(struct ixgbe_fdir_filter), > > + 0); > > + if (!node) > > + return -ENOMEM; > > + (void)rte_memcpy(&node->ixgbe_fdir, > > + &input, > > + sizeof(union ixgbe_atr_input)); > > + node->fdirflags =3D fdircmd_flags; > > + node->fdirhash =3D fdirhash; > > + node->queue =3D queue; > > + > > + err =3D ixgbe_insert_fdir_filter(info, node); > > + if (err < 0) { > > + rte_free(node); > > + return err; > > + } > > + } > > + > > if (is_perfect) { > > err =3D fdir_write_perfect_filter_82599(hw, &input, queue, > > fdircmd_flags, fdirhash, > > @@ -1180,10 +1277,14 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev > > *dev, > > err =3D fdir_add_signature_filter_82599(hw, &input, queue, > > fdircmd_flags, fdirhash); > > } > > - if (err < 0) > > + if (err < 0) { > > PMD_DRV_LOG(ERR, "Fail to add FDIR filter!"); > > - else > > + > > + if (add_node) > > + (void)ixgbe_remove_fdir_filter(info, &input); > > + } else { > > PMD_DRV_LOG(DEBUG, "Success to add FDIR filter"); > > + } > > > > return err; > > } > > -- > > 2.5.5