[dpdk-dev] [PATCHv2 0/5] ACL library
Hi Konstantin, 2014-05-28 20:26, Konstantin Ananyev: > v2 fixes: > * Fixed several checkpatch.pl issues It seems that many checkpatch issues are remaining. Could you re-check please? Thanks -- Thomas
[dpdk-dev] [PATCH v2 0/2] 10G PMD: vectorized RX and TX functions
Hi Bruce, You are introducing a new option CONFIG_RTE_IXGBE_RX_OLFLAGS_DISABLE. I feel a comment in the code would be helpful here. Sorry for not having checked before but there are some checkpatch issues in this PMD. Other simple cleanup: I think some include directives are useless. Could you rework a new version please? Thanks -- Thomas
[dpdk-dev] [PATCH v2 0/2] 10G PMD: vectorized RX and TX functions
2014-06-11 22:27, Richardson, Bruce: > > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > > You are introducing a new option CONFIG_RTE_IXGBE_RX_OLFLAGS_DISABLE. > > I feel a comment in the code would be helpful here. > > Comment in the code, or in the config file where the option is defined? There are several config files so I think it's more appropriated in the code. And it's not in DPDK habit to add comments in config files. We are used to grep in code ;) -- Thomas
[dpdk-dev] [PATCH] Add an API to query enabled core index
2014-06-11 21:58, Lu, Patrick: > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > > 2014-06-11 13:45, Patrick Lu: > > > The new API rte_lcore_id2() will return an index from enabled lcores > > > starting from zero. > > > > I think core_id2 is not a representative name. > > What do you think of renaming core_id as lcore_hwid and core_id2 as > > lcore_index? > > I think this is a good idea. Except core_id is used in 13 other places. > Should I resubmit the patch with core_id renamed it lcore_hwid? It should be in a separated patch. A patch-serie would be appreciated. By the way, I don't see any reason to integrate this change in DPDK 1.7.0 as we are in feature freeze phase. -- Thomas
[dpdk-dev] [PATCH] Add an API to query enabled core index
2014-06-11 21:57, Richardson, Bruce: > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon > > 2014-06-11 13:45, Patrick Lu: > > > The new API rte_lcore_id2() will return an index from enabled lcores > > > starting from zero. > > > > I think core_id2 is not a representative name. > > What do you think of renaming core_id as lcore_hwid and core_id2 as > > lcore_index? > > I like lcore_index as the name for the new function. However, I'm not sure > in that case that we want/need to rename the old one. I think it would be not easy to distinguish id and index. So I prefer hwid/index. And lcore is more precise than core. -- Thomas
[dpdk-dev] [PATCH] Add an API to query enabled core index
Maybe we could simplify this discussion by simply creating a new function to return the mask of all enabled cores (as provided through -c coremask EAL option) and have the user utilize this mask to derive whatever info it needs? Right now, to get the mask of enabled cores, a for loop is required to test each core index one by one and re-create the mask. In several instances, I needed to know just the number of enabled cores (i.e. number of bits set in -c coremask), and there was no alternative to the for loop above. But given such a function, we can quickly do: uint64_t coremask = rte_eal_coremask(); n_lcores = __builtin_popcountll(coremask); For what Patrick needs: uint32_t lcore_enabled_pos = __builtin_popcountll(coremask & RTE_LEN2MASK(lcore_index)); Regards, Cristian -Original Message- From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Richardson, Bruce Sent: Thursday, June 12, 2014 12:28 AM To: Thomas Monjalon Cc: dev at dpdk.org Subject: Re: [dpdk-dev] [PATCH] Add an API to query enabled core index > -Original Message- > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > Sent: Wednesday, June 11, 2014 3:50 PM > To: Richardson, Bruce > Cc: Lu, Patrick; dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] Add an API to query enabled core index > > 2014-06-11 21:57, Richardson, Bruce: > > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon > > > 2014-06-11 13:45, Patrick Lu: > > > > The new API rte_lcore_id2() will return an index from enabled lcores > > > > starting from zero. > > > > > > I think core_id2 is not a representative name. > > > What do you think of renaming core_id as lcore_hwid and core_id2 as > > > lcore_index? > > > > I like lcore_index as the name for the new function. However, I'm not sure > > in that case that we want/need to rename the old one. > > I think it would be not easy to distinguish id and index. So I prefer > hwid/index. And lcore is more precise than core. > The function is already called "rte_lcore_id()" so there is no need to change it to make it an "lcore" function. That function has been around for a long time and is commonly used, so I'd prefer it not be changed unless it really is necessary. "rte_lcore_index" is a sufficiently different function name, in my opinion. The API documentation should clear up any confusion for the user anyway. -- Intel Shannon Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 Business address: Dromore House, East Park, Shannon, Co. Clare This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
[dpdk-dev] [PATCH v2 05/27] mbuf: add new packet flags for i40e
Adding cc list. -Original Message- From: Zhang, Helin Sent: Friday, June 6, 2014 8:30 AM To: Stephen Hemminger Subject: RE: [dpdk-dev] [PATCH v2 05/27] mbuf: add new packet flags for i40e Hi Hemminger Thanks for pointing out that! As ol_flags is currently 16 bits, we do not have additional bits for new flags. I just add the flags there, and wait the new mbuf structure to be defined, which will be happen soon. After that, the new values will be added. Regards, Helin -Original Message- From: Stephen Hemminger [mailto:step...@networkplumber.org] Sent: Thursday, June 5, 2014 11:30 PM To: Zhang, Helin Cc: dev at dpdk.org Subject: Re: [dpdk-dev] [PATCH v2 05/27] mbuf: add new packet flags for i40e On Thu, 5 Jun 2014 13:08:49 +0800 Helin Zhang wrote: > +#define PKT_RX_EIP_CKSUM_BAD 0x /**< External IP header checksum error. > */ > +#define PKT_RX_OVERSIZE 0x /**< Num of desc of an RX pkt oversize. > */ > +#define PKT_RX_HBUF_OVERFLOW 0x /**< Header buffer overflow. */ > +#define PKT_RX_RECIP_ERR 0x /**< Hardware processing error. */ > +#define PKT_RX_MAC_ERR 0x /**< MAC error. */ Flags are useless if all zero!
[dpdk-dev] tailroom in rte_mbuf
Hello, My application requires to reserve some tailroom in the packet mbuf after the packet payload. I see that in the default configuration the packet mbuf reserves only the headroom. When I send larger packets, the payload is copied until the last byte of the packet mbuf before going to next mbuf. I know I can do it by modifying the rte_pktmbuf_init and keep some tailroom for myself. But is there a parameter already available in DPDK which allows me to do this. Do we need a patch for this ? Regards, Vivek Soni
[dpdk-dev] [PATCH] examples/vmdq: Fix core id issue for TX burst
This patch fixes a core id issue in sample vmdq, in case core mask doesn't start with lcore_id 0 but 20, for instance, it should use core_id instead of lcore_id. Signed-off-by: Ouyang Changchun Tested-by: Waterman Cao This patch includes 1 file, and has been tested by Intel. Please see information as the following: Fedora 20 X86_64, Linux Kernel 3.13.9, GCC 4.8.2 Intel Xeon CPU E5-2680 v2 @ 2.80GHz NIC: Intel Niantic 82599 --- examples/vmdq/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 0f52bdd..4dde37a 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -534,7 +534,7 @@ lcore_main(__attribute__((__unused__)) void* dummy) update_mac_address(buf[i], dport); const uint16_t txCount = rte_eth_tx_burst(dport, - lcore_id, buf, rxCount); + core_id, buf, rxCount); if (txCount != rxCount) { for (i = txCount; i < rxCount; i++) -- 1.9.0
[dpdk-dev] [PATCH v2 0/4] NIC filters support for generic filter
Hi, Thomas Thanks for your reply. About your first concern: The pool field is used in virtualization scenario. It is acting as one of input set during filter matching in ixgbe. My patch didn't consider the virtualization scenario in generic filter feature. Because in 82599 datasheet, it is recommended to assign rx queues not used by DCB/RSS, that is virtualization without RSS and DCB mode. For this mode, current DPDK version makes the number of queue to 1 by default in IOV mode. So in this case it makes no sense make pool as a input set and the rx queue also need to be set to in this pool, so just keep the consistent with flow director who also ignore it in previous version. And further E1000/Niantic/Fortville have different definitions for VF, we need to think how to define it more generic. And even just need offer pool number in configuration of the filters as what Vladimir did, it also need to verify the interworking with Virtualization for different kinds of NICs, and the interworking with DCB and RSS which is not recommended in 82599's datasheet. So I think it will be a good choice to implement generic filter interworking with virtualization in future patch. If there is any volunteer to send patch for support this concern later, it will be also cool. About your second concern: I will send out a new version for that soon. -Original Message- From: Thomas Monjalon [mailto:thomas.monja...@6wind.com] Sent: Wednesday, June 11, 2014 11:45 PM To: Wu, Jingjing Cc: dev at dpdk.org; Vladimir Medvedkin Subject: Re: [dpdk-dev] [PATCH v2 0/4] NIC filters support for generic filter Hi Jingjing, Please reply below the question. 2014-05-28 01:12, Wu, Jingjing: > You are discussing whether the APIs provide for NIC filters is generic > or not. About that we can use same API for a type of filter. For > example, if we want to configure ethertype filter, we can use the same > API, no matter the NIC is 82580, i350, 82576 or 82599. We think these > NICs may be most common used. I was wondering if this API can apply to non-Intel devices. But nobody talked about it. So let's forget it. My main concern is that Vladimir Medvedkin suggested another API and I'd like you give your opinion about it: http://dpdk.org/ml/archives/dev/2014-June/003053.html It offers pool number in configuration of the filters. Last comment: patches would be more pleasant to read with right alignment and spaces in comments. This is an extract to illustrate what I'm talking about: + uint16_t priority; /**< used when more than one filter matches */ + uint8_t dst_port_mask : 1, /**
[dpdk-dev] [PATCH] kni: compatibility with RHEL 7
From: Hiroshi Shimamoto Compilation in RHEL7 is failed. This fixes the build issue. RHEL7 has skb_set_hash, the kernel version is 3.10 though. Don't define skb_set_hash for RHEL7. Signed-off-by: Hiroshi Shimamoto Reviewed-by: Hayato Momma --- lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 5 + 1 file changed, 5 insertions(+) diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h index 4c27d5d..b4de6e2 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h @@ -3843,6 +3843,9 @@ static inline struct sk_buff *__kc__vlan_hwaccel_put_tag(struct sk_buff *skb, #endif /* >= 3.10.0 */ #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) ) + +#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,0))) + #ifdef NETIF_F_RXHASH #define PKT_HASH_TYPE_L3 0 static inline void @@ -3851,6 +3854,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type) skb->rxhash = hash; } #endif /* NETIF_F_RXHASH */ +#endif /* < RHEL7 */ + #endif /* < 3.14.0 */ #endif /* _KCOMPAT_H_ */ -- 1.9.1
[dpdk-dev] [PATCH] rte_memory.h: include stdio.h for FILE
From: Hiroshi Shimamoto The below commit requires stdio FILE structure. commit 591a9d7985c1230652d9f7ea1f9221e8c66ec188 Author: Stephen Hemminger Date: Fri May 2 16:42:56 2014 -0700 add FILE argument to debug functions Application which includes rte_memory.h without stdio.h will be hit compilation failure. /path/to/include/rte_memory.h:146:30: error: unknown type name ?FILE? void rte_dump_physmem_layout(FILE *f); Signed-off-by: Hiroshi Shimamoto Reviewed-by: Hayato Momma --- lib/librte_eal/common/include/rte_memory.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h index 7f21244..4cf8ea9 100644 --- a/lib/librte_eal/common/include/rte_memory.h +++ b/lib/librte_eal/common/include/rte_memory.h @@ -42,6 +42,7 @@ #include #include +#include #ifdef RTE_EXEC_ENV_LINUXAPP #include -- 1.9.1
[dpdk-dev] [PATCH] Add an API to query enabled core index
Hello, On 06/11/2014 11:57 PM, Richardson, Bruce wrote: >> I think core_id2 is not a representative name. >> What do you think of renaming core_id as lcore_hwid and core_id2 as >> lcore_index? >> >> -- > I like lcore_index as the name for the new function. However, I'm not sure in > that case that we want/need to rename the old one. What about lcore_rank ? It may avoid confusion between "id" and "index", which are quite close visually and phonetically. I agree that we should not change the old lcore_id, its name is already appropriate. Regards, Olivier
[dpdk-dev] [PATCH] kni: compatibility with RHEL 7
Hi Shimamoto, Can you give details about Linux Kernel version and complier version? Because we tried to build code in the Redhat 7.0 before, but we don't meet this issue. Please see information as the following: Linux kernel 3.10.0-54.0.1.el7.x86_64 RHEL70BETA_64 GCC 4.8.2 ICC: 14.0.0 Thanks Waterman -Original Message- >From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Hiroshi Shimamoto >Sent: Thursday, June 12, 2014 4:10 PM >To: dev at dpdk.org >Cc: Hayato Momma >Subject: [dpdk-dev] [PATCH] kni: compatibility with RHEL 7 > >From: Hiroshi Shimamoto > >Compilation in RHEL7 is failed. This fixes the build issue. > >RHEL7 has skb_set_hash, the kernel version is 3.10 though. >Don't define skb_set_hash for RHEL7. > >Signed-off-by: Hiroshi Shimamoto >Reviewed-by: Hayato Momma >--- > lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 5 + > 1 file changed, 5 insertions(+) > >diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h >b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h >index 4c27d5d..b4de6e2 100644 >--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h >+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h >@@ -3843,6 +3843,9 @@ static inline struct sk_buff >*__kc__vlan_hwaccel_put_tag(struct sk_buff *skb, #endif /* >= 3.10.0 */ > > #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) ) >+ >+#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= >+RHEL_RELEASE_VERSION(7,0))) >+ > #ifdef NETIF_F_RXHASH > #define PKT_HASH_TYPE_L3 0 > static inline void >@@ -3851,6 +3854,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, >__always_unused int type) > skb->rxhash = hash; > } > #endif /* NETIF_F_RXHASH */ >+#endif /* < RHEL7 */ >+ > #endif /* < 3.14.0 */ > > #endif /* _KCOMPAT_H_ */ >-- >1.9.1 >
[dpdk-dev] [PATCH] kni: compatibility with RHEL 7
Hi, > Subject: RE: [PATCH] kni: compatibility with RHEL 7 > > Hi Shimamoto, > > Can you give details about Linux Kernel version and complier version? > Because we tried to build code in the Redhat 7.0 before, but we don't meet > this issue. > Please see information as the following: > Linux kernel 3.10.0-54.0.1.el7.x86_64 > RHEL70BETA_64 GCC 4.8.2 ICC: 14.0.0 Yes, Linux REHEL7RC-1 3.10.0-121.el7.x86_64 #1 SMP Tue Apr 8 10:48:19 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) I got the below error; /path/to/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h:3851:1: error: conflicting types for ?skb_set_hash? skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type) /usr/src/kernels/3.10.0-121.el7.x86_64/include/linux/skbuff.h:762:1: note: previous definition of ?skb_set_hash? was here skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) thanks, Hiroshi > > Thanks > > Waterman > > -Original Message- > >From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Hiroshi Shimamoto > >Sent: Thursday, June 12, 2014 4:10 PM > >To: dev at dpdk.org > >Cc: Hayato Momma > >Subject: [dpdk-dev] [PATCH] kni: compatibility with RHEL 7 > > > >From: Hiroshi Shimamoto > > > >Compilation in RHEL7 is failed. This fixes the build issue. > > > >RHEL7 has skb_set_hash, the kernel version is 3.10 though. > >Don't define skb_set_hash for RHEL7. > > > >Signed-off-by: Hiroshi Shimamoto > >Reviewed-by: Hayato Momma > >--- > > lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 5 + > > 1 file changed, 5 insertions(+) > > > >diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > >b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > >index 4c27d5d..b4de6e2 100644 > >--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > >+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > >@@ -3843,6 +3843,9 @@ static inline struct sk_buff > >*__kc__vlan_hwaccel_put_tag(struct sk_buff *skb, #endif /* >= 3.10.0 > */ > > > > #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) ) > >+ > >+#if (!(RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= > >+RHEL_RELEASE_VERSION(7,0))) > >+ > > #ifdef NETIF_F_RXHASH > > #define PKT_HASH_TYPE_L3 0 > > static inline void > >@@ -3851,6 +3854,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, > >__always_unused int type) > > skb->rxhash = hash; > > } > > #endif /* NETIF_F_RXHASH */ > >+#endif /* < RHEL7 */ > >+ > > #endif /* < 3.14.0 */ > > > > #endif /* _KCOMPAT_H_ */ > >-- > >1.9.1 > >
[dpdk-dev] [PATCHv2 0/2] L3FWD sample optimisation
> Konstantin Ananyev (2): > lpm: Introduce rte_lpm_lookupx4 > l3fwd: reorganise and optimize l3fwd LPM code path. Applied for version 1.7.0. Thanks -- Thomas
[dpdk-dev] [PATCH v3 0/4] NIC filters support for generic filter
--- the v3 patchset changes: --- comments alignment --- the v2 patchset changes: --- add NIC filter support for 82576 --- rework for the whitespace and tab warning if using git apply to apply patch A generic filter mechanism for handling special packet is required. It will allow filters to be set in HW when available so that specific packet may be filtered by NICs to specific descriptor queues for processing. Currently only Flow Director for Intel's 10GbE 82599 devices is available. Other types of filter are not support. NIC filters list below are implemented in this patchset: ethertype filter, syn filter, 2tuple filter and flex filter for 82580 and i350 ethertype filter, syn filter, 5tuple filter for 82576 ethertype filter, syn filter and 5tuple filter for 82599 jingjing.wu (4): add ethdev APIs for NIC filters of generic filter add igb NIC filters of generic filter feature add ixgbe NIC filters of generic filter feature add commands in testpmd for NIC filters app/test-pmd/cmdline.c | 907 +++- app/test-pmd/config.c | 145 ++ app/test-pmd/testpmd.h | 5 + lib/librte_ether/rte_ethdev.c | 281 +++ lib/librte_ether/rte_ethdev.h | 425 + lib/librte_pmd_e1000/e1000_ethdev.h | 53 +++ lib/librte_pmd_e1000/igb_ethdev.c | 745 + lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 408 lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 34 ++ 9 files changed, 3002 insertions(+), 1 deletion(-) -- 1.8.1.4
[dpdk-dev] [PATCH v3 1/4] ethdev: add ethdev APIs for NIC filters of generic filter
This patch adds APIs for NIC filters list below: ethertype filter, syn filter, 2tuple filter, flex filter, 5tuple filter Signed-off-by: jingjing.wu --- lib/librte_ether/rte_ethdev.c | 281 lib/librte_ether/rte_ethdev.h | 425 ++ 2 files changed, 706 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 8011b8b..8b946ad 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -2606,3 +2607,283 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id) return 0; } #endif + +int +rte_eth_dev_add_syn_filter(uint8_t port_id, uint8_t high_pri, + uint8_t rx_queue) +{ + struct rte_eth_dev *dev; + struct rte_syn_filter filter; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return -ENODEV; + } + + dev = &rte_eth_devices[port_id]; + filter.enable = 1; + filter.hig_pri = high_pri; + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_syn_filter, -ENOTSUP); + return (*dev->dev_ops->set_syn_filter)(dev, &filter, rx_queue); +} + +int +rte_eth_dev_remove_syn_filter(uint8_t port_id) +{ + struct rte_eth_dev *dev; + struct rte_syn_filter filter; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return -ENODEV; + } + + dev = &rte_eth_devices[port_id]; + filter.enable = 0; + filter.hig_pri = 0; + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_syn_filter, -ENOTSUP); + return (*dev->dev_ops->set_syn_filter)(dev, &filter, 0); +} + +int +rte_eth_dev_get_syn_filter(uint8_t port_id, + struct rte_syn_filter *filter, uint8_t *rx_queue) +{ + struct rte_eth_dev *dev; + + if (filter == NULL || rx_queue == NULL) + return -EINVAL; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return -ENODEV; + } + + dev = &rte_eth_devices[port_id]; + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_syn_filter, -ENOTSUP); + return (*dev->dev_ops->get_syn_filter)(dev, filter, rx_queue); +} + +int +rte_eth_dev_add_ethertype_filter(uint8_t port_id, uint16_t index, + struct rte_ethertype_filter *filter, uint8_t rx_queue) +{ + struct rte_eth_dev *dev; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return -ENODEV; + } + if (filter->ethertype == ETHER_TYPE_IPv4 || + filter->ethertype == ETHER_TYPE_IPv6){ + PMD_DEBUG_TRACE("IP and IPv6 are not supported" + " in ethertype filter\n"); + return -EINVAL; + } + dev = &rte_eth_devices[port_id]; + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->add_ethertype_filter, -ENOTSUP); + return (*dev->dev_ops->add_ethertype_filter)(dev, index, + filter, rx_queue); +} + +int +rte_eth_dev_remove_ethertype_filter(uint8_t port_id, uint16_t index) +{ + struct rte_eth_dev *dev; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return -ENODEV; + } + + dev = &rte_eth_devices[port_id]; + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->remove_ethertype_filter, -ENOTSUP); + return (*dev->dev_ops->remove_ethertype_filter)(dev, index); +} + +int +rte_eth_dev_get_ethertype_filter(uint8_t port_id, uint16_t index, + struct rte_ethertype_filter *filter, uint8_t *rx_queue) +{ + struct rte_eth_dev *dev; + + if (filter == NULL || rx_queue == NULL) + return -EINVAL; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return -ENODEV; + } + + dev = &rte_eth_devices[port_id]; + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_ethertype_filter, -ENOTSUP); + return (*dev->dev_ops->get_ethertype_filter)(dev, index, + filter, rx_queue); +} + +int +rte_eth_dev_add_2tuple_filter(uint8_t port_id, uint16_t index, + struct rte_2tuple_filter *filter, uint8_t rx_queue) +{ + struct rte_eth_dev *dev; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return -ENODEV; + } + if (filter->protocol != IPPROTO_TCP && + filter->tcp_flags != 0){ + PMD_DEBUG_TRACE("tcp flags is 0x%x, but the protocol value" + " is not TCP\n", + filter->tcp_flags); + return -EINVAL; + } + + dev = &rte_eth_devices[port_id]; +
[dpdk-dev] [PATCH v3 2/4] e1000: add igb NIC filters of generic filter feature
This patch adds following igb NIC filters implement: syn filter, ethertype filter, 2tuple filter, flex filter for intel NIC 82580 and i350 syn filter, ethertype filter, 5tuple filter for intel NIC 82576 Signed-off-by: jingjing.wu --- lib/librte_pmd_e1000/e1000_ethdev.h | 53 +++ lib/librte_pmd_e1000/igb_ethdev.c | 745 2 files changed, 798 insertions(+) diff --git a/lib/librte_pmd_e1000/e1000_ethdev.h b/lib/librte_pmd_e1000/e1000_ethdev.h index a287f40..71eb5fb 100644 --- a/lib/librte_pmd_e1000/e1000_ethdev.h +++ b/lib/librte_pmd_e1000/e1000_ethdev.h @@ -52,6 +52,59 @@ #define E1000_CTRL_EXT_EXTEND_VLAN (1<<26)/* EXTENDED VLAN */ #define IGB_VFTA_SIZE 128 +#define IGB_MAX_RX_QUEUE_NUM 8 +#define IGB_MAX_RX_QUEUE_NUM_82576 16 + +#define E1000_SYN_FILTER_ENABLE0x0001 /* syn filter enable field */ +#define E1000_SYN_FILTER_QUEUE 0x000E /* syn filter queue field */ +#define E1000_SYN_FILTER_QUEUE_SHIFT 1 /* syn filter queue field */ +#define E1000_RFCTL_SYNQFP 0x0008 /* SYNQFP in RFCTL register */ + +#define E1000_ETQF_ETHERTYPE 0x +#define E1000_ETQF_QUEUE 0x0007 +#define E1000_ETQF_QUEUE_SHIFT 16 +#define E1000_MAX_ETQF_FILTERS 8 + +#define E1000_IMIR_DSTPORT 0x +#define E1000_IMIR_PRIORITY0xE000 +#define E1000_IMIR_EXT_SIZE_BP 0x1000 +#define E1000_IMIR_EXT_CTRL_UGR0x2000 +#define E1000_IMIR_EXT_CTRL_ACK0x4000 +#define E1000_IMIR_EXT_CTRL_PSH0x8000 +#define E1000_IMIR_EXT_CTRL_RST0x0001 +#define E1000_IMIR_EXT_CTRL_SYN0x0002 +#define E1000_IMIR_EXT_CTRL_FIN0x0004 +#define E1000_IMIR_EXT_CTRL_BP 0x0008 +#define E1000_MAX_TTQF_FILTERS 8 +#define E1000_2TUPLE_MAX_PRI 7 + +#define E1000_MAX_FLEXIBLE_FILTERS 8 +#define E1000_MAX_FHFT 4 +#define E1000_MAX_FHFT_EXT 4 +#define E1000_MAX_FLEX_FILTER_PRI7 +#define E1000_MAX_FLEX_FILTER_LEN128 +#define E1000_FHFT_QUEUEING_LEN 0x007F +#define E1000_FHFT_QUEUEING_QUEUE0x0700 +#define E1000_FHFT_QUEUEING_PRIO 0x0007 +#define E1000_FHFT_QUEUEING_OFFSET 0xFC +#define E1000_FHFT_QUEUEING_QUEUE_SHIFT 8 +#define E1000_FHFT_QUEUEING_PRIO_SHIFT 16 +#define E1000_WUFC_FLEX_HQ 0x4000 + +#define E1000_SPQF_SRCPORT 0x + +#define E1000_MAX_FTQF_FILTERS 8 +#define E1000_FTQF_PROTOCOL_MASK 0x00FF +#define E1000_FTQF_5TUPLE_MASK_SHIFT 28 +#define E1000_FTQF_PROTOCOL_COMP_MASK0x1000 +#define E1000_FTQF_SOURCE_ADDR_MASK 0x2000 +#define E1000_FTQF_DEST_ADDR_MASK0x4000 +#define E1000_FTQF_SOURCE_PORT_MASK 0x8000 +#define E1000_FTQF_VF_MASK_EN0x8000 +#define E1000_FTQF_QUEUE_MASK0x03ff +#define E1000_FTQF_QUEUE_SHIFT 16 +#define E1000_FTQF_QUEUE_ENABLE 0x0100 + /* structure for interrupt relative data */ struct e1000_interrupt { uint32_t flags; diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c index 6e835c3..f043c28 100644 --- a/lib/librte_pmd_e1000/igb_ethdev.c +++ b/lib/librte_pmd_e1000/igb_ethdev.c @@ -124,6 +124,43 @@ static int eth_igb_rss_reta_update(struct rte_eth_dev *dev, static int eth_igb_rss_reta_query(struct rte_eth_dev *dev, struct rte_eth_rss_reta *reta_conf); +static int eth_igb_set_syn_filter(struct rte_eth_dev *dev, + struct rte_syn_filter *filter, uint8_t rx_queue); +static int eth_igb_get_syn_filter(struct rte_eth_dev *dev, + struct rte_syn_filter *filter, uint8_t *rx_queue); +static int eth_igb_add_ethertype_filter(struct rte_eth_dev *dev, + uint16_t index, + struct rte_ethertype_filter *filter, uint8_t rx_queue); +static int eth_igb_remove_ethertype_filter(struct rte_eth_dev *dev, + uint16_t index); +static int eth_igb_get_ethertype_filter(struct rte_eth_dev *dev, + uint16_t index, + struct rte_ethertype_filter *filter, uint8_t *rx_queue); +static int eth_igb_add_2tuple_filter(struct rte_eth_dev *dev, + uint16_t index, + struct rte_2tuple_filter *filter, uint8_t rx_queue); +static int eth_igb_remove_2tuple_filter(struct rte_eth_dev *dev, + uint16_t index); +static int eth_igb_get_2tuple_filter(struct rte_eth_dev *dev, + uint16_t index, + struct rte_2tuple_filter *filter, uint8_t *rx_queue); +static int eth_igb_add_flex_filter(struct rte_eth_dev *dev, + uint16_t index, + struct rte_flex_filter *filter, uint8_t rx_queue); +static int
[dpdk-dev] [PATCH v3 4/4] app/test-pmd: add commands in testpmd for NIC filters
add commands in testpmd for NIC filters: add_ethertype_filter remove_ethertype_filter get_ethertype_filter add_2tuple_filter remove_2tuple_filter get_2tuple_filter add_5tuple_filter remove_5tuple_filter get_5tuple_filter add_syn_filter remove_syn_filter get_syn_filter add_flex_filter remove_flex_filter get_flex_filter Signed-off-by: jingjing.wu --- app/test-pmd/cmdline.c | 907 - app/test-pmd/config.c | 145 app/test-pmd/testpmd.h | 5 + 3 files changed, 1056 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 4678977..fca23c5 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -113,6 +113,7 @@ static void cmd_help_brief_parsed(__attribute__((unused)) void *parsed_result, "help ports : Configuring ports.\n" "help flowdir: Flow Director filter help.\n" "help registers : Reading and setting port registers.\n" + "help filters: Filters configuration help.\n" "help all: All of the above sections.\n\n" ); @@ -554,6 +555,67 @@ static void cmd_help_long_parsed(void *parsed_result, "Set single bit value of a port register.\n\n" ); } + if (show_all || !strcmp(res->section, "filters")) { + + cmdline_printf( + cl, + "\n" + "filters:\n" + "--\n\n" + + "add_ethertype_filter (port_id) ethertype (eth_value)" + " priority (enable|disable)(pri_value) queue (queue_id) index (idx)\n" + "add an ethertype filter.\n\n" + + "remove_ethertype_filter (port_id) index (idx)\n" + "remove an ethertype filter.\n\n" + + "get_ethertype_filter (port_id) index (idx)\n" + "get info of a ethertype filter.\n\n" + + "add_2tuple_filter (port_id) protocol (pro_value) (pro_mask)" + " dst_port (port_value) (port_mask) flags (flg_value) priority (prio_value)" + " queue (queue_id) index (idx)\n" + "add a 2tuple filter.\n\n" + + "remove_2tuple_filter (port_id) index (idx)\n" + "remove a 2tuple filter.\n\n" + + "get_2tuple_filter (port_id) index (idx)\n" + "get info of a 2tuple filter.\n\n" + + "add_5tuple_filter (port_id) dst_ip (dst_address) src_ip (src_address)" + " dst_port (dst_port_value) src_port (src_port_value) protocol (protocol_value)" + " mask (mask_value) flags (flags_value) priority (prio_value)" + " queue (queue_id) index (idx)\n" + "add a 5tuple filter.\n\n" + + "remove_5tuple_filter (port_id) index (idx)\n" + "remove a 5tuple filter.\n\n" + + "get_5tuple_filter (port_id) index (idx)\n" + "get info of a 5tuple filter.\n\n" + + "add_syn_filter (port_id) priority (high|low) queue (queue_id)" + "add syn filter.\n\n" + + "remove_syn_filter (port_id)" + "remove syn filter.\n\n" + + "get_syn_filter (port_id) " + "get syn filter info.\n\n" + + "add_flex_filter (port_id) len (len_value) bytes (bytes_string) mask (mask_value)" + " priority (prio_value) queue (queue_id) index (idx)\n" + "add a flex filter.\n\n" + + "remove_flex_filter (port_id) index (idx)\n" + "remove a flex filter.\n\n" + + "get_flex_filter (port_id) index (idx)\n" + "get info of a flex filter.\n\n" + ); + } } cmdline_parse_token_string_t cmd_help_long_help = @@ -562,7 +624,7 @@ cmdline_parse_token_string_t cmd_help_long_help = cmdline_parse_token_string_t cmd_help_long_section = TOKEN_STRING_INITIALIZER(struct cmd_help_long_result, section, "all#control#display#config#flowdir#" - "ports#registers"); + "ports#registers#filters"); cmdline_parse_inst_t cmd_help_long = { .f = cmd_help_long_parsed, @@ -5534,6 +5596,834 @@ cmdline_parse_inst_t cmd_dump_one = { }, }; +/* *** ADD/REMOVE an ethertype FILTER *** */ +struct cmd_ethertype_filter_result { + cmdline_fixed_string_t filter; + uint8_t port_id; + cmdline_fixed_string_t ethertype; + uint16_t ethertype_value;
[dpdk-dev] [PATCH v3 3/4] ixgbe: add ixgbe NIC filters of generic filter feature
This patch adds following ixgbe NIC filters implement: syn filter, ethertype filter, 5tuple filter for intel NIC 82599 Signed-off-by: jingjing.wu --- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 408 lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 34 +++ 2 files changed, 442 insertions(+) diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index 10e5633..5f6a0f7 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -196,6 +197,22 @@ static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); +static int ixgbe_set_syn_filter(struct rte_eth_dev *dev, + struct rte_syn_filter *filter, uint8_t rx_queue); +static int ixgbe_get_syn_filter(struct rte_eth_dev *dev, + struct rte_syn_filter *filter, uint8_t *rx_queue); +static int ixgbe_add_ethertype_filter(struct rte_eth_dev *dev, uint16_t index, + struct rte_ethertype_filter *filter, uint8_t rx_queue); +static int ixgbe_remove_ethertype_filter(struct rte_eth_dev *dev, + uint16_t index); +static int ixgbe_get_ethertype_filter(struct rte_eth_dev *dev, uint16_t index, + struct rte_ethertype_filter *filter, uint8_t *rx_queue); +static int ixgbe_add_5tuple_filter(struct rte_eth_dev *dev, uint16_t index, + struct rte_5tuple_filter *filter, uint8_t rx_queue); +static int ixgbe_remove_5tuple_filter(struct rte_eth_dev *dev, + uint16_t index); +static int ixgbe_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index, + struct rte_5tuple_filter *filter, uint8_t *rx_queue); /* * Define VF Stats MACRO for Non "cleared on read" register @@ -326,6 +343,14 @@ static struct eth_dev_ops ixgbe_eth_dev_ops = { #endif /* RTE_NIC_BYPASS */ .rss_hash_update = ixgbe_dev_rss_hash_update, .rss_hash_conf_get= ixgbe_dev_rss_hash_conf_get, + .set_syn_filter = ixgbe_set_syn_filter, + .get_syn_filter = ixgbe_get_syn_filter, + .add_ethertype_filter= ixgbe_add_ethertype_filter, + .remove_ethertype_filter = ixgbe_remove_ethertype_filter, + .get_ethertype_filter= ixgbe_get_ethertype_filter, + .add_5tuple_filter = ixgbe_add_5tuple_filter, + .remove_5tuple_filter= ixgbe_remove_5tuple_filter, + .get_5tuple_filter = ixgbe_get_5tuple_filter, }; /* @@ -3388,6 +3413,389 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } } +/* + * set the syn filter + * + * @param + * dev: Pointer to struct rte_eth_dev. + * syn: 1 means enable, 0 means disable. + * rx_queue: the queue id the filter assigned to. + * + * @return + *- On success, zero. + *- On failure, a negative value. + */ +static int +ixgbe_set_syn_filter(struct rte_eth_dev *dev, + struct rte_syn_filter *filter, uint8_t rx_queue) +{ + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + uint32_t synqf; + + if (hw->mac.type != ixgbe_mac_82599EB) + return -ENOSYS; + + if (rx_queue >= IXGBE_MAX_RX_QUEUE_NUM) + return -EINVAL; + + synqf = IXGBE_READ_REG(hw, IXGBE_SYNQF); + + if (filter->enable) + synqf = (uint32_t)(((rx_queue << IXGBE_SYN_FILTER_QUEUE_SHIFT) & + IXGBE_SYN_FILTER_QUEUE) | IXGBE_SYN_FILTER_ENABLE); + else + synqf &= ~(IXGBE_SYN_FILTER_QUEUE | IXGBE_SYN_FILTER_ENABLE); + + if (filter->hig_pri) + synqf |= IXGBE_SYN_FILTER_SYNQFP; + else + synqf &= ~IXGBE_SYN_FILTER_SYNQFP; + + IXGBE_WRITE_REG(hw, IXGBE_SYNQF, synqf); + return 0; +} + +/* + * get the syn filter's info + * + * @param + * dev: Pointer to struct rte_eth_dev. + * *syn: pointer to syn value (1 means enable, 0 means disable). + * *rx_queue: pointer to the queue id the filter assigned to. + * + * @return + *- On success, zero. + *- On failure, a negative value. + */ +static int +ixgbe_get_syn_filter(struct rte_eth_dev *dev, + struct rte_syn_filter *filter, uint8_t *rx_queue) + +{ + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + uint32_t synqf; + + if (hw->mac.type != ixgbe_mac_82599EB) + return -ENOSYS; + + synqf = IXGBE_READ_REG(hw, IXGBE_SYNQF); + filter->enable = (synqf & IXGBE_SYN_FILTER_ENABLE) ? 1 : 0; + filter->hig_pri = (synqf & IXGBE_SYN_FILTER_SYNQFP) ? 1 : 0; + *rx_queue = (uint8_t)((synqf & IXGBE_SYN_FILTER_QUEUE) >> 1); + r
[dpdk-dev] [PATCH v2 0/5] New library: rte_distributor
> This adds a new library to the Intel DPDK whereby a set of packets can be > distributed one-at-a-time to a set of worker cores, with dynamic load > balancing being done between those workers. Flows are identified by a tag > within the mbuf (currently the RSS hash field, 32-bit value), which is used > to ensure that no two packets of the same flow are processed in parallel, > thereby preserving ordering. > > Major changes in V2 set: > * Updates to take account of Neil's comments on original patch set > * Updates to fix issues highlighted by checkpatch.pl > * Additional handling in library for special case when process() is called with zero mbufs > > Bruce Richardson (5): > eal: add tailq for new distributor component > distributor: new packet distributor library > distributor: add distributor library to build > distributor: add unit tests for distributor lib > docs: add distributor lib to API docs lib Acked-by: Neil Horman Tested-by: Waterman Cao I've added a doxygen comment @file in order to generate the according entry. Makefiles and configs are merged with the main patch (no need to split here). Applied for version 1.7.0. Thanks -- Thomas
[dpdk-dev] [PATCH 3/5] ethdev: add mtu accessors
Hello Konstantin, Mmm, good points. I am looking into them. I will send new patches by tomorrow (hopefully). On 06/10/2014 07:23 PM, Ananyev, Konstantin wrote: > Hi David, > >> This patch adds two new functions in ethdev api to retrieve current MTU and >> change MTU of a port. >> These operations have been implemented for rte_em_pmd, rte_igb_pmd and >> rte_ixgbe_pmd. > >> + >> +void ixgbe_dev_set_rx_scatter_mode(struct rte_eth_dev *dev) >> +{ >> +if (dev->rx_pkt_burst != ixgbe_recv_scattered_pkts) { >> +dev->rx_pkt_burst = ixgbe_recv_scattered_pkts; >> +/* we must ensure that this is done when we leave the >> + function */ >> +rte_wmb(); >> +} >> +} > > I don't think it is safe to change RX function on the fly (without calling > dev_stop first). > If before that ixgbe_recv_pkts_bulk_alloc() was used, then up to 32 mbufs > could be stored internally in the stage[], > and ixgbe_recv_scattered_pkts() doesn't have a clue about them. > Also with ixgbe_recv_pkts_bulk_alloc(), it could be up to rx_free_thresh RX > descriptors not armed yet with proper buffer addresses, > while ixgbe_recv_scattered_pkts() doesn't expect that - it re-arms RXD > straight after it receives a packet from it. > > I wonder is the ability to change mtu on the fly (without dev_stop) is really > needed? > If so, then we probably can allow ixgbe_dev_set_mtu() to increase MTU only if > new frame size is less than RX buffer size OR that device already using > ixgbe_recv_scattered_pkts(). > Something like: > frame_size <= rx_buf_size || dev->rx_pkt_burst == ixgbe_recv_scattered_pkts > > >> +static int >> +ixgbe_dev_set_mtu(struct rte_eth_dev *dev, uint16_t *mtu) >> +{ >> >> + >> +/* switch to jumbo mode if needed */ >> +if (frame_size > ETHER_MAX_LEN) { > > Why ETHER_MAX_LEN? > If we have rx_buffer big enough, we don't need to split packets even for > jumbo frames. > Shouldn't it be something like inside ixgbe_dev_rx_init(): > If (mtu + 2 * IXGBE_VLAN_TAG_SIZE) > rx_buf_size) {... > > Same thing for igb. > -- David Marchand
[dpdk-dev] A deadlock may occur in kni kernel thread while netif_receive_skb is called
Hi, all. I have found recently the Linux kernel will complain occasionally a dead lock, while I use the kernel module rte_kni provided in DPDK. After reviewing the dpdk source code and googling, I found that the deadlock occurred because netif_receive_skb is invoked in a non-softirq context. The erroneous source code is listed as below (in lib/librte_eal/linuxapp/kni/kni_net.c:kni_net_rx_normal): * /* Transfer received packets to netif */ for (i = 0; i < num; i++) { kva = (void *)va[i] - kni->mbuf_va + kni->mbuf_kva; len = kva->data_len; data_kva = kva->data - kni->mbuf_va + kni->mbuf_kva; skb = dev_alloc_skb(len + 2); if (!skb) { KNI_ERR("Out of mem, dropping pkts\n"); /* Update statistics */ kni->stats.rx_dropped++; } else { /* Align IP on 16B boundary */ skb_reserve(skb, 2); memcpy(skb_put(skb, len), data_kva, len); skb->dev = dev; skb->protocol = eth_type_trans(skb, dev); skb->ip_summed = CHECKSUM_UNNECESSARY; /* Call netif interface */ netif_receive_skb(skb); /* Update statistics */ kni->stats.rx_bytes += len; kni->stats.rx_packets++; } }* The similar bug is reported and fixed in dpdk extension memnic. See http://comments.gmane.org/gmane.comp.networking.dpdk.devel/3151 To fix this bug, we should call local_bh_disable/local_bh_enable around netif_receive_skb to disable and re-enable soft-irq. Best Regards
[dpdk-dev] multi segment TX/RX for vmxnet3
Hi, Do you guys plan to include this feature in the upcoming DPDK release? Best, -hs
[dpdk-dev] [PATCH v2 0/4] NIC filters support for generic filter
> 2014-06-11 17:45, Thomas Monjalon: > > My main concern is that Vladimir Medvedkin suggested another API and I'd > > like you give your opinion about it: > > http://dpdk.org/ml/archives/dev/2014-June/003053.html > > It offers pool number in configuration of the filters. 2014-06-12 08:08, Wu, Jingjing: > The pool field is used in virtualization scenario. It is acting as one of > input set during filter matching in ixgbe. > My patch didn't consider the virtualization scenario in generic filter > feature. Because in 82599 datasheet, it is recommended to assign rx queues > not used by DCB/RSS, that is virtualization without RSS and DCB mode. For > this mode, current DPDK version makes the number of queue to 1 by default in > IOV mode. So in this case it makes no sense make pool as a input set and the > rx queue also need to be set to in this pool, so just keep the consistent > with flow director who also ignore it in previous version. > And further E1000/Niantic/Fortville have different definitions for VF, we > need to think how to define it more generic. > And even just need offer pool number in configuration of the filters as what > Vladimir did, it also need to verify the interworking with Virtualization > for different kinds of NICs, and the interworking with DCB and RSS which is > not recommended in 82599's datasheet. > So I think it will be a good choice to implement generic filter interworking > with virtualization in future patch. If there is any volunteer to send patch > for support this concern later, it will be also cool. Vladimir, do you agree with this analysis? As you suggested another implementation, I need you acknowledgment for this patchset to be integrated. Thanks -- Thomas
[dpdk-dev] [PATCH] Add an API to query enabled core index
> -Original Message- > From: Olivier MATZ [mailto:olivier.matz at 6wind.com] > Sent: Thursday, June 12, 2014 1:20 AM > To: Richardson, Bruce; Thomas Monjalon; Lu, Patrick > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH] Add an API to query enabled core index > > Hello, > > On 06/11/2014 11:57 PM, Richardson, Bruce wrote: > >> I think core_id2 is not a representative name. > >> What do you think of renaming core_id as lcore_hwid and core_id2 as > >> lcore_index? > >> > >> -- > > I like lcore_index as the name for the new function. However, I'm not sure > > in > that case that we want/need to rename the old one. > > What about lcore_rank ? > It may avoid confusion between "id" and "index", which are quite > close visually and phonetically. Not sure about rank, index is more correct. How about making it "app_index" or "app_idx", to indicate that it's not a global id but rather the idx that's local to the running app instance. Other alternative approach would be rte_lcore_position() API that takes a hardware lcore id, and tells you it's "position" in the coremask for the application, i.e. lcore 6 is in position 2 (of e.g. 5) lcores, for instance. [It would obviously return -1 on non-active cores.] > > I agree that we should not change the old lcore_id, its name is already > appropriate. > And it's so widely used that changing it would break the code of probably every single Intel DPDK application ever written!
[dpdk-dev] vmxnet3 : testpmd failing with "eth_vmxnet3_dev_init(): Device is not configured for our purpose"
Hi, SOS. I'am trying to use DPDK in FC20 VM, with 2 VMXNET3 interface. I followed the steps listed in "http://dpdk.org/doc/vmxnet3-usermap";. for enabling the VMXNET3 usermode driver However, the "testpmd" fails/terminates with the below error "EAL: PCI device :03:00.0 on NUMA socket -1 EAL: probe driver: 15ad:7b0 rte_vmxnet3_pmd PMD: eth_vmxnet3_dev_init(): Device is not configured for our purpose EAL: PCI device :0b:00.0 on NUMA socket -1 EAL: probe driver: 15ad:7b0 rte_vmxnet3_pmd PMD: eth_vmxnet3_dev_init(): Device is not configured for our purpose EAL: Error - exiting with code: 1 Cause: No probed ethernet devices - check that CONFIG_RTE_LIBRTE_IGB_PMD=y and that CONFIG_RTE_LIBRTE_EM_PMD=y and that CONFIG_RTE_LIBRTE_IXGBE_PMD=y in your configuration file " System details : OS : FC 20 Kernel : 3.2.60 DPDK : dpdk-1.6.0r2 vmxnet3 : vmxnet3-usermap-1.2 Steps done : 1. export RTE_SDK=/home/eilp/DPDK/Linux3_2/dpdk-1.6.0r2 2. export RTE_TARGET=x86_64-default-linuxapp-gcc 3. modprobe uio 4. insmod vmxnet3-usermap.ko enable_shm=2,2 num_rqs=1,1 num_rxds=512 num_txds=512 5. testpmd -c 0x3e -n 1 -d librte_pmd_vmxnet3.so -- -i --rxq=1 --rxd=512 --txd=512 Full error Log: [root at localhost dpdk-1.6.0r2]# ./x86_64-default-linuxapp-gcc/app/testpmd -c 0x3e -n 1 -d librte_pmd_vmxnet3.so -- -i --rxq=1 --rxd=512 --txd=512 EAL: Detected lcore 0 as core 0 on socket 0 EAL: Detected lcore 1 as core 1 on socket 0 EAL: Detected lcore 2 as core 2 on socket 0 EAL: Detected lcore 3 as core 3 on socket 0 EAL: Detected lcore 4 as core 4 on socket 0 EAL: Detected lcore 5 as core 5 on socket 0 EAL: Skip lcore 6 (not detected) EAL: Skip lcore 7 (not detected) EAL: Skip lcore 8 (not detected) EAL: Skip lcore 9 (not detected) EAL: Skip lcore 10 (not detected) EAL: Skip lcore 11 (not detected) EAL: Skip lcore 12 (not detected) EAL: Skip lcore 13 (not detected) EAL: Skip lcore 14 (not detected) EAL: Skip lcore 15 (not detected) EAL: Skip lcore 16 (not detected) EAL: Skip lcore 17 (not detected) EAL: Skip lcore 18 (not detected) EAL: Skip lcore 19 (not detected) EAL: Skip lcore 20 (not detected) EAL: Skip lcore 21 (not detected) EAL: Skip lcore 22 (not detected) EAL: Skip lcore 23 (not detected) EAL: Skip lcore 24 (not detected) EAL: Skip lcore 25 (not detected) EAL: Skip lcore 26 (not detected) EAL: Skip lcore 27 (not detected) EAL: Skip lcore 28 (not detected) EAL: Skip lcore 29 (not detected) EAL: Skip lcore 30 (not detected) EAL: Skip lcore 31 (not detected) EAL: Skip lcore 32 (not detected) EAL: Skip lcore 33 (not detected) EAL: Skip lcore 34 (not detected) EAL: Skip lcore 35 (not detected) EAL: Skip lcore 36 (not detected) EAL: Skip lcore 37 (not detected) EAL: Skip lcore 38 (not detected) EAL: Skip lcore 39 (not detected) EAL: Skip lcore 40 (not detected) EAL: Skip lcore 41 (not detected) EAL: Skip lcore 42 (not detected) EAL: Skip lcore 43 (not detected) EAL: Skip lcore 44 (not detected) EAL: Skip lcore 45 (not detected) EAL: Skip lcore 46 (not detected) EAL: Skip lcore 47 (not detected) EAL: Skip lcore 48 (not detected) EAL: Skip lcore 49 (not detected) EAL: Skip lcore 50 (not detected) EAL: Skip lcore 51 (not detected) EAL: Skip lcore 52 (not detected) EAL: Skip lcore 53 (not detected) EAL: Skip lcore 54 (not detected) EAL: Skip lcore 55 (not detected) EAL: Skip lcore 56 (not detected) EAL: Skip lcore 57 (not detected) EAL: Skip lcore 58 (not detected) EAL: Skip lcore 59 (not detected) EAL: Skip lcore 60 (not detected) EAL: Skip lcore 61 (not detected) EAL: Skip lcore 62 (not detected) EAL: Skip lcore 63 (not detected) EAL: Setting up memory... EAL: Ask a virtual area of 0x80 bytes EAL: Virtual area found at 0x7f989000 (size = 0x80) EAL: Ask a virtual area of 0x20 bytes EAL: Virtual area found at 0x7f988fc0 (size = 0x20) EAL: Ask a virtual area of 0x20 bytes EAL: Virtual area found at 0x7f988f80 (size = 0x20) EAL: Ask a virtual area of 0x7f40 bytes EAL: Virtual area found at 0x7f981020 (size = 0x7f40) EAL: Requesting 1024 pages of size 2MB from socket 0 EAL: TSC frequency is ~2699988 KHz EAL: open shared lib librte_pmd_vmxnet3.so librte_pmd_vmxnet3 version 1.2 Copyright 2012-2014 6WIND S.A. provided without warranty. EAL: Master core 1 is ready (tid=90d0a880) EAL: Core 5 is ready (tid=ddef700) EAL: Core 4 is ready (tid=e5f0700) EAL: Core 3 is ready (tid=edf1700) EAL: Core 2 is ready (tid=f5f2700) EAL: PCI device :02:00.0 on NUMA socket -1 EAL: probe driver: 8086:100f rte_em_pmd EAL: :02:00.0 not managed by UIO driver, skipping EAL: PCI device :02:02.0 on NUMA socket -1 EAL: probe driver: 8086:100f rte_em_pmd EAL: :02:02.0 not managed by UIO driver, skipping EAL: PCI device :02:03.0 on NUMA socket -1 EAL: probe driver: 8086:100f rte_em_pmd EAL: :02:03.0 not managed by UIO driver, skipping EAL: PCI device :03:00.0 on NUMA socket -1 EAL: probe driver: 15ad:7b0 rte_vmxnet3_pmd PMD: eth_vmxnet3_dev_init(): Device is n
[dpdk-dev] [PATCH v2] ethdev: add Rx error counters for missed, badcrc and badlen packets
From: Ivan Boule Split input error stats to have a better understanding of why packets have been dropped. Keep ierrors field untouched for backward compatibility. Signed-off-by: Ivan Boule Signed-off-by: David Marchand Signed-off-by: Thomas Monjalon --- app/test-pmd/config.c | 24 +--- app/test-pmd/testpmd.c | 34 -- examples/load_balancer/runtime.c| 2 +- lib/librte_ether/rte_ethdev.h | 3 +++ lib/librte_pmd_e1000/em_ethdev.c| 9 +++-- lib/librte_pmd_e1000/igb_ethdev.c | 9 +++-- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 12 +--- 7 files changed, 64 insertions(+), 29 deletions(-) changes in v2: - fix alignments when displaying fwd and nic statistics in testpmd diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index e0298c6..2137fd3 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -126,19 +126,29 @@ nic_stats_display(portid_t port_id) nic_stats_border, port_id, nic_stats_border); if ((!port->rx_queue_stats_mapping_enabled) && (!port->tx_queue_stats_mapping_enabled)) { - printf(" RX-packets: %-10"PRIu64" RX-errors: %-10"PRIu64"RX-bytes: " - "%-"PRIu64"\n" - " TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64"TX-bytes: " + printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes: " + "%-"PRIu64"\n", + stats.ipackets, stats.imissed, stats.ibytes); + printf(" RX-badcrc: %-10"PRIu64" RX-badlen: %-10"PRIu64" RX-errors: " + "%-"PRIu64"\n", + stats.ibadcrc, stats.ibadlen, stats.ierrors); + printf(" RX-nombuf: %-10"PRIu64"\n", + stats.rx_nombuf); + printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes: " "%-"PRIu64"\n", - stats.ipackets, stats.ierrors, stats.ibytes, stats.opackets, stats.oerrors, stats.obytes); } else { printf(" RX-packets: %10"PRIu64"RX-errors: %10"PRIu64 - "RX-bytes: %10"PRIu64"\n" - " TX-packets: %10"PRIu64"TX-errors: %10"PRIu64 + "RX-bytes: %10"PRIu64"\n", + stats.ipackets, stats.ierrors, stats.ibytes); + printf(" RX-badcrc: %10"PRIu64"RX-badlen: %10"PRIu64 + " RX-errors: %10"PRIu64"\n", + stats.ibadcrc, stats.ibadlen, stats.ierrors); + printf(" RX-nombuf: %10"PRIu64"\n", + stats.rx_nombuf); + printf(" TX-packets: %10"PRIu64"TX-errors: %10"PRIu64 "TX-bytes: %10"PRIu64"\n", - stats.ipackets, stats.ierrors, stats.ibytes, stats.opackets, stats.oerrors, stats.obytes); } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 2529dc3..0727fb3 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -770,39 +770,45 @@ fwd_port_stats_display(portid_t port_id, struct rte_eth_stats *stats) if ((!port->rx_queue_stats_mapping_enabled) && (!port->tx_queue_stats_mapping_enabled)) { printf(" RX-packets: %-14"PRIu64" RX-dropped: %-14"PRIu64"RX-total: " "%-"PRIu64"\n", - stats->ipackets, stats->ierrors, - (uint64_t) (stats->ipackets + stats->ierrors)); + stats->ipackets, stats->imissed, + (uint64_t) (stats->ipackets + stats->imissed)); if (cur_fwd_eng == &csum_fwd_engine) printf(" Bad-ipcsum: %-14"PRIu64" Bad-l4csum: %-14"PRIu64" \n", port->rx_bad_ip_csum, port->rx_bad_l4_csum); + if (((stats->ierrors - stats->imissed) + stats->rx_nombuf) > 0) { + printf(" RX-badcrc: %-14"PRIu64" RX-badlen: %-14"PRIu64 + "RX-error: %-"PRIu64"\n", + stats->ibadcrc, stats->ibadlen, stats->ierrors); + printf(" RX-nombufs: %-14"PRIu64"\n", stats->rx_nombuf); + } printf(" TX-packets: %-14"PRIu64" TX-dropped: %-14"PRIu64"TX-total: " "%-"PRIu64"\n", stats->opackets, port->tx_dropped, (uint64_t) (stats->opackets + port->tx_dropped)); - - if (stats->rx_nombuf > 0) - printf(" RX-nombufs: %-14"PRIu64"\n", stats->rx_nombuf); - } else { printf(" RX-packets: %14"PRIu64" RX-dropped:%14"PRIu64"RX-total:" "%
[dpdk-dev] A deadlock may occur in kni kernel thread while netif_receive_skb is called
On Thu, 12 Jun 2014 22:46:14 +0800 Tyrone Lau wrote: > Hi, all. I have found recently the Linux kernel will complain occasionally > a dead lock, while I use the kernel module rte_kni provided in DPDK. After > reviewing the dpdk source code and googling, > I found that the deadlock occurred because netif_receive_skb is invoked in > a non-softirq context. The erroneous source code is listed as below (in > lib/librte_eal/linuxapp/kni/kni_net.c:kni_net_rx_normal): > > * /* Transfer received packets to netif */ > for (i = 0; i < num; i++) { > kva = (void *)va[i] - kni->mbuf_va + kni->mbuf_kva; > len = kva->data_len; > data_kva = kva->data - kni->mbuf_va + kni->mbuf_kva; > > skb = dev_alloc_skb(len + 2); > if (!skb) { > KNI_ERR("Out of mem, dropping pkts\n"); > /* Update statistics */ > kni->stats.rx_dropped++; > } > else { > /* Align IP on 16B boundary */ > skb_reserve(skb, 2); > memcpy(skb_put(skb, len), data_kva, len); > skb->dev = dev; > skb->protocol = eth_type_trans(skb, dev); > skb->ip_summed = CHECKSUM_UNNECESSARY; > > /* Call netif interface */ > netif_receive_skb(skb); > > /* Update statistics */ > kni->stats.rx_bytes += len; > kni->stats.rx_packets++; > } > }* > > The similar bug is reported and fixed in dpdk extension memnic. See > > http://comments.gmane.org/gmane.comp.networking.dpdk.devel/3151 > > To fix this bug, we should call local_bh_disable/local_bh_enable > around netif_receive_skb to disable and re-enable soft-irq. > Best Regards Probably better to call netif_rx instead, because that will handle the case of overrun. Other comments, this code should be using per-cpu stats. it should use netdev_alloc_skb_ip_align rather than doing align itself. Even better yet would be bursting packets into the receive handler.
[dpdk-dev] [PATCH v2 09/10] igbuio: show irq mode in sysfs
On Wed, Jun 11, 2014 at 06:27:35PM +, Carew, Alan wrote: > > -Original Message- > > From: Neil Horman [mailto:nhorman at tuxdriver.com] > > Sent: Sunday, June 08, 2014 4:37 PM > > To: Stephen Hemminger > > Cc: Carew, Alan; dev at dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v2 09/10] igbuio: show irq mode in sysfs > > > > On Fri, Jun 06, 2014 at 04:50:37PM -0700, Stephen Hemminger wrote: > > > Since irq mode is determined dynamically on a per-device > > > basis, and virtio needs to know if using intx or msi-x, > > > make it a sysfs attribute. > > > > > > --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c > > > +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c > > > @@ -43,6 +43,10 @@ > > > IGBUIO_MSIX_INTR_MODE > > > }; > > > > > > +static const char *igbuio_intr_modes[] = { > > > + "legacy", "msi", "msix" > > > +}; > > > + > > > /** > > > * A structure describing the private information for a uio device. > > > */ > > > @@ -128,8 +132,20 @@ > > > } > > > > > > static DEVICE_ATTR(max_vfs, S_IRUGO | S_IWUSR, show_max_vfs, > > store_max_vfs); > > > + > > > +static ssize_t irq_mode_show(struct device *dev, > > > + struct device_attribute *attr, char *buf) > > > +{ > > > + struct uio_info *info = pci_get_drvdata(to_pci_dev(dev)); > > > + struct rte_uio_pci_dev *udev = igbuio_get_uio_pci_dev(info); > > > + > > > + return sprintf(buf, "%s\n", igbuio_intr_modes[udev->mode]); > > > +} > > > +static DEVICE_ATTR(irq_mode, S_IRUGO, irq_mode_show, NULL); > > > + > > > static struct attribute *dev_attrs[] = { > > > &dev_attr_max_vfs.attr, > > > + &dev_attr_irq_mode.attr, > > > NULL, > > > }; > > > > > > > > > > > Do you really need this attribute? The pci bus sysfs tree already exports > > irq > > mode information for each device allocated already in > > /sys/bus/pci/device/msi_irqs > > > > Neil > > Hi Neil, > > After some digging around, I now realise what you mean, it is a good > suggestion. thanks. > /sys/bus/pci/devices//msi_irqs//mode, where "msi_irqs" > directory only exists for msi/msix and not for int-x. Also the "mode" file > contains string of configured interrupt mode. Yes, thats correct (although the file layout is slightly different in later kernels, as the mode is contained in a file that is named after the irq vector). For int-x interrupts you can query the /sys/bus/pci/devices/ > Thanks, > Alan >
[dpdk-dev] [PATCH 2/2] virtio: fix build with debug enabled
Remove useless message that breaks if VIRTIO_DEBUG_DRIVER is defined. virtio_ethdev.c:224:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] Signed-off-by: Stephen Hemminger --- a/lib/librte_pmd_virtio/virtio_ethdev.c 2014-06-10 15:30:23.440093214 -0700 +++ b/lib/librte_pmd_virtio/virtio_ethdev.c 2014-06-10 15:30:23.436093187 -0700 @@ -213,8 +213,6 @@ virtio_set_multiple_queues(struct rte_et ctrl.hdr.cmd = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET; memcpy(ctrl.data, &nb_queues, sizeof(uint16_t)); - PMD_INIT_LOG(DEBUG, "ctrl.data=%d\n", *(int *)ctrl.data); - dlen[0] = sizeof(uint16_t); ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
[dpdk-dev] [PATCH 1/2] virtio: checkpatch cleanups
This fixes style problems reported by checkpatch including: * extra whitespace * spaces before tabs * strings broken across lines * excessively long lines * missing spaces after keywords * unnecessary paren's in return statements Signed-off-by: Stephen Hemminger --- lib/librte_pmd_virtio/virtio_ethdev.c | 127 ++ lib/librte_pmd_virtio/virtio_ethdev.h |2 lib/librte_pmd_virtio/virtio_pci.c|4 - lib/librte_pmd_virtio/virtio_pci.h| 10 +- lib/librte_pmd_virtio/virtio_ring.h |4 - lib/librte_pmd_virtio/virtio_rxtx.c | 32 lib/librte_pmd_virtio/virtqueue.c |4 - lib/librte_pmd_virtio/virtqueue.h | 35 - 8 files changed, 115 insertions(+), 103 deletions(-) --- a/lib/librte_pmd_virtio/virtio_ethdev.c 2014-06-12 17:41:20.305298960 -0700 +++ b/lib/librte_pmd_virtio/virtio_ethdev.c 2014-06-12 17:51:34.0 -0700 @@ -110,8 +110,9 @@ virtio_send_command(struct virtqueue *vq ctrl->status = status; if (!vq->hw->cvq) { - PMD_INIT_LOG(ERR, "%s(): Control queue is " - "not supported by this device.\n", __func__); + PMD_INIT_LOG(ERR, +"%s(): Control queue is not supported.\n", +__func__); return -1; } @@ -257,10 +258,10 @@ int virtio_dev_queue_setup(struct rte_et nb_desc = vq_size; if (vq_size == 0) { PMD_INIT_LOG(ERR, "%s: virtqueue does not exist\n", __func__); - return (-EINVAL); + return -EINVAL; } else if (!rte_is_power_of_2(vq_size)) { PMD_INIT_LOG(ERR, "%s: virtqueue size is not powerof 2\n", __func__); - return (-EINVAL); + return -EINVAL; } else if (nb_desc != vq_size) { PMD_INIT_LOG(ERR, "Warning: nb_desc(%d) is not equal to vq size (%d), fall to vq size\n", nb_desc, vq_size); @@ -273,13 +274,13 @@ int virtio_dev_queue_setup(struct rte_et vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE); memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); - } else if(queue_type == VTNET_TQ) { + } else if (queue_type == VTNET_TQ) { rte_snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d", dev->data->port_id, queue_idx); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE); memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); - } else if(queue_type == VTNET_CQ) { + } else if (queue_type == VTNET_CQ) { rte_snprintf(vq_name, sizeof(vq_name), "port%d_cvq", dev->data->port_id); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + @@ -311,7 +312,7 @@ int virtio_dev_queue_setup(struct rte_et socket_id, 0, VIRTIO_PCI_VRING_ALIGN); if (mz == NULL) { rte_free(vq); - return (-ENOMEM); + return -ENOMEM; } /* @@ -319,10 +320,10 @@ int virtio_dev_queue_setup(struct rte_et * and only accepts 32 bit page frame number. * Check if the allocated physical memory exceeds 16TB. */ - if ( (mz->phys_addr + vq->vq_ring_size - 1) >> (VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32) ) { + if ((mz->phys_addr + vq->vq_ring_size - 1) >> (VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) { PMD_INIT_LOG(ERR, "vring address shouldn't be above 16TB!\n"); rte_free(vq); - return (-ENOMEM); + return -ENOMEM; } memset(mz->addr, 0, sizeof(mz->len)); @@ -429,7 +430,7 @@ static struct eth_dev_ops virtio_eth_dev /* meaningfull only to multiple queue */ .tx_queue_release= virtio_dev_tx_queue_release, /* collect stats per queue */ - .queue_stats_mapping_set = virtio_dev_queue_stats_mapping_set + .queue_stats_mapping_set = virtio_dev_queue_stats_mapping_set, }; static inline int @@ -441,9 +442,9 @@ virtio_dev_atomic_read_link_status(struc if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, *(uint64_t *)src) == 0) - return (-1); + return -1; - return (0); + return 0; } /** @@ -467,9 +468,9 @@ virtio_dev_atomic_write_link_status(stru if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, *(uint64_t *)src) == 0) - return (-1); + return -1; - return (0); + return 0; } static void @@ -477,7 +478,7 @@ virtio_dev_stats_get(struct rte_eth_dev { struct virtio_hw *hw = VIRTIO_DEV_PRIVATE_TO_HW
[dpdk-dev] [PATCH 1/5] vmxnet3: fix all multicast vs promiscious
The driver was incorrectly enabling/disabling promiscious mode when it should have be setting/clearing all multicast mode. Signed-off-by: Stephen Hemminger --- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-10 15:30:24.97039 -0700 +++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-10 15:30:23.996097012 -0700 @@ -708,7 +708,7 @@ static void vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev) { struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 1); + vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 1); } /* Allmulticast supported only if Vmxnet3_DriverShared is initialized in adapter */ @@ -716,7 +716,7 @@ static void vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev) { struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0); + vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 0); } #if PROCESS_SYS_EVENTS == 1
[dpdk-dev] [PATCH 2/5] vmxnet3: cleanup style and indentation
This driver had several style problems, the worst of which was botched indentation. Fix almost all the problems reported by checkpatch. Signed-off-by: Stephen Hemminger --- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 158 lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h | 24 +- lib/librte_pmd_vmxnet3/vmxnet3_ring.h | 12 - lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 300 4 files changed, 257 insertions(+), 237 deletions(-) --- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-12 17:51:52.277119629 -0700 +++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-12 18:10:05.495161130 -0700 @@ -216,24 +216,24 @@ eth_vmxnet3_dev_init(__attribute__((unus hw->bufs_per_pkt = 1; /* Check h/w version compatibility with driver. */ -ver = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_VRRS); -PMD_INIT_LOG(DEBUG, "Harware version : %d\n", ver); -if (ver & 0x1) + ver = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_VRRS); + PMD_INIT_LOG(DEBUG, "Harware version : %d\n", ver); + if (ver & 0x1) VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_VRRS, 1); -else { + else { PMD_INIT_LOG(ERR, "Uncompatiable h/w version, should be 0x1\n"); return -EIO; -} + } -/* Check UPT version compatibility with driver. */ -ver = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_UVRS); -PMD_INIT_LOG(DEBUG, "UPT harware version : %d\n", ver); -if (ver & 0x1) + /* Check UPT version compatibility with driver. */ + ver = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_UVRS); + PMD_INIT_LOG(DEBUG, "UPT harware version : %d\n", ver); + if (ver & 0x1) VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_UVRS, 1); -else { + else { PMD_INIT_LOG(ERR, "Incompatiable UPT version.\n"); return -EIO; -} + } /* Getting MAC Address */ mac_lo = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_MACL); @@ -243,20 +243,20 @@ eth_vmxnet3_dev_init(__attribute__((unus /* Allocate memory for storing MAC addresses */ eth_dev->data->mac_addrs = rte_zmalloc("vmxnet3", ETHER_ADDR_LEN * - VMXNET3_MAX_MAC_ADDRS, 0); + VMXNET3_MAX_MAC_ADDRS, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, - "Failed to allocate %d bytes needed to store MAC addresses", - ETHER_ADDR_LEN * VMXNET3_MAX_MAC_ADDRS); +"Failed to allocate %d bytes needed to store MAC addresses", +ETHER_ADDR_LEN * VMXNET3_MAX_MAC_ADDRS); return -ENOMEM; } /* Copy the permanent MAC address */ ether_addr_copy((struct ether_addr *) hw->perm_addr, ð_dev->data->mac_addrs[0]); - PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x \n", - hw->perm_addr[0], hw->perm_addr[1], hw->perm_addr[2], - hw->perm_addr[3], hw->perm_addr[4], hw->perm_addr[5]); + PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x\n", +hw->perm_addr[0], hw->perm_addr[1], hw->perm_addr[2], +hw->perm_addr[3], hw->perm_addr[4], hw->perm_addr[5]); /* Put device in Quiesce Mode */ VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_QUIESCE_DEV); @@ -293,20 +293,20 @@ vmxnet3_dev_configure(struct rte_eth_dev { const struct rte_memzone *mz; struct vmxnet3_hw *hw = - VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); size_t size; PMD_INIT_FUNC_TRACE(); if (dev->data->nb_rx_queues > UINT8_MAX || - dev->data->nb_tx_queues > UINT8_MAX) - return (-EINVAL); + dev->data->nb_tx_queues > UINT8_MAX) + return -EINVAL; size = dev->data->nb_rx_queues * sizeof(struct Vmxnet3_TxQueueDesc) + - dev->data->nb_tx_queues * sizeof (struct Vmxnet3_RxQueueDesc); + dev->data->nb_tx_queues * sizeof(struct Vmxnet3_RxQueueDesc); if (size > UINT16_MAX) - return (-EINVAL); + return -EINVAL; hw->num_rx_queues = (uint8_t)dev->data->nb_rx_queues; hw->num_tx_queues = (uint8_t)dev->data->nb_tx_queues; @@ -315,12 +315,12 @@ vmxnet3_dev_configure(struct rte_eth_dev * Allocate a memzone for Vmxnet3_DriverShared - Vmxnet3_DSDevRead * on current socket */ - mz = gpa_zone_reserve(dev, sizeof (struct Vmxnet3_DriverShared), - "shared", rte_socket_id(), 8); + mz = gpa_zone_reserve(dev, sizeof(struct Vmxnet3_DriverShared), + "shared", rte_socket_id(), 8); if (mz == NULL) { PMD_INIT_L
[dpdk-dev] [PATCH 3/5] vmxnet3: fix double spacing of log messages
The debug log macro's already include newline, no need to double space the output. Note: other drivers have the same problem Signed-off-by: Stephen Hemminger --- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 42 +-- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 70 2 files changed, 56 insertions(+), 56 deletions(-) --- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-12 18:10:45.367368561 -0700 +++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-12 18:11:29.251597504 -0700 @@ -217,21 +217,21 @@ eth_vmxnet3_dev_init(__attribute__((unus /* Check h/w version compatibility with driver. */ ver = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_VRRS); - PMD_INIT_LOG(DEBUG, "Harware version : %d\n", ver); + PMD_INIT_LOG(DEBUG, "Harware version : %d", ver); if (ver & 0x1) VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_VRRS, 1); else { - PMD_INIT_LOG(ERR, "Uncompatiable h/w version, should be 0x1\n"); + PMD_INIT_LOG(ERR, "Uncompatiable h/w version, should be 0x1"); return -EIO; } /* Check UPT version compatibility with driver. */ ver = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_UVRS); - PMD_INIT_LOG(DEBUG, "UPT harware version : %d\n", ver); + PMD_INIT_LOG(DEBUG, "UPT harware version : %d", ver); if (ver & 0x1) VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_UVRS, 1); else { - PMD_INIT_LOG(ERR, "Incompatiable UPT version.\n"); + PMD_INIT_LOG(ERR, "Incompatiable UPT version."); return -EIO; } @@ -254,7 +254,7 @@ eth_vmxnet3_dev_init(__attribute__((unus ether_addr_copy((struct ether_addr *) hw->perm_addr, ð_dev->data->mac_addrs[0]); - PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x\n", + PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", hw->perm_addr[0], hw->perm_addr[1], hw->perm_addr[2], hw->perm_addr[3], hw->perm_addr[4], hw->perm_addr[5]); @@ -319,7 +319,7 @@ vmxnet3_dev_configure(struct rte_eth_dev "shared", rte_socket_id(), 8); if (mz == NULL) { - PMD_INIT_LOG(ERR, "ERROR: Creating shared zone\n"); + PMD_INIT_LOG(ERR, "ERROR: Creating shared zone"); return -ENOMEM; } memset(mz->addr, 0, mz->len); @@ -334,7 +334,7 @@ vmxnet3_dev_configure(struct rte_eth_dev mz = gpa_zone_reserve(dev, size, "queuedesc", rte_socket_id(), VMXNET3_QUEUE_DESC_ALIGN); if (mz == NULL) { - PMD_INIT_LOG(ERR, "ERROR: Creating queue descriptors zone\n"); + PMD_INIT_LOG(ERR, "ERROR: Creating queue descriptors zone"); return -ENOMEM; } memset(mz->addr, 0, mz->len); @@ -352,7 +352,7 @@ vmxnet3_dev_configure(struct rte_eth_dev rte_socket_id(), CACHE_LINE_SIZE); if (mz == NULL) { PMD_INIT_LOG(ERR, -"ERROR: Creating rss_conf structure zone\n"); +"ERROR: Creating rss_conf structure zone"); return -ENOMEM; } memset(mz->addr, 0, mz->len); @@ -463,7 +463,7 @@ vmxnet3_setup_driver_shared(struct rte_e } PMD_INIT_LOG(DEBUG, -"Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x\n", +"Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", hw->perm_addr[0], hw->perm_addr[1], hw->perm_addr[2], hw->perm_addr[3], hw->perm_addr[4], hw->perm_addr[5]); @@ -506,7 +506,7 @@ vmxnet3_dev_start(struct rte_eth_dev *de status = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD); if (status != 0) { - PMD_INIT_LOG(ERR, "Device activation in %s(): UNSUCCESSFUL\n", __func__); + PMD_INIT_LOG(ERR, "Device activation in %s(): UNSUCCESSFUL", __func__); return -1; } @@ -519,7 +519,7 @@ vmxnet3_dev_start(struct rte_eth_dev *de */ ret = vmxnet3_dev_rxtx_init(dev); if (ret != VMXNET3_SUCCESS) { - PMD_INIT_LOG(ERR, "Device receive init in %s: UNSUCCESSFUL\n", __func__); + PMD_INIT_LOG(ERR, "Device receive init in %s: UNSUCCESSFUL", __func__); return ret; } @@ -531,7 +531,7 @@ vmxnet3_dev_start(struct rte_eth_dev *de */ #if PROCESS_SYS_EVENTS == 1 events = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_ECR); - PMD_INIT_LOG(DEBUG, "Reading events: 0x%X\n\n", events); + PMD_INIT_LOG(DEBUG, "Reading events: 0x%X", events); vmxnet3_process_events(hw); #endif return status; @@ -550,7 +550,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev
[dpdk-dev] [PATCH 4/5] vmxnet3: add per-queue stats
Update per-queue statistics and add missing multicast into statistics. Also, no need to zero statistics since they are already cleared in rte_stats_get. Signed-off-by: Stephen Hemminger --- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 60 +--- 1 file changed, 32 insertions(+), 28 deletions(-) --- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-12 18:12:14.987836818 -0700 +++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-12 18:13:35.020257298 -0700 @@ -598,39 +598,43 @@ vmxnet3_dev_stats_get(struct rte_eth_dev VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); - stats->opackets = 0; - stats->obytes = 0; - stats->oerrors = 0; - stats->ipackets = 0; - stats->ibytes = 0; - stats->rx_nombuf = 0; - stats->ierrors = 0; - stats->imcasts = 0; - stats->fdirmatch = 0; - stats->fdirmiss = 0; - + RTE_BUILD_BUG_ON(RTE_ETHDEV_QUEUE_STAT_CNTRS < VMXNET3_MAX_TX_QUEUES); for (i = 0; i < hw->num_tx_queues; i++) { - stats->opackets += hw->tqd_start[i].stats.ucastPktsTxOK + - hw->tqd_start[i].stats.mcastPktsTxOK + - hw->tqd_start[i].stats.bcastPktsTxOK; - stats->obytes += hw->tqd_start[i].stats.ucastBytesTxOK + - hw->tqd_start[i].stats.mcastBytesTxOK + - hw->tqd_start[i].stats.bcastBytesTxOK; - stats->oerrors += hw->tqd_start[i].stats.pktsTxError + - hw->tqd_start[i].stats.pktsTxDiscard; + struct UPT1_TxStats *txStats = &hw->tqd_start[i].stats; + + stats->q_opackets[i] = txStats->ucastPktsTxOK + + txStats->mcastPktsTxOK + + txStats->bcastPktsTxOK; + stats->q_obytes[i] = txStats->ucastBytesTxOK + + txStats->mcastBytesTxOK + + txStats->bcastBytesTxOK; + + stats->opackets += stats->q_opackets[i]; + stats->obytes += stats->q_obytes[i]; + stats->oerrors += txStats->pktsTxError + + txStats->pktsTxDiscard; } + RTE_BUILD_BUG_ON(RTE_ETHDEV_QUEUE_STAT_CNTRS < VMXNET3_MAX_RX_QUEUES); for (i = 0; i < hw->num_rx_queues; i++) { - stats->ipackets += hw->rqd_start[i].stats.ucastPktsRxOK + - hw->rqd_start[i].stats.mcastPktsRxOK + - hw->rqd_start[i].stats.bcastPktsRxOK; - stats->ibytes+= hw->rqd_start[i].stats.ucastBytesRxOK + - hw->rqd_start[i].stats.mcastBytesRxOK + - hw->rqd_start[i].stats.bcastBytesRxOK; - stats->rx_nombuf += hw->rqd_start[i].stats.pktsRxOutOfBuf; - stats->ierrors += hw->rqd_start[i].stats.pktsRxError; - } + struct UPT1_RxStats *rxStats = &hw->rqd_start[i].stats; + stats->q_ipackets[i] = rxStats->ucastPktsRxOK + + rxStats->mcastPktsRxOK + + rxStats->bcastPktsRxOK; + + stats->q_ibytes[i] = rxStats->ucastBytesRxOK + + rxStats->mcastBytesRxOK + + rxStats->bcastBytesRxOK; + + stats->ipackets += stats->q_ipackets[i]; + stats->ibytes += stats->q_ibytes[i]; + + stats->q_errors[i] = rxStats->pktsRxError; + stats->ierrors += rxStats->pktsRxError; + stats->imcasts += rxStats->mcastPktsRxOK; + stats->rx_nombuf += rxStats->pktsRxOutOfBuf; + } } static void
[dpdk-dev] [PATCH 5/5] vmxnet3: remove useless adapter wrapper
The adapter struct is just a wrapper around the vmxnet3_hw structure. Eliminate the wrapper and get rid of the macro used to access and needlessly cast the private data. Signed-off-by: Stephen Hemminger --- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 30 +- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h | 10 -- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 16 +++- 3 files changed, 20 insertions(+), 36 deletions(-) --- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-12 18:13:57.408375309 -0700 +++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c 2014-06-12 18:14:38.736593592 -0700 @@ -186,8 +186,7 @@ eth_vmxnet3_dev_init(__attribute__((unus struct rte_eth_dev *eth_dev) { struct rte_pci_device *pci_dev; - struct vmxnet3_hw *hw = - VMXNET3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + struct vmxnet3_hw *hw = eth_dev->data->dev_private; uint32_t mac_hi, mac_lo, ver; PMD_INIT_FUNC_TRACE(); @@ -271,7 +270,7 @@ static struct eth_driver rte_vmxnet3_pmd .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO, }, .eth_dev_init = eth_vmxnet3_dev_init, - .dev_private_size = sizeof(struct vmxnet3_adapter), + .dev_private_size = sizeof(struct vmxnet3_hw), }; /* @@ -292,8 +291,7 @@ static int vmxnet3_dev_configure(struct rte_eth_dev *dev) { const struct rte_memzone *mz; - struct vmxnet3_hw *hw = - VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; size_t size; PMD_INIT_FUNC_TRACE(); @@ -368,7 +366,7 @@ static int vmxnet3_setup_driver_shared(struct rte_eth_dev *dev) { struct rte_eth_conf port_conf = dev->data->dev_conf; - struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; Vmxnet3_DriverShared *shared = hw->shared; Vmxnet3_DSDevRead *devRead = &shared->devRead; uint32_t *mac_ptr; @@ -487,7 +485,7 @@ static int vmxnet3_dev_start(struct rte_eth_dev *dev) { int status, ret; - struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; PMD_INIT_FUNC_TRACE(); @@ -544,8 +542,7 @@ static void vmxnet3_dev_stop(struct rte_eth_dev *dev) { struct rte_eth_link link; - struct vmxnet3_hw *hw = - VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; PMD_INIT_FUNC_TRACE(); @@ -580,8 +577,7 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev static void vmxnet3_dev_close(struct rte_eth_dev *dev) { - struct vmxnet3_hw *hw = - VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; PMD_INIT_FUNC_TRACE(); @@ -594,7 +590,7 @@ static void vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { unsigned int i; - struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); @@ -651,7 +647,7 @@ vmxnet3_dev_info_get(__attribute__((unus static int vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int wait_to_complete) { - struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; struct rte_eth_link link; uint32_t ret; @@ -694,7 +690,7 @@ vmxnet3_dev_set_rxmode(struct vmxnet3_hw static void vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev) { - struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 1); } @@ -703,7 +699,7 @@ vmxnet3_dev_promiscuous_enable(struct rt static void vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev) { - struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0); } @@ -712,7 +708,7 @@ vmxnet3_dev_promiscuous_disable(struct r static void vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev) { - struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 1); } @@ -721,7 +717,7 @@ vmxnet3_dev_allmulticast_enable(struct r static void vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev) { - struct vmxnet3_hw *hw = VMXNET3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct vmxnet3_hw *hw = dev->data->dev_private; vmxnet3_dev_set_r