[dpdk-dev] [PATCH] ethdev: fix a regression due to cache alignment issue

2018-02-10 Thread Jerin Jacob
Prior to "ethdev: add port ownership" change, the fast
path structure struct rte_eth_dev->data was cache aligned
due to the fact that eth_dev_data was allocated from
rte_malloc with cache aligned attribute.
"ethdev: add port ownership" change set introduced a
rte_eth_dev_shared_data container for port ownership change,
This resulted in rte_eth_dev->data memory as cache unaligned.
Added a compiler alignment attribute to make sure
rte_eth_dev->data always cache aligned and hence compiler
can load/store the elements in struct rte_eth_dev_data
as naturally aligned.

Some platform like thunderx + l3fwd showed 1% regression in
the performance with the offending changeset.

Fixes: 5b7ba31148a8 ("ethdev: add port ownership")

Cc: Matan Azrad 
Cc: Thomas Monjalon 
Cc: Konstantin Ananyev 

Signed-off-by: Jerin Jacob 
Signed-off-by: Pavan Nikhilesh 
---
 lib/librte_ether/rte_ethdev_core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev_core.h 
b/lib/librte_ether/rte_ethdev_core.h
index 315b31723..e5681e466 100644
--- a/lib/librte_ether/rte_ethdev_core.h
+++ b/lib/librte_ether/rte_ethdev_core.h
@@ -601,7 +601,7 @@ struct rte_eth_dev_data {
struct rte_vlan_filter_conf vlan_filter_conf;
/**< VLAN filter configuration. */
struct rte_eth_dev_owner owner; /**< The port owner. */
-};
+} __rte_cache_aligned;
 
 /**
  * @internal
-- 
2.16.1



Re: [dpdk-dev] IXGBE, IOMMU DMAR DRHD handling fault issue

2018-02-10 Thread Burakov, Anatoly

On 09-Feb-18 5:41 PM, Ravi Kerur wrote:



On Thu, Feb 8, 2018 at 3:20 AM, Burakov, Anatoly 
mailto:anatoly.bura...@intel.com>> wrote:


On 06-Feb-18 5:55 PM, Ravi Kerur wrote:


Hi Anatoly,

I am actually confused with the state of vIOMMU + DPDK. Can you
please help me clarify?

I tested following DPDK versions

(1) DPDK 17.11, exhibits the issue (IOMMU width as reported by
RedHat and solution is to prevent using the patch)
(2) DPDK 17.05.02 (stable release) using 'testpmd' I was able to
bind a device in VM with VFIO driver and no DMAR error message
on host
(3) DPDK 16.11.02 (stable release) using 'testpmd' I was able to
bind a device in VM with VFIO driver and no DMAR error message
on host

Clearly issue seen in 17.11 without the patch you mentioned is a
regression or the issue was masked in earlier DPDK version?  I
did not test traffic with any DPDK version because I wanted to
first get DMAR errors on host gone.

Our application 'v1' is integrated with DPDK 16.11 and 'v2' is
integrated with DPDK 17.05.01. In both 'v1' and 'v2' cases I
don't see IOMMU width error messages on VM, however, DMAR error
messages are seen host. I am not able to relate what causes DMAR
error messages on host?


Thanks.


Hi Ravi,

vIOMMU support is out of our hands, really - we can only make use of
hardware (or emulation of it) that is available. 39-bit wide address
*can* work, you just have to be lucky and get PA addresses that
would fit into 39 bits (so under 512G limit), because we set up IOVA
addresses to be 1:1 to physical addresses. We could, in principle,
set up IOVA addresses to go from zero instead of them being a 1:1
mapping to physical addresses, but that would introduce need to
translate addresses between IOVA and physical in some cases (e.g. KNI).

I'm not aware of any changes between 16.11 and 17.11 (and indeed
18.02) that would make or break support for 39-bit wide PA addresses
for IOMMU. It is possible that VF/PF drivers do something
differently which results in DMAR errors showing up sooner rather
than later, but as far as VFIO support itself is concerned, there
were no major changes in those releases.


Hi Anatoly,


Hi Ravi,



Thank you for your explanation. I would like to ask one more thing as I 
need to get v-iommu+ dpdk working in VM. Can you please tell me what 
determines 'Host Address Width", I know my question has nothing to do 
with dpdk and this is a dpdk list, but if you have any information 
please share it? I googled and found couple of ways to influence 'Host 
Address Width = 46' in guest as well (since dpdk + iommu works fine on 
host and DMAR on host reports address width as 46).


As far as i'm aware, address width supported by IOMMU is taken from 
hardware (real or emulated). If e.g. QEMU's vIOMMU emulates an IOMMU 
that only supports 39-bit addresses, that's what we'll get.


Not sure what "host address width" means exactly, but if i had to guess, 
usually in VM-speak, "host" refers to, well, host - that is, the 
physical machine the VM is running on. So, under that assumption, "host 
address width" would be telling QEMU maximum width of IOMMU addresses on 
the host (i.e. what you have in hardware, on the host - for example, you 
might be running on a platform that only supports a 39-bit wide physical 
address). Naturally, changing it around wouldn't change much - it would 
presumably affect only the way vIOMMU remaps requests from guest to 
host, but not the emulated hardware itself. However, i'm not 
knowledgeable enough in that area to answer this question definitively.




(1) Qemu has CPU param 'host-phys-bits' boolean, when set to true copies 
it from host

(2) Qemu has 'phys-bits'  integer, when set to '46' should influence guest

Using above options when instantiating a VM doesn't help, Guest VM still 
ends up with 'Host address width = 39'.


(3) There is another Qemu option 'x-aw-bits' which is for VT-d which can 
be set to '39' or '48'. This doesn't help either.


Thanks.

-- 
Thanks,

Anatoly



--
Thanks,
Anatoly


Re: [dpdk-dev] IXGBE, IOMMU DMAR DRHD handling fault issue

2018-02-10 Thread Burakov, Anatoly

On 29-Jan-18 10:35 PM, Ravi Kerur wrote:

Hi Burakov,

When using vfio-pci on host both VF and PF interfaces works fine with 
dpdk i.e. I don't see DMAR fault messages anymore. However, when I 
attach a VF interface to a VM and start DPDK with vfio-pci inside VM I 
still see DMAR fault messages on host. Both host and VM are booted with 
'intel-iommu=on' on GRUB. Ping from VM with DPDK/vfio-pci doesn't work 
(I think it's expected because of DMAR faults), however, when VF 
interface uses ixgbevf driver ping works.


Following are some details

/*On VM***/
dpdk-devbind -s

Network devices using DPDK-compatible driver

:00:07.0 '82599 Ethernet Controller Virtual Function' drv=vfio-pci 
unused=ixgbevf


Network devices using kernel driver
===
:03:00.0 'Device 1041' if=eth0 drv=virtio-pci unused=vfio-pci *Active*
:04:00.0 'Device 1041' if=eth1 drv=virtio-pci unused=vfio-pci
:05:00.0 'Device 1041' if=eth2 drv=virtio-pci unused=vfio-pci

Other network devices
=


Crypto devices using DPDK-compatible driver
===


Crypto devices using kernel driver
==


Other crypto devices




00:07.0 Ethernet controller: Intel Corporation 82599 Ethernet Controller 
Virtual Function (rev 01)
     Subsystem: Intel Corporation 82599 Ethernet Controller Virtual 
Function
     Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B- DisINTx+
     Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- 
SERR- 
     Region 0: Memory at fda0 (64-bit, prefetchable) [size=16K]
     Region 3: Memory at fda04000 (64-bit, prefetchable) [size=16K]
     Capabilities: [70] MSI-X: Enable+ Count=3 Masked-
     Vector table: BAR=3 offset=
     PBA: BAR=3 offset=2000
     Capabilities: [a0] Express (v1) Root Complex Integrated 
Endpoint, MSI 00

     DevCap: MaxPayload 128 bytes, PhantFunc 0
     ExtTag- RBE-
     DevCtl: Report errors: Correctable- Non-Fatal- Fatal- 
Unsupported-

     RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
     MaxPayload 128 bytes, MaxReadReq 128 bytes
     DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- 
AuxPwr- TransPend-

     Capabilities: [100 v1] Advanced Error Reporting
     UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- 
UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
     UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- 
UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
     UESvrt: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- 
UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
     CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- 
NonFatalErr-
     CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- 
NonFatalErr-
     AERCap: First Error Pointer: 00, GenCap- CGenEn- 
ChkCap- ChkEn-

     Kernel driver in use: vfio-pci
     Kernel modules: ixgbevf

/***on Host*/
dmesg | grep DMAR
...
[  978.268143] DMAR: DRHD: handling fault status reg 2
[  978.268147] DMAR: [DMA Read] *Request device [04:10.0]* fault addr 
33a128000 [fault reason 06] PTE Read access is not set

[ 1286.677726] DMAR: DRHD: handling fault status reg 102
[ 1286.677730] DMAR: [DMA Read] Request device [04:10.0] fault addr 
fb663000 [fault reason 06] PTE Read access is not set

[ 1676.436145] DMAR: DRHD: handling fault status reg 202
[ 1676.436149] DMAR: [DMA Read] Request device [04:10.0] fault addr 
33a128000 [fault reason 06] PTE Read access is not set

[ 1734.433649] DMAR: DRHD: handling fault status reg 302
[ 1734.433652] DMAR: [DMA Read] Request device [04:10.0] fault addr 
33a128000 [fault reason 06] PTE Read access is not set

[ 2324.428938] DMAR: DRHD: handling fault status reg 402
[ 2324.428942] DMAR: [DMA Read] Request device [04:10.0] fault addr 
7770c000 [fault reason 06] PTE Read access is not set

[ 2388.553640] DMAR: DRHD: handling fault status reg 502
[ 2388.553643] DMAR: [DMA Read] *Request device [04:10.0]* fault addr 
33a128000 [fault reason 06] PTE Read access is not set





Going back to this, i would like to suggest run a few tests to ensure 
that we have all information that we can gather.


First of all, i'm assuming that you're using native ixgbe Linux driver 
on the host, and that you're only passing through the VF device to the 
VM using VFIO. Is my understanding correct here?


Now, let's forget about the iommu=pt and igb_uio for a moment. Boot both 
your host and your VM with iommu=on and intel_iommu=on (or whatever 
command-line enables full IOMMU support on both host and guest) and do 
the same tests you've done before. Do you still see your issues?


It would also be very useful t

[dpdk-dev] [PATCH] net/dpaa2: remove unused global variable

2018-02-10 Thread Jerin Jacob
Due to the missing __packed definition, compiler treating
it as as global variable.

#grep "Allocating common symbols" -A 100 build/app/testacl.map
__packed   0x8  /build/lib/librte_pmd_dpaa2.a(dpaa2_rxtx.o)

Fixes: a5fc38d422a7 ("net/dpaa2: support Rx packet parsing")

Cc: hemant.agra...@nxp.com
Signed-off-by: Jerin Jacob 
---
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h 
b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h
index 41931e858..779cdf2b2 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h
@@ -37,7 +37,7 @@ struct dpaa2_fas {
uint8_t ppid;
__le16 ifpid;
__le32 status;
-} __packed;
+}  __attribute__((__packed__));
 
 /**
  * HW Packet Annotation  Register structures
-- 
2.16.1



Re: [dpdk-dev] [PATCH] net/dpaa2: remove unused global variable

2018-02-10 Thread Hemant Agrawal
> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Jerin Jacob
> Sent: Saturday, February 10, 2018 5:28 PM
> To: dev@dpdk.org
> Cc: Jerin Jacob ; Hemant Agrawal
> 
> Subject: [dpdk-dev] [PATCH] net/dpaa2: remove unused global variable
> Importance: High
> 
> Due to the missing __packed definition, compiler treating it as as global 
> variable.

> 
> #grep "Allocating common symbols" -A 100 build/app/testacl.map
> __packed   0x8  /build/lib/librte_pmd_dpaa2.a(dpaa2_rxtx.o)

[Hemant] Which compiler, you mean you faced issue with testacl app? 

> 
> Fixes: a5fc38d422a7 ("net/dpaa2: support Rx packet parsing")
> 
> Cc: hemant.agra...@nxp.com
> Signed-off-by: Jerin Jacob 
> ---
>  drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Hemant Agrawal 




Re: [dpdk-dev] [PATCH] doc: fix ethdev API port_id parameter size

2018-02-10 Thread Jerin Jacob
-Original Message-
> Date: Fri, 9 Feb 2018 15:01:28 +
> From: Hemant Agrawal 
> To: "Nicolau, Radu" , "Yigit, Ferruh"
>  , Neil Horman , "Mcnamara,
>  John" , "Kovacevic, Marko"
>  
> CC: "dev@dpdk.org" , Thomas Monjalon ,
>  Boris Pismenny , Aviad Yehezkel
>  , "Doherty, Declan" 
> Subject: Re: [dpdk-dev] [PATCH] doc: fix ethdev API port_id parameter size
> 
> > >
> > > Fix rte_eth_dev_get_sec_ctx() parameter port_id storage size, form
> > > uint8_t to uint16_t
> > >
> > > Signed-off-by: Ferruh Yigit 
> > > ---
> > Acked-by: Radu Nicolau 
> 
> Acked-by: Hemant Agrawal 

Acked-by: Jerin Jacob 



Re: [dpdk-dev] [PATCH v2] doc: update ethdev APIs to return named opaque type

2018-02-10 Thread Jerin Jacob
-Original Message-
> Date: Fri, 9 Feb 2018 13:22:06 +
> From: "Ananyev, Konstantin" 
> To: "Yigit, Ferruh" , Neil Horman
>  , "Mcnamara, John" ,
>  "Kovacevic, Marko" 
> CC: "dev@dpdk.org" , Stephen Hemminger
>  , "Richardson, Bruce"
>  , Thomas Monjalon 
> Subject: Re: [dpdk-dev] [PATCH v2] doc: update ethdev APIs to return named
>  opaque type
> 
> 
> 
> > -Original Message-
> > From: Yigit, Ferruh
> > Sent: Friday, February 9, 2018 10:18 AM
> > To: Neil Horman ; Mcnamara, John 
> > ; Kovacevic, Marko
> > 
> > Cc: dev@dpdk.org; Yigit, Ferruh ; Ananyev, 
> > Konstantin ; Stephen Hemminger
> > ; Richardson, Bruce 
> > ; Thomas Monjalon 
> > Subject: [PATCH v2] doc: update ethdev APIs to return named opaque type
> > 
> > Ethdev APIs to add callback return the callback object as "void *",
> > update return type to actual object type
> > "struct rte_eth_rxtx_callback *"
> > 
> > Signed-off-by: Ferruh Yigit 
> > ---
> > Cc: Konstantin Ananyev 
> > Cc: Stephen Hemminger 
> > Cc: Bruce Richardson 
> > Cc: Thomas Monjalon 
> > ---
> >  doc/guides/rel_notes/deprecation.rst | 7 +++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/doc/guides/rel_notes/deprecation.rst 
> > b/doc/guides/rel_notes/deprecation.rst
> > index bbd9456a7..5cb5a00d2 100644
> > --- a/doc/guides/rel_notes/deprecation.rst
> > +++ b/doc/guides/rel_notes/deprecation.rst
> > @@ -49,6 +49,13 @@ Deprecation Notices
> >rte_eth_dev_get_sec_ctx() is using uint8_t for port_id, which should be
> >uint16_t.
> > 
> > +* ethdev: functions add rx/tx callback will return named opaque type
> > +  rte_eth_add_rx_callback(), rte_eth_add_first_rx_callback() and
> > +  rte_eth_add_tx_callback() functions currently return callback object as
> > +  "void \*" but APIs to delete callbacks get "struct rte_eth_rxtx_callback 
> > \*"
> > +  as parameter. For consistency functions adding callback will return
> > +  "struct rte_eth_rxtx_callback \*" instead of "void * ".
> > +
> >  * i40e: The default flexible payload configuration which extracts the 
> > first 16
> >bytes of the payload for RSS will be deprecated starting from 18.02. If
> >required the previous behavior can be configured using existing flow
> > --
> 
> Acked-by: Konstantin Ananyev 

Acked-by: Jerin Jacob 

> 
> > 2.14.3
> 


Re: [dpdk-dev] [PATCH] net/dpaa2: remove unused global variable

2018-02-10 Thread Jerin Jacob
-Original Message-
> Date: Sat, 10 Feb 2018 12:02:24 +
> From: Hemant Agrawal 
> To: Jerin Jacob , "dev@dpdk.org"
>  
> Subject: RE: [dpdk-dev]  [PATCH] net/dpaa2: remove unused global variable
> 
> > -Original Message-
> > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Jerin Jacob
> > Sent: Saturday, February 10, 2018 5:28 PM
> > To: dev@dpdk.org
> > Cc: Jerin Jacob ; Hemant Agrawal
> > 
> > Subject: [dpdk-dev] [PATCH] net/dpaa2: remove unused global variable
> > Importance: High
> > 
> > Due to the missing __packed definition, compiler treating it as as global 
> > variable.
> 
> > 
> > #grep "Allocating common symbols" -A 100 build/app/testacl.map
> > __packed   0x8  /build/lib/librte_pmd_dpaa2.a(dpaa2_rxtx.o)
> 
> [Hemant] Which compiler, you mean you faced issue with testacl app? 

arm64 gcc. Not specific to testacl. We were getting minor performance
regression (<1%) with l3fwd after the following change set.
http://dpdk.org/dev/patchwork/patch/34709/

I don't think, the above change set directly has anything due to issue.
I was chasing that issue and found that global variables has something
due to with change.Most probably because it has indirect effect of changing
the complete address generated in the binary and thus showing up some cached
alignment related artifacts.

> 
> > 
> > Fixes: a5fc38d422a7 ("net/dpaa2: support Rx packet parsing")
> > 
> > Cc: hemant.agra...@nxp.com
> > Signed-off-by: Jerin Jacob 
> > ---
> >  drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Acked-by: Hemant Agrawal 
> 
> 


Re: [dpdk-dev] [PATCH] doc: add change notice for mbuf sched field

2018-02-10 Thread Jerin Jacob
-Original Message-
> Date: Fri, 9 Feb 2018 16:45:16 +
> From: Cristian Dumitrescu 
> To: dev@dpdk.org
> CC: olivier.m...@6wind.com, tho...@monjalon.net, jasvinder.si...@intel.com,
>  roy.fan.zh...@intel.com, kevin.la...@intel.com
> Subject: [dpdk-dev] [PATCH] doc: add change notice for mbuf sched field
> X-Mailer: git-send-email 2.7.4
> 
> Signed-off-by: Cristian Dumitrescu 
> Acked-by: Jasvinder Singh 
> Acked-by: Roy Fan Zhang 
> Acked-by: Kevin Laatz 

Acked-by: Jerin Jacob 

> ---
>  doc/guides/rel_notes/deprecation.rst | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/doc/guides/rel_notes/deprecation.rst 
> b/doc/guides/rel_notes/deprecation.rst
> index d59ad59..db4fea3 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -59,3 +59,8 @@ Deprecation Notices
>be added between the producer and consumer structures. The size of the
>structure and the offset of the fields will remain the same on
>platforms with 64B cache line, but will change on other platforms.
> +
> +* mbuf: The opaque mbuf->hash.sched field will be updated to support generic
> +  definition in line with the ethdev TM and MTR APIs. Currently, this field
> +  is defined in librte_sched in a non-generic way. The new generic format
> +  will contain: queue ID, traffic class, color. Field size will not change.
> -- 
> 2.7.4
> 


[dpdk-dev] [PATCH] eal: fix rte_errno values for IPC API

2018-02-10 Thread Anatoly Burakov
rte_errno values should not be negative.

Fixes: bacaa2754017 ("eal: add channel for multi-process communication")
Fixes: 783b6e54971d ("eal: add synchronous multi-process communication")
Cc: jianfeng@intel.com
Signed-off-by: Anatoly Burakov 
---

Notes:
This is in DPDK coding style guide:

http://dpdk.org/doc/guides/contributing/coding_style.html

However, i should note that situation with this is a mess
in DPDK, and in a lot of cases, rte_errno is set to -errno.

 lib/librte_eal/common/eal_common_proc.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_proc.c 
b/lib/librte_eal/common/eal_common_proc.c
index b974837..caa8774 100644
--- a/lib/librte_eal/common/eal_common_proc.c
+++ b/lib/librte_eal/common/eal_common_proc.c
@@ -131,16 +131,16 @@ validate_action_name(const char *name)
 {
if (name == NULL) {
RTE_LOG(ERR, EAL, "Action name cannot be NULL\n");
-   rte_errno = -EINVAL;
+   rte_errno = EINVAL;
return -1;
}
if (strnlen(name, RTE_MP_MAX_NAME_LEN) == 0) {
RTE_LOG(ERR, EAL, "Length of action name is zero\n");
-   rte_errno = -EINVAL;
+   rte_errno = EINVAL;
return -1;
}
if (strnlen(name, RTE_MP_MAX_NAME_LEN) == RTE_MP_MAX_NAME_LEN) {
-   rte_errno = -E2BIG;
+   rte_errno = E2BIG;
return -1;
}
return 0;
@@ -156,7 +156,7 @@ rte_mp_action_register(const char *name, rte_mp_t action)
 
entry = malloc(sizeof(struct action_entry));
if (entry == NULL) {
-   rte_errno = -ENOMEM;
+   rte_errno = ENOMEM;
return -1;
}
strcpy(entry->action_name, name);
@@ -165,7 +165,7 @@ rte_mp_action_register(const char *name, rte_mp_t action)
pthread_mutex_lock(&mp_mutex_action);
if (find_action_entry_by_name(name) != NULL) {
pthread_mutex_unlock(&mp_mutex_action);
-   rte_errno = -EEXIST;
+   rte_errno = EEXIST;
free(entry);
return -1;
}
@@ -505,7 +505,7 @@ check_input(const struct rte_mp_msg *msg)
 {
if (msg == NULL) {
RTE_LOG(ERR, EAL, "Msg cannot be NULL\n");
-   rte_errno = -EINVAL;
+   rte_errno = EINVAL;
return false;
}
 
@@ -514,14 +514,14 @@ check_input(const struct rte_mp_msg *msg)
 
if (msg->len_param > RTE_MP_MAX_PARAM_LEN) {
RTE_LOG(ERR, EAL, "Message data is too long\n");
-   rte_errno = -E2BIG;
+   rte_errno = E2BIG;
return false;
}
 
if (msg->num_fds > RTE_MP_MAX_FD_NUM) {
RTE_LOG(ERR, EAL, "Cannot send more than %d FDs\n",
RTE_MP_MAX_FD_NUM);
-   rte_errno = -E2BIG;
+   rte_errno = E2BIG;
return false;
}
 
@@ -560,7 +560,7 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
pthread_mutex_unlock(&sync_requests.lock);
if (exist) {
RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name);
-   rte_errno = -EEXIST;
+   rte_errno = EEXIST;
return -1;
}
 
@@ -596,7 +596,7 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
if (sync_req.reply_received == 0) {
RTE_LOG(ERR, EAL, "Fail to recv reply for request %s:%s\n",
dst, req->name);
-   rte_errno = -ETIMEDOUT;
+   rte_errno = ETIMEDOUT;
return -1;
}
 
@@ -604,7 +604,7 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
if (!tmp) {
RTE_LOG(ERR, EAL, "Fail to alloc reply for request %s:%s\n",
dst, req->name);
-   rte_errno = -ENOMEM;
+   rte_errno = ENOMEM;
return -1;
}
memcpy(&tmp[reply->nb_received], &msg, sizeof(msg));
@@ -676,7 +676,7 @@ rte_mp_reply(struct rte_mp_msg *msg, const char *peer)
 
if (peer == NULL) {
RTE_LOG(ERR, EAL, "peer is not specified\n");
-   rte_errno = -EINVAL;
+   rte_errno = EINVAL;
return -1;
}
 
-- 
2.7.4


Re: [dpdk-dev] IXGBE, IOMMU DMAR DRHD handling fault issue

2018-02-10 Thread Ravi Kerur
On Sat, Feb 10, 2018 at 2:58 AM, Burakov, Anatoly  wrote:

> On 29-Jan-18 10:35 PM, Ravi Kerur wrote:
>
>> Hi Burakov,
>>
>> When using vfio-pci on host both VF and PF interfaces works fine with
>> dpdk i.e. I don't see DMAR fault messages anymore. However, when I attach a
>> VF interface to a VM and start DPDK with vfio-pci inside VM I still see
>> DMAR fault messages on host. Both host and VM are booted with
>> 'intel-iommu=on' on GRUB. Ping from VM with DPDK/vfio-pci doesn't work (I
>> think it's expected because of DMAR faults), however, when VF interface
>> uses ixgbevf driver ping works.
>>
>> Following are some details
>>
>> /*On VM***/
>> dpdk-devbind -s
>>
>> Network devices using DPDK-compatible driver
>> 
>> :00:07.0 '82599 Ethernet Controller Virtual Function' drv=vfio-pci
>> unused=ixgbevf
>>
>> Network devices using kernel driver
>> ===
>> :03:00.0 'Device 1041' if=eth0 drv=virtio-pci unused=vfio-pci *Active*
>> :04:00.0 'Device 1041' if=eth1 drv=virtio-pci unused=vfio-pci
>> :05:00.0 'Device 1041' if=eth2 drv=virtio-pci unused=vfio-pci
>>
>> Other network devices
>> =
>> 
>>
>> Crypto devices using DPDK-compatible driver
>> ===
>> 
>>
>> Crypto devices using kernel driver
>> ==
>> 
>>
>> Other crypto devices
>> 
>> 
>>
>>
>> 00:07.0 Ethernet controller: Intel Corporation 82599 Ethernet Controller
>> Virtual Function (rev 01)
>>  Subsystem: Intel Corporation 82599 Ethernet Controller Virtual
>> Function
>>  Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop-
>> ParErr- Stepping- SERR- FastB2B- DisINTx+
>>  Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
>> SERR- >  Region 0: Memory at fda0 (64-bit, prefetchable) [size=16K]
>>  Region 3: Memory at fda04000 (64-bit, prefetchable) [size=16K]
>>  Capabilities: [70] MSI-X: Enable+ Count=3 Masked-
>>  Vector table: BAR=3 offset=
>>  PBA: BAR=3 offset=2000
>>  Capabilities: [a0] Express (v1) Root Complex Integrated
>> Endpoint, MSI 00
>>  DevCap: MaxPayload 128 bytes, PhantFunc 0
>>  ExtTag- RBE-
>>  DevCtl: Report errors: Correctable- Non-Fatal- Fatal-
>> Unsupported-
>>  RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
>>  MaxPayload 128 bytes, MaxReadReq 128 bytes
>>  DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr-
>> TransPend-
>>  Capabilities: [100 v1] Advanced Error Reporting
>>  UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt-
>> UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
>>  UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt-
>> UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
>>  UESvrt: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt-
>> UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
>>  CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout-
>> NonFatalErr-
>>  CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout-
>> NonFatalErr-
>>  AERCap: First Error Pointer: 00, GenCap- CGenEn- ChkCap-
>> ChkEn-
>>  Kernel driver in use: vfio-pci
>>  Kernel modules: ixgbevf
>>
>> /***on Host*/
>> dmesg | grep DMAR
>> ...
>> [  978.268143] DMAR: DRHD: handling fault status reg 2
>> [  978.268147] DMAR: [DMA Read] *Request device [04:10.0]* fault addr
>> 33a128000 [fault reason 06] PTE Read access is not set
>> [ 1286.677726] DMAR: DRHD: handling fault status reg 102
>> [ 1286.677730] DMAR: [DMA Read] Request device [04:10.0] fault addr
>> fb663000 [fault reason 06] PTE Read access is not set
>> [ 1676.436145] DMAR: DRHD: handling fault status reg 202
>> [ 1676.436149] DMAR: [DMA Read] Request device [04:10.0] fault addr
>> 33a128000 [fault reason 06] PTE Read access is not set
>> [ 1734.433649] DMAR: DRHD: handling fault status reg 302
>> [ 1734.433652] DMAR: [DMA Read] Request device [04:10.0] fault addr
>> 33a128000 [fault reason 06] PTE Read access is not set
>> [ 2324.428938] DMAR: DRHD: handling fault status reg 402
>> [ 2324.428942] DMAR: [DMA Read] Request device [04:10.0] fault addr
>> 7770c000 [fault reason 06] PTE Read access is not set
>> [ 2388.553640] DMAR: DRHD: handling fault status reg 502
>> [ 2388.553643] DMAR: [DMA Read] *Request device [04:10.0]* fault addr
>> 33a128000 [fault reason 06] PTE Read access is not set
>>
>>
>>
> Going back to this, i would like to suggest run a few tests to ensure that
> we have all information that we can gather.
>
> First of all, i'm assuming that you're using native ixgbe Linux driver on
> the host, and that you're only passing through the VF device to the VM
> using VFIO. Is my understandin

Re: [dpdk-dev] [PATCH] ethdev: fix a regression due to cache alignment issue

2018-02-10 Thread Matan Azrad
Hi Jerin

From: Jerin Jacob,Sent: Saturday, February 10, 2018 11:42 AM
> Prior to "ethdev: add port ownership" change, the fast path structure struct
> rte_eth_dev->data was cache aligned due to the fact that eth_dev_data was
> allocated from rte_malloc with cache aligned attribute.
> "ethdev: add port ownership" change set introduced a
> rte_eth_dev_shared_data container for port ownership change, This
> resulted in rte_eth_dev->data memory as cache unaligned.
> Added a compiler alignment attribute to make sure rte_eth_dev->data
> always cache aligned and hence compiler can load/store the elements in
> struct rte_eth_dev_data as naturally aligned.
> 
> Some platform like thunderx + l3fwd showed 1% regression in the
> performance with the offending changeset.
> 
> Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
> 

Are you sure the previous port data allocation(before port ownership) was cache 
aligned for all the ports for every system (cache line size 16\32\64\128...) or 
maybe it was only aligned to the first port (port_id=0)?

I think that if the answer is no, this fix fixes early patch, or just 
improvement. 

> Cc: Matan Azrad 
> Cc: Thomas Monjalon 
> Cc: Konstantin Ananyev 
> 
> Signed-off-by: Jerin Jacob 
> Signed-off-by: Pavan Nikhilesh 
> ---
>  lib/librte_ether/rte_ethdev_core.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev_core.h
> b/lib/librte_ether/rte_ethdev_core.h
> index 315b31723..e5681e466 100644
> --- a/lib/librte_ether/rte_ethdev_core.h
> +++ b/lib/librte_ether/rte_ethdev_core.h
> @@ -601,7 +601,7 @@ struct rte_eth_dev_data {
>   struct rte_vlan_filter_conf vlan_filter_conf;
>   /**< VLAN filter configuration. */
>   struct rte_eth_dev_owner owner; /**< The port owner. */ -};
> +} __rte_cache_aligned;
> 
>  /**
>   * @internal
> --
> 2.16.1



[dpdk-dev] [PATCH] maintainers: update vhost lib and pmd

2018-02-10 Thread Jianfeng Tan
Signed-off-by: Jianfeng Tan 
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4f1f33b..38e5fb8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -559,6 +559,7 @@ F: doc/guides/nics/features/vmxnet3.ini
 Vhost-user
 M: Yuanhan Liu 
 M: Maxime Coquelin 
+M: Jianfeng Tan 
 T: git://dpdk.org/next/dpdk-next-virtio
 F: lib/librte_vhost/
 F: doc/guides/prog_guide/vhost_lib.rst
@@ -571,6 +572,7 @@ Vhost PMD
 M: Tetsuya Mukawa 
 M: Yuanhan Liu 
 M: Maxime Coquelin 
+M: Jianfeng Tan 
 T: git://dpdk.org/next/dpdk-next-virtio
 F: drivers/net/vhost/
 F: doc/guides/nics/features/vhost.ini
-- 
2.7.4



Re: [dpdk-dev] [PATCH v2] vhost: fix check if cmsg is NULL

2018-02-10 Thread Tan, Jianfeng


> -Original Message-
> From: Kulasek, TomaszX
> Sent: Saturday, February 10, 2018 1:06 AM
> To: y...@fridaylinux.org
> Cc: dev@dpdk.org; Tan, Jianfeng; sta...@dpdk.org; Wodkowski, PawelX
> Subject: [PATCH v2] vhost: fix check if cmsg is NULL
> 
> Fixes: 8f972312b8f4 ("vhost: support vhost-user")
> Cc: jianfeng@intel.com
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Pawel Wodkowski 
> Signed-off-by: Tomasz Kulasek 
Reviewed-by: Jianfeng Tan 

Thanks for the fix.



Re: [dpdk-dev] [PATCH] eal: fix rte_errno values for IPC API

2018-02-10 Thread Tan, Jianfeng

> -Original Message-
> From: Burakov, Anatoly
> Sent: Saturday, February 10, 2018 9:15 PM
> To: dev@dpdk.org
> Cc: Tan, Jianfeng
> Subject: [PATCH] eal: fix rte_errno values for IPC API
> 
> rte_errno values should not be negative.
> 
> Fixes: bacaa2754017 ("eal: add channel for multi-process communication")
> Fixes: 783b6e54971d ("eal: add synchronous multi-process communication")
> Cc: jianfeng@intel.com
> Signed-off-by: Anatoly Burakov 

Reviewed-by: Jianfeng Tan 

Thanks for fixing this.


[dpdk-dev] i354 autoneg-off link issue

2018-02-10 Thread Ananda Sathyanarayana
Hi,

I am observing a strange issue with i354 when auto-negotiation is turned off. 
The device I have has 6 ethernet ports. Port 1 and 2 are based on i210 and port 
3 to 6 are based on i354 (connected thru an external PHY). The CPU is Atom 
Rangeley (4 core).

I have connected ports 3 and 4 back to back with an external cable. When the 
link is forced to 100M/Full duplex with auto-negotiation off on both the ports, 
the link does not come up.

Whereas the link comes up fine when eth3 (i354) and eth1 (i210) are connected 
back to back and forced to 100M/Full duplex with auto-negotiation off.

This issue is seen with DPDK (16.04) and also linux kernel (ubuntu 14.04).

Is this a known issue ?

Following are logs when running the test using ethtool from linux

admin@Ananda-Desk:~$ lspci | grep Ethernet
00:14.0 Ethernet controller: Intel Corporation Ethernet Connection I354 (rev 
03)  - eth2
00:14.1 Ethernet controller: Intel Corporation Ethernet Connection I354 (rev 
03)  - eth3
00:14.2 Ethernet controller: Intel Corporation Ethernet Connection I354 (rev 
03)  - eth4
00:14.3 Ethernet controller: Intel Corporation Ethernet Connection I354 (rev 
03)  - eth5
01:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection 
(rev 03) - eth0
02:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection 
(rev 03) - eth1

admin@Ananda-Desk:~$ ethtool -i eth3
driver: igb
version: 5.2.13-k
firmware-version: 0.0.0
bus-info: :00:14.1
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

[Force 100M/Full on eth3]

admin@Ananda-Desk:~$ sudo ethtool -s eth3 autoneg off duplex full speed 100

admin@Ananda-Desk:~$ ethtool eth3
Settings for eth3:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes:  Not reported
Advertised pause frame use: Symmetric
Advertised auto-negotiation: No
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
MDI-X: off (auto)
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0x0007 (7)
   drv probe link
Link detected: yes

admin@Ananda-Desk:~$ ethtool eth4
Settings for eth4:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Half
Port: Twisted Pair
PHYAD: 2
Transceiver: internal
Auto-negotiation: on
MDI-X: on (auto)
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0x0007 (7)
   drv probe link
Link detected: yes


[Force 100M/Full on eth4]

admin@Ananda-Desk:~$ sudo ethtool -s eth4 autoneg off duplex full speed 100
admin@Ananda-Desk:~$
admin@Ananda-Desk:~$ ethtool eth4
Settings for eth4:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes:  Not reported
Advertised pause frame use: Symmetric
Advertised auto-negotiation: No
Speed: Unknown!
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 2
Transceiver: internal
Auto-negotiation: off
MDI-X: on (auto)
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0x0007 (7)
   drv probe link
Link detected: no   <<
admin@Ananda-Desk:~$ ethtool eth3
Settings for eth3:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes:  Not reported
Advertised pause frame use: Symmetric
Advertised auto-negotiation: No
Speed: Unknown!
Duplex: Unknown! (255)
Port: Twisted Pair
PHYAD: 1

Re: [dpdk-dev] [PATCH] maintainers: update vhost lib and pmd

2018-02-10 Thread Yang, Zhiyong


> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Jianfeng Tan
> Sent: Sunday, February 11, 2018 9:05 AM
> To: y...@fridaylinux.org; maxime.coque...@redhat.com;
> mtetsu...@gmail.com; dev@dpdk.org
> Cc: tho...@monjalon.net; Tan, Jianfeng 
> Subject: [dpdk-dev] [PATCH] maintainers: update vhost lib and pmd
> 
> Signed-off-by: Jianfeng Tan 

Acked-by: Zhiyong Yang 



[dpdk-dev] PF vlan filter can not work in x710

2018-02-10 Thread ychen
hi,
when I use X710 PF in dpdk mode, i found that vlan filter function does not 
work. when I only add vlan 102, but I can receive packets with  vlan 
tag100,200,300 etc.


I can reproduce this phenomenon following the step:
1. set iommu=pt intel_iommu=on in file /etc/default/grub
2. dpdk-devbind -b vfio-pci eth0
driver: i40e
version: 2.3.6
firmware-version: 5.04 0x8000250b 17.5.10
expansion-rom-version: 
bus-info: :05:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: yes


3.use dpdk version 17.08 and ovs version 2.8.0
4.in ovs code, add vlan filter in function dpdk_eth_dev_init():
   a. set conf.rxmode.hw_vlan_filter =1 before use function 
rte_eth_dev_configure() 
   b. call function rte_eth_dev_vlan_filter(dev->port_id, 102,1)
   c. call function rte_eth_dev_start 




 

Re: [dpdk-dev] [PATCH] vhost: fix close callfd on get vring base

2018-02-10 Thread Tan, Jianfeng


> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Saturday, February 10, 2018 1:11 AM
> To: y...@fridaylinux.org
> Cc: dev@dpdk.org; Xie, Huawei; sta...@dpdk.org; Stojaczyk, DariuszX
> Subject: [dpdk-dev] [PATCH] vhost: fix close callfd on get vring base
> 
> This prevents from destroying & recreating user device in "incomplete"
> vring state. virtio_is_ready() was returning true for devices with
> vrings which did not have valid callfd (their VHOST_USER_SET_VRING_CALL
> hasn't arrived yet)
> 
> Fixes: 8f972312b8f4 ("vhost: support vhost-user")
> Cc: huawei@intel.com
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Dariusz Stojaczyk 
> Signed-off-by: Tomasz Kulasek 

Reviewed-by: Jianfeng Tan 

Thanks for fixing this.


Re: [dpdk-dev] [PATCH] vhost: fix double free on shutdown

2018-02-10 Thread Tan, Jianfeng


> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Saturday, February 10, 2018 1:15 AM
> To: y...@fridaylinux.org
> Cc: dev@dpdk.org; yuanhan@linux.intel.com; sta...@dpdk.org; Stojaczyk,
> DariuszX
> Subject: [dpdk-dev] [PATCH] vhost: fix double free on shutdown
> 
> The vhost connection can be closed concurrently from 2 places:
>  * the connection thread itself
>  * rte_vhost_driver_unregister
> 
> The connection thread will terminate the connection if any recv error
> occurred. The unregister function will terminate the connection together
> with the thread. However, there is no sychronization between those two.
> The connection thread runs in the background without any mutex.

Isn't it already protected by vsocket->conn_mutex?

Thanks,
Jianfeng

> 
> The rte_vhost_driver_unregister now signals the connection thread
> to terminate itself and waits until it's killed.
> 
> Fixes: 65388b43f592 ("vhost: fix fd leaks for vhost-user server mode")
> Cc: yuanhan@linux.intel.com
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Dariusz Stojaczyk 
> Signed-off-by: Tomasz Kulasek 
> ---
>  lib/librte_vhost/socket.c | 21 -
>  1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
> index 83befdced..46ac88efd 100644
> --- a/lib/librte_vhost/socket.c
> +++ b/lib/librte_vhost/socket.c
> @@ -735,7 +735,7 @@ rte_vhost_driver_unregister(const char *path)
>  {
>   int i;
>   int count;
> - struct vhost_user_connection *conn, *next;
> + struct vhost_user_connection *conn;
> 
>   pthread_mutex_lock(&vhost_user.mutex);
> 
> @@ -752,22 +752,17 @@ rte_vhost_driver_unregister(const char *path)
>   }
> 
>   pthread_mutex_lock(&vsocket->conn_mutex);
> - for (conn = TAILQ_FIRST(&vsocket->conn_list);
> -  conn != NULL;
> -  conn = next) {
> - next = TAILQ_NEXT(conn, next);
> -
> - fdset_del(&vhost_user.fdset, conn->connfd);
> - RTE_LOG(INFO, VHOST_CONFIG,
> - "free connfd = %d for device '%s'\n",
> - conn->connfd, path);
> + TAILQ_FOREACH(conn, &vsocket->conn_list, next) {
>   close(conn->connfd);
> - vhost_destroy_device(conn->vid);
> - TAILQ_REMOVE(&vsocket->conn_list, conn,
> next);
> - free(conn);
>   }
>   pthread_mutex_unlock(&vsocket->conn_mutex);
> 
> + do {
> + pthread_mutex_lock(&vsocket-
> >conn_mutex);
> + conn = TAILQ_FIRST(&vsocket->conn_list);
> + pthread_mutex_unlock(&vsocket-
> >conn_mutex);
> + } while (conn != NULL);
> +
>   pthread_mutex_destroy(&vsocket->conn_mutex);
>   free(vsocket->path);
>   free(vsocket);
> --
> 2.14.1



Re: [dpdk-dev] [PATCH] vhost: fix realloc failure

2018-02-10 Thread Tan, Jianfeng


> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Saturday, February 10, 2018 1:19 AM
> To: y...@fridaylinux.org
> Cc: dev@dpdk.org; yuanhan@linux.intel.com; sta...@dpdk.org; Yang,
> Ziye
> Subject: [dpdk-dev] [PATCH] vhost: fix realloc failure
> 
> When reallocation of guest pages fails, vhost_user_set_mem_table() also
> should fail.
> 
> Fixes: e246896178e6 ("vhost: get guest/host physical address mappings")
> Cc: yuanhan@linux.intel.com
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Ziye Yang 
> Signed-off-by: Tomasz Kulasek 

Reviewed-by: Jianfeng Tan 



Re: [dpdk-dev] [PATCH] maintainers: update vhost lib and pmd

2018-02-10 Thread Yuanhan Liu
On Sun, Feb 11, 2018 at 01:04:51AM +, Jianfeng Tan wrote:
> Signed-off-by: Jianfeng Tan 

Acked-by: Yuanhan Liu 

And welcome! BTW, the verb "update" doesn't look good to me ;)

--yliu
> ---
>  MAINTAINERS | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4f1f33b..38e5fb8 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -559,6 +559,7 @@ F: doc/guides/nics/features/vmxnet3.ini
>  Vhost-user
>  M: Yuanhan Liu 
>  M: Maxime Coquelin 
> +M: Jianfeng Tan 
>  T: git://dpdk.org/next/dpdk-next-virtio
>  F: lib/librte_vhost/
>  F: doc/guides/prog_guide/vhost_lib.rst
> @@ -571,6 +572,7 @@ Vhost PMD
>  M: Tetsuya Mukawa 
>  M: Yuanhan Liu 
>  M: Maxime Coquelin 
> +M: Jianfeng Tan 
>  T: git://dpdk.org/next/dpdk-next-virtio
>  F: drivers/net/vhost/
>  F: doc/guides/nics/features/vhost.ini
> -- 
> 2.7.4


Re: [dpdk-dev] [PATCH] vhost: fix remove macro name conflict

2018-02-10 Thread Tan, Jianfeng


> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Saturday, February 10, 2018 1:24 AM
> To: y...@fridaylinux.org
> Cc: dev@dpdk.org; Xie, Huawei; sta...@dpdk.org; Walker, Benjamin
> Subject: [dpdk-dev] [PATCH] vhost: fix remove macro name conflict
> 
> LOG_DEBUG is a symbol defined by POSIX, so if sys/log.h is
> included the symbols conflict.
> 
> This patch changes LOG_DEBUG to VHOST_LOG_DEBUG.
> 
> Fixes: 1c01d52392d5 ("vhost: add debug print")
> Cc: huawei@intel.com
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Ben Walker 
> Signed-off-by: Tomasz Kulasek 

Reviewed-by: Jianfeng Tan 

> ---
>  lib/librte_vhost/vhost.h  | 13 +++--
>  lib/librte_vhost/vhost_user.c | 10 +-
>  lib/librte_vhost/virtio_net.c | 16 
>  3 files changed, 20 insertions(+), 19 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index d947bc9e3..319cc6620 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -296,8 +296,9 @@ vhost_log_used_vring(struct virtio_net *dev, struct
> vhost_virtqueue *vq,
> 
>  #ifdef RTE_LIBRTE_VHOST_DEBUG
>  #define VHOST_MAX_PRINT_BUFF 6072
> -#define LOG_LEVEL RTE_LOG_DEBUG
> -#define LOG_DEBUG(log_type, fmt, args...) RTE_LOG(DEBUG, log_type, fmt,
> ##args)
> +#define VHOST_LOG_LEVEL RTE_LOG_DEBUG

Seems that we can remove LOG_LEVEL definition. But it's another issue.

Thanks,
Jianfeng


Re: [dpdk-dev] [PATCH] vhost: fix return avail ring position in get vring base

2018-02-10 Thread Tan, Jianfeng


> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Saturday, February 10, 2018 1:28 AM
> To: y...@fridaylinux.org
> Cc: dev@dpdk.org; Xie, Huawei; sta...@dpdk.org; Wodkowski, PawelX
> Subject: [dpdk-dev] [PATCH] vhost: fix return avail ring position in get vring
> base
> 
> According to the "Vhost-user Protocol" document,
> VHOST_USER_GET_VRING_BASE should get the available vring base offset.
> 
> Fixes: 8f972312b8f4 ("vhost: support vhost-user")
> Cc: huawei@intel.com
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Pawel Wodkowski 
> Signed-off-by: Tomasz Kulasek 

Reviewed-by: Jianfeng Tan 

Nice catch!

> ---
>  lib/librte_vhost/vhost_user.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index 65ee33919..04eee3a3a 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -881,8 +881,8 @@ vhost_user_get_vring_base(struct virtio_net *dev,
> 
>   dev->flags &= ~VIRTIO_DEV_READY;
> 
> - /* Here we are safe to get the last used index */
> - msg->payload.state.num = vq->last_used_idx;
> + /* Here we are safe to get the last avail index */
> + msg->payload.state.num = vq->last_avail_idx;
> 
>   RTE_LOG(INFO, VHOST_CONFIG,
>   "vring base idx:%d file:%d\n", msg->payload.state.index,
> --
> 2.14.1



Re: [dpdk-dev] [PATCH] vhost: fix wait for valid descriptor

2018-02-10 Thread Tan, Jianfeng


> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Saturday, February 10, 2018 1:35 AM
> To: y...@fridaylinux.org
> Cc: dev@dpdk.org; yuanhan@linux.intel.com; sta...@dpdk.org; Liu,
> Changpeng
> Subject: [dpdk-dev] [PATCH] vhost: fix wait for valid descriptor
> 
> For each virt queue's kickfd and callfd, there are 2 invalid
> status: VIRTIO_UNINITIALIZED_EVENTFD and VIRTIO_INVALID_EVENTFD.
> Don't set the virt queue to ready status until got the valid
> descriptor.

Cannot remember why we introduce two invalid status.

If we treat "VIRTIO_INVALID_EVENTFD" as an indicator to judge if device is 
ready, then defining one status (invalid) is enough.

Thanks,
Jianfeng

> 
> This is safe for polling mode drivers in Guest OS, the backend
> vhost process will not post notification to interrupt vector for
> PMD mode in guest, but the interrupt vector still valid.
> 
> Fixes: e049ca6d10e0 ("vhost-user: prepare multiple queue setup")
> Cc: yuanhan@linux.intel.com
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Changpeng Liu 
> Signed-off-by: Tomasz Kulasek 
> ---
>  lib/librte_vhost/vhost_user.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index 65ee33919..4508f697b 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -766,7 +766,9 @@ vq_is_ready(struct vhost_virtqueue *vq)
>  {
>   return vq && vq->desc && vq->avail && vq->used &&
>  vq->kickfd != VIRTIO_UNINITIALIZED_EVENTFD &&
> -vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD;
> +vq->callfd != VIRTIO_UNINITIALIZED_EVENTFD &&
> +vq->kickfd != VIRTIO_INVALID_EVENTFD &&
> +vq->callfd != VIRTIO_INVALID_EVENTFD;
>  }
> 
>  static int
> --
> 2.14.1



Re: [dpdk-dev] [PATCH] vhost: reduce size of coredump file

2018-02-10 Thread Tan, Jianfeng


> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Saturday, February 10, 2018 1:40 AM
> To: y...@fridaylinux.org
> Cc: dev@dpdk.org; Basierski, SebastianX
> Subject: [dpdk-dev] [PATCH] vhost: reduce size of coredump file
> 
> If application coredumps with vhost-user devices connected to it,
> the generated coredump file size is huge.
> 
> To limit its size, this patch adds call to madvise() with MADV_DONTDUMP
> on memory regions mapped from the VM.

As virtqueue is on guest memory, by this patch, the vq information will not be 
available in the coredump.

Just wonder if adjusting /proc/pid/coredump_filter can help your case?

Thanks,
Jianfeng

> 
> Signed-off-by: Sebastian Basierski 
> Signed-off-by: Tomasz Kulasek 
> ---
>  lib/librte_vhost/vhost_user.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index 65ee33919..fc1f1a948 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -723,6 +723,11 @@ vhost_user_set_mem_table(struct virtio_net *dev,
> struct VhostUserMsg *pmsg)
>   goto err_mmap;
>   }
> 
> + if (madvise(mmap_addr, mmap_size,
> MADV_DONTDUMP) != 0) {
> + RTE_LOG(INFO, VHOST_CONFIG,
> + "MADV_DONTDUMP advice setting
> failed.\n");
> + }
> +
>   reg->mmap_addr = mmap_addr;
>   reg->mmap_size = mmap_size;
>   reg->host_user_addr = (uint64_t)(uintptr_t)mmap_addr +
> --
> 2.14.1



[dpdk-dev] [PATCH] net/i40e: add log when setting input set

2018-02-10 Thread Beilei Xing
This patch adds log when setting input set since global
configuration is changed.

Signed-off-by: Beilei Xing 
---
 drivers/net/i40e/rte_pmd_i40e.c | 30 +-
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index dae59e6..1288c51 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -3071,6 +3071,7 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
 {
struct rte_eth_dev *dev;
struct i40e_hw *hw;
+   struct i40e_pf *pf;
uint64_t inset_reg;
uint32_t mask_reg[2];
int i;
@@ -3086,6 +3087,12 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
return -EINVAL;
 
hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+   if (pf->support_multi_driver) {
+   PMD_DRV_LOG(ERR, "Input set configuration is not supported.");
+   return -ENOTSUP;
+   }
 
/* Clear mask first */
for (i = 0; i < 2; i++)
@@ -3098,14 +3105,17 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
 
switch (inset_type) {
case INSET_HASH:
-   i40e_check_write_reg(hw, I40E_GLQF_HASH_INSET(0, pctype),
-(uint32_t)(inset_reg & UINT32_MAX));
-   i40e_check_write_reg(hw, I40E_GLQF_HASH_INSET(1, pctype),
-(uint32_t)((inset_reg >>
- I40E_32_BIT_WIDTH) & UINT32_MAX));
+   i40e_check_write_global_reg(hw, I40E_GLQF_HASH_INSET(0, pctype),
+   (uint32_t)(inset_reg & UINT32_MAX));
+   i40e_check_write_global_reg(hw, I40E_GLQF_HASH_INSET(1, pctype),
+   (uint32_t)((inset_reg >>
+I40E_32_BIT_WIDTH) & UINT32_MAX));
for (i = 0; i < 2; i++)
-   i40e_check_write_reg(hw, I40E_GLQF_HASH_MSK(i, pctype),
-mask_reg[i]);
+   i40e_check_write_global_reg(hw,
+ I40E_GLQF_HASH_MSK(i, pctype),
+ mask_reg[i]);
+   i40e_global_cfg_warning(I40E_WARNING_HASH_INSET);
+   i40e_global_cfg_warning(I40E_WARNING_HASH_MSK);
break;
case INSET_FDIR:
i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
@@ -3114,8 +3124,10 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
 (uint32_t)((inset_reg >>
  I40E_32_BIT_WIDTH) & UINT32_MAX));
for (i = 0; i < 2; i++)
-   i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype),
-mask_reg[i]);
+   i40e_check_write_global_reg(hw,
+   I40E_GLQF_FD_MSK(i, pctype),
+   mask_reg[i]);
+   i40e_global_cfg_warning(I40E_WARNING_FD_MSK);
break;
case INSET_FDIR_FLX:
i40e_check_write_reg(hw, I40E_PRTQF_FD_FLXINSET(pctype),
-- 
2.5.5



[dpdk-dev] [PATCH] net/i40e: remove unnecessary FDIR mask configuration

2018-02-10 Thread Beilei Xing
Remove unnecessary FDIR mask configuration, otherwise
flow directory mask will be changed when configuring
hash input set.

Signed-off-by: Beilei Xing 
---
 drivers/net/i40e/rte_pmd_i40e.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index 1288c51..b684249 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -3094,10 +3094,6 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
return -ENOTSUP;
}
 
-   /* Clear mask first */
-   for (i = 0; i < 2; i++)
-   i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype), 0);
-
inset_reg = inset->inset;
for (i = 0; i < 2; i++)
mask_reg[i] = (inset->mask[i].field_idx << 16) |
-- 
2.5.5