dpdk.git
7 years agonet/vmxnet3: introduce generalized cmd interface
Shrikrishna Khare [Mon, 6 Mar 2017 22:55:02 +0000 (14:55 -0800)]
net/vmxnet3: introduce generalized cmd interface

Shared memory is used to exchange information between the vmxnet3 driver
and the emulation. In order to request emulation to perform a task, the
driver first populates specific fields in this shared memory and then
issues corresponding command by writing to the command register(CMD). The
layout of the shared memory was defined by vmxnet3 version 1 and cannot
be extended for every new command without breaking backward compatibility.

To address this problem, in vmxnet3 version 3, the emulation repurposed
a reserved field in the shared memory to represent command information
instead. For new commands, the driver first populates the command
information field in the shared memory and then issues the command. The
emulation interprets the data written to the command information
depending on the type of the command. This patch exposes this capability
to the driver.

Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Acked-by: Yong Wang <yongwang@vmware.com>
Acked-by: Jin Heo <heoj@vmware.com>
7 years agonet/vmxnet3: prepare for version 3 changes
Shrikrishna Khare [Mon, 6 Mar 2017 22:55:01 +0000 (14:55 -0800)]
net/vmxnet3: prepare for version 3 changes

Cleanup some code in preparation of vmxnet3 version 3 changes.

Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Acked-by: Yong Wang <yongwang@vmware.com>
Acked-by: Jin Heo <heoj@vmware.com>
7 years agonet/i40e: enable DCB on SRIOV VFs
Jingjing Wu [Tue, 28 Feb 2017 06:26:30 +0000 (14:26 +0800)]
net/i40e: enable DCB on SRIOV VFs

enable DCB on SRIOV VFs, including
 - UP and TC mapping according to dcb_tc in struct rte_eth_dcb_rx_conf.
 - TC and queue mapping: queues are divided equally for each TC.
 - UP insert when sending packet according to the TC the Tx queue
   belongs to.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
7 years agoapp/testpmd: fix TC mapping in DCB init config
Jingjing Wu [Tue, 28 Feb 2017 06:26:29 +0000 (14:26 +0800)]
app/testpmd: fix TC mapping in DCB init config

Fix the UP and TC mapping to divide multiple UPs to TCs instead of mapping
the UPs who are lager than num_tcs to TC0.

Fixes: 1a572499beb6 ("app/testpmd: setup DCB forwarding based on traffic class")
Cc: stable@dpdk.org
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
7 years agoapp/testpmd: fix init config for multi-queue mode
Jingjing Wu [Tue, 28 Feb 2017 06:26:28 +0000 (14:26 +0800)]
app/testpmd: fix init config for multi-queue mode

In SRIOV mode, the mq_mode of rte_eth_rxmode should not carry VMDQ info
without rx_adv_conf setting.

Fixes: a30979f6ad7f ("app/testpmd: set Rx VMDq RSS mode")
Cc: stable@dpdk.org
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
7 years agonet/ixgbe: fix multi-queue mode check in SRIOV mode
Jingjing Wu [Tue, 28 Feb 2017 06:26:27 +0000 (14:26 +0800)]
net/ixgbe: fix multi-queue mode check in SRIOV mode

In SRIOV case, ETH_MQ_RX_VMDQ_DCB and ETH_MQ_RX_DCB should be considered as
the same meaning, due to the multi-queue mapping is the same SRIOV and VMDq
in ixgbe.

Fixes: 27b609cbd1c6 ("ethdev: move the multi-queue mode check to specific drivers")
Cc: stable@dpdk.org
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
7 years agonet/ixgbe: fix all queues drop setting of DCB
Wenzhuo Lu [Mon, 27 Feb 2017 05:34:04 +0000 (13:34 +0800)]
net/ixgbe: fix all queues drop setting of DCB

DCB is split to RX and TX mode. All-queues-drop is set for TX mode.
It's not appropriate because all-queue-drop is a RX feature.
Move this setting from TX to RX.

Fixes: f3f9b17bb8a5 ("net/ixgbe: support multiqueue mode VMDq DCB with SRIOV")
Cc: stable@dpdk.org
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/mlx5: fix extended statistics counters identification
Shahaf Shuler [Sun, 5 Mar 2017 12:02:48 +0000 (14:02 +0200)]
net/mlx5: fix extended statistics counters identification

Checking whether the counter is IB counter was performed with the
wrong index.

Fixes: 859081d3fbbf ("net/mlx5: add out of buffer counter to extended statistic")
Cc: stable@dpdk.org
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: support hardware TSO for VXLAN and GRE
Shahaf Shuler [Thu, 2 Mar 2017 09:05:45 +0000 (11:05 +0200)]
net/mlx5: support hardware TSO for VXLAN and GRE

This commit adds support for hardware TSO for tunneled packets.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: add hardware checksum offload for tunnel packets
Shahaf Shuler [Thu, 2 Mar 2017 09:05:44 +0000 (11:05 +0200)]
net/mlx5: add hardware checksum offload for tunnel packets

Prior to this commit Tx checksum offload was supported only for the
inner headers.
This commit adds support for the hardware to compute the checksum for the
outer headers as well.

The support is for tunneling protocols GRE and VXLAN.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: support hardware TSO
Shahaf Shuler [Thu, 2 Mar 2017 09:01:31 +0000 (11:01 +0200)]
net/mlx5: support hardware TSO

Implement support for hardware TSO.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/ixgbe: remove invalid declaration
Olivier Matz [Tue, 28 Feb 2017 13:22:49 +0000 (14:22 +0100)]
net/ixgbe: remove invalid declaration

The function is not defined anywhere, remove it.

Fixes: 0eb609239efd ("ixgbe: enable Rx queue interrupts for PF and VF")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agonet/ixgbe: fix Rx queue blocking issue
Wenzhuo Lu [Wed, 22 Feb 2017 02:59:35 +0000 (10:59 +0800)]
net/ixgbe: fix Rx queue blocking issue

In the IOV scenario, multi Rx queues can be assigned to one VF.
If the dropping is not enabled, when no descriptors are available
for one queue, this queue can block others.

Fixes: 00e30184daa0 ("ixgbe: add PF support")
Cc: stable@dpdk.org
Suggested-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/i40e: no more initial VF MAC address
Qi Zhang [Tue, 21 Feb 2017 22:45:29 +0000 (17:45 -0500)]
net/i40e: no more initial VF MAC address

During PF initialization, PF will generate an initial mac address
for VFs, the purpose is to help VF keep a constant mac address between
its startup/shutdown cycles. Now this is not necessary, since we already
provide an API to set VF's MAC address from PF side
(rte_pmd_i40e_set_vf_mac_addr).

Application can use this API to lock down VF's mac address.(of course this
should happen before VF init)
While without this patch, we still can use rte_pmd_i40e_set_vf_mac_addr
to overwrite the random one, but this patch align DPDK's default behavior
with Kernel PF driver's, and this help to give an identical experience
when work with kernel VF driver.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
7 years agonet/mlx5: use an RSS drop queue
Nélio Laranjeiro [Wed, 1 Mar 2017 12:49:48 +0000 (13:49 +0100)]
net/mlx5: use an RSS drop queue

Having a drop queue per drop flow consumes a lot of memory and reduce the
speed capabilities of the NIC to handle such cases.
To avoid this and reduce memory consumption, an RSS drop queue is created
for all drop flows.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: support RSS action flow rule
Nélio Laranjeiro [Wed, 1 Mar 2017 12:49:47 +0000 (13:49 +0100)]
net/mlx5: support RSS action flow rule

Implement a basic flow RSS action.  This commits don't handle the default
RSS queues already created by the control plane, this last part being huge.

Any new request RSS flow request will be added using an higher priority
than the default one to be sure this rule will be the one used.

Default ones (those created by dev_start()) remains but has they have a
lower priority they will not receive any new packet.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: prepare support for RSS action rule
Nélio Laranjeiro [Wed, 1 Mar 2017 12:49:46 +0000 (13:49 +0100)]
net/mlx5: prepare support for RSS action rule

In mlx5 PMD handling a single queue of several destination queues ends in
creating the same Verbs attribute, the main difference resides in the
indirection table and the RSS hash key.

This helps to prepare the supports to the RSS queues by first handling the
queue action has being an RSS queue with a single queue.  No RSS hash key
will be provided to the Verbs flow.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: support flag flow action
Nélio Laranjeiro [Wed, 1 Mar 2017 12:49:45 +0000 (13:49 +0100)]
net/mlx5: support flag flow action

This action is not terminal in this PMD, it must be followed by a queue
action.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: extend IPv6 flow item
Nélio Laranjeiro [Wed, 1 Mar 2017 12:49:44 +0000 (13:49 +0100)]
net/mlx5: extend IPv6 flow item

This commit adds:
 - Vtc flow,
 - Protocol,
 - Hop limits

Needs MLNX_OFED-4.0-0.0.7.0 or higher.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: add RSS hash result with mark id
Nélio Laranjeiro [Wed, 1 Mar 2017 12:49:43 +0000 (13:49 +0100)]
net/mlx5: add RSS hash result with mark id

RSS hash and mark ID can now coexists.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: support ether type support in flow item
Nélio Laranjeiro [Wed, 1 Mar 2017 12:49:42 +0000 (13:49 +0100)]
net/mlx5: support ether type support in flow item

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: fix resources free in the right function
Nélio Laranjeiro [Wed, 1 Mar 2017 12:49:41 +0000 (13:49 +0100)]
net/mlx5: fix resources free in the right function

ibv_attr should be freed in the function which allocates the memory.

Fixes: 2097d0d1e2cc ("net/mlx5: support basic flow items and actions")
Cc: stable@dpdk.org
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: fix drop queue creation error
Nélio Laranjeiro [Wed, 1 Mar 2017 12:49:40 +0000 (13:49 +0100)]
net/mlx5: fix drop queue creation error

Creating a drop queue in mlx5 ends by creating a non polled queue, but if
the associated work queue could not be created the error was not handled
ending in a undefined situation.

Fixes: 2097d0d1e2cc ("net/mlx5: support basic flow items and actions")
Cc: stable@dpdk.org
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: fix flow mark action handling
Nélio Laranjeiro [Tue, 28 Feb 2017 09:20:01 +0000 (10:20 +0100)]
net/mlx5: fix flow mark action handling

Mark value is always reported even when not requested or invalid.

Fixes: ea3bc3b1df94 ("net/mlx5: support mark flow action")
Cc: stable@dpdk.org
Reported-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/ixgbe/base: update shared code version to 2017.02.27
Wenzhuo Lu [Wed, 1 Mar 2017 06:04:52 +0000 (14:04 +0800)]
net/ixgbe/base: update shared code version to 2017.02.27

* Add link block check for KR.
* Complete HW initialization even if SFP is not present.
* Add VF xcast promiscuous mode.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/ixgbe/base: fix build error
Wenzhuo Lu [Wed, 1 Mar 2017 06:04:51 +0000 (14:04 +0800)]
net/ixgbe/base: fix build error

Fix ICC build error by removing the EWARN third parameter.

Build error:
.../drivers/net/ixgbe/base/ixgbe_phy.c(1543):
error #268: the format string ends before this argument
EWARN(hw, "WARNING: Intel (R) Network "
^

.../drivers/net/ixgbe/base/ixgbe_phy.c(1805):
error #268: the format string ends before this argument
EWARN(hw, "WARNING: Intel (R) Network "
^

Fixes: aa4fc14d2cee ("ixgbe: update base driver")
Fixes: b94a06c1b451 ("ixgbe/base: support qsfp and lco")
Cc: stable@dpdk.org
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/ixgbe: support xcast promisc mode
Wenzhuo Lu [Wed, 1 Mar 2017 06:04:50 +0000 (14:04 +0800)]
net/ixgbe: support xcast promisc mode

Add the support of xcast promiscuous mode. It's
added in mailbox v1.3.
Move the definition of xcast mode to base code.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/ixgbe/base: disable FC for 15B0
Wenzhuo Lu [Wed, 1 Mar 2017 06:04:49 +0000 (14:04 +0800)]
net/ixgbe/base: disable FC for 15B0

Disable Ethernet Flow Control (FC) for device 15B0.

Make sure that ixgbe_device_supports_autoneg_fc()
returns false and hw->fc.disable_fc_autoneg is set
to true to avoid running the fc_autoneg function
for the device 15B0, as this device doesn't support
this function.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/ixgbe/base: complete HW init when SFP not present
Wenzhuo Lu [Wed, 1 Mar 2017 06:04:48 +0000 (14:04 +0800)]
net/ixgbe/base: complete HW init when SFP not present

If SFP module is not present, reset_hw doesn't return success.
SW should complete the initialization, or with specific module
it resulted in no link when the module was later inserted.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/ixgbe/base: add bit for enabling L3/L4 filtering
Wenzhuo Lu [Wed, 1 Mar 2017 06:04:47 +0000 (14:04 +0800)]
net/ixgbe/base: add bit for enabling L3/L4 filtering

Add a L3/L4 filtering definition of Multiple Receive Queues Command
(MRQC) register for the future use.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/ixgbe/base: add link block check for KR
Wenzhuo Lu [Wed, 1 Mar 2017 06:04:46 +0000 (14:04 +0800)]
net/ixgbe/base: add link block check for KR

When setting up link on x550 KR devices, should check
if there are constraints on link from manageability, which
may result in link loss.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/ixgbe/base: remove X550em SFP iXFI setup
Wenzhuo Lu [Wed, 1 Mar 2017 06:04:45 +0000 (14:04 +0800)]
net/ixgbe/base: remove X550em SFP iXFI setup

Removes X550em SFP iXFI setup since there is no released
HW production with SFP iXFI.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/ixgbe/base: make a debug message simple
Wenzhuo Lu [Wed, 1 Mar 2017 06:04:44 +0000 (14:04 +0800)]
net/ixgbe/base: make a debug message simple

The debug message is too long. Make it shorter.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/i40e: implement vector PMD for altivec
Gowrishankar Muthukrishnan [Thu, 23 Feb 2017 04:39:08 +0000 (10:09 +0530)]
net/i40e: implement vector PMD for altivec

This patch enables i40e driver in PowerPC along with its altivec
intrinsic support.

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
7 years agonet/i40e: fix a typo in flow
Rami Rosen [Mon, 27 Feb 2017 04:53:59 +0000 (23:53 -0500)]
net/i40e: fix a typo in flow

This patch fixes a trivial typo in i40e_flow.c.

Fixes: 47c6782344b7 ("net/i40e: fix tunnel filter")
Fixes: d416530e6358 ("net/i40e: parse tunnel filter")
Cc: stable@dpdk.org
Signed-off-by: Rami Rosen <rami.rosen@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agonet/mlx5: fix supported packets types
Nélio Laranjeiro [Fri, 24 Feb 2017 09:16:56 +0000 (10:16 +0100)]
net/mlx5: fix supported packets types

Fixes: 0603df73a077 ("net/mlx5: fix Rx packet validation and type")
Cc: stable@dpdk.org
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/e1000/base: fix multicast setting in VF
Yong Wang [Tue, 21 Feb 2017 09:33:23 +0000 (04:33 -0500)]
net/e1000/base: fix multicast setting in VF

In function e1000_update_mc_addr_list_vf(), "msgbuf[0]" is used prior
to initialization at "msgbuf[0] |= E1000_VF_SET_MULTICAST_OVERFLOW".
And "msgbuf[0]" is overwritten at "msgbuf[0] = E1000_VF_SET_MULTICAST".

Fix it by moving the second line prior to the first one that mentioned
above.

Fixes: dffbaf7880a8 ("e1000: revert fix for multicast in VF")
Cc: stable@dpdk.org
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/bnx2x: fix transmit queue free threshold
Chas Williams [Fri, 10 Feb 2017 20:12:06 +0000 (15:12 -0500)]
net/bnx2x: fix transmit queue free threshold

The default tx_free_thresh is potentially larger than the allocated queue
which will result in TX queue cleanup never happening.  To fix this,
lower the default free threshold and ensure that the free threshold is
never greater than the maximum outstanding transmit buffers.

Fixes: 827ed2a118cc ("net/bnx2x: restructure Tx routine")
Cc: stable@dpdk.org
Signed-off-by: Chas Williams <ciwillia@brocade.com>
Acked-by: Harish Patil <harish.patil@qlogic.com>
7 years agonet/mlx5: fix startup when flow cannot be applied
Nélio Laranjeiro [Wed, 22 Feb 2017 09:57:52 +0000 (10:57 +0100)]
net/mlx5: fix startup when flow cannot be applied

When flows cannot be re-applied due to configuration modifications, the
start function should rollback the configuration done.

Fixes: 2097d0d1e2cc ("net/mlx5: support basic flow items and actions")
Cc: stable@dpdk.org
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: fix extended statistics
Shahaf Shuler [Tue, 21 Feb 2017 14:37:24 +0000 (16:37 +0200)]
net/mlx5: fix extended statistics

The number of extended statistics counters is queried through ETHTOOL.
ETHTOOL provides a different number when the link is up or down.
Since extended statistics query occurs at device start,
segmentation fault might happen when changing the link state before and
after the device start.

this commit address this issue, and query the number of statistics
before every call to ETHTOOL.

Fixes: a4193ae3bc4f ("net/mlx5: support extended statistics")
Cc: stable@dpdk.org
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: remove unused interface name query
Shahaf Shuler [Tue, 21 Feb 2017 14:37:23 +0000 (16:37 +0200)]
net/mlx5: remove unused interface name query

Interface name is queried, however never used.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agodoc: add tap features
Pascal Mazon [Tue, 21 Feb 2017 13:14:53 +0000 (14:14 +0100)]
doc: add tap features

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agonet/i40e: fix compile error
Qi Zhang [Mon, 20 Feb 2017 18:11:56 +0000 (13:11 -0500)]
net/i40e: fix compile error

Fix the compile error when RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
is disabled.

Also fake_mbuf is required to be initialized and assigned to
additional sw_ring entries for vector PMD independent from
RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC config option.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
7 years agonet/mlx5: fix VLAN stripping indication
Shahaf Shuler [Mon, 20 Feb 2017 11:14:32 +0000 (13:14 +0200)]
net/mlx5: fix VLAN stripping indication

The indication on vlan stripping was taken from the wrong location in the
completion entry.

Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")
Cc: stable@dpdk.org
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/i40e: fix memory allocation for hash table
Beilei Xing [Fri, 17 Feb 2017 08:37:56 +0000 (16:37 +0800)]
net/i40e: fix memory allocation for hash table

Testpmd failed to start in another hugetlbfs mount point on
i40e, the root cause is that hash table is always allocated
on socket 0.

Issue can be reproduced by forcing testpmd to allocate memory
only from node 1:

testpmd --socket-mem=0,8192 -- -i --socket-num=1

EAL: PCI device 0000:81:00.0 on NUMA socket 1
EAL:   probe driver: 8086:1572 net_i40e
PMD: eth_i40e_dev_init(): FW 4.40 API 1.4 NVM 04.05.03 eetrack 80001cd8
RING: Cannot reserve memory
HASH: memory allocation failed
PMD: i40e_init_ethtype_filter_list(): Failed to create ethertype hash
table!
EAL: Error - exiting with code: 1
  Cause: Requested device 0000:81:00.0 cannot be used

Fix the issue by assigning socket id during hash parameter definition.

Fixes: 5c53c82c8174 ("net/i40e: store flow director filter")
Fixes: 425c3325f0b0 ("net/i40e: store tunnel filter")
Fixes: 078259773da9 ("net/i40e: store ethertype filter")
Cc: stable@dpdk.org
Reported-by: Ivan Nardi <nardi.ivan@gmail.com>
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
7 years agonet/i40e: fix TC bitmap of VEB
Wenzhuo Lu [Thu, 16 Feb 2017 03:29:17 +0000 (11:29 +0800)]
net/i40e: fix TC bitmap of VEB

When setting up the VEB, default TC bitmap is used.

But after setting the default TC bitmap, it's not stored. So when we're
trying to get the enabled TCs on the VEB, it's always wrong.

Fixes: 5135f3ca49a7 ("i40e: enable DCB in VMDQ VSIs")
Cc: stable@dpdk.org
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/i40e: remove redundant macros
Qiming Yang [Mon, 20 Feb 2017 05:48:13 +0000 (13:48 +0800)]
net/i40e: remove redundant macros

These macros are left by historical reasons and useless now.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
7 years agonet/i40e: remove redundant VLAN insert code
Qiming Yang [Mon, 20 Feb 2017 05:43:03 +0000 (13:43 +0800)]
net/i40e: remove redundant VLAN insert code

Remove useless tx_flags and related macros in VLAN insertion.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
7 years agonet/kni: add KNI PMD
Ferruh Yigit [Fri, 17 Feb 2017 13:42:38 +0000 (13:42 +0000)]
net/kni: add KNI PMD

Add KNI PMD which wraps librte_kni for ease of use.

KNI PMD can be used as any regular PMD to send / receive packets to the
Linux networking stack.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Yong Wang <yongwang@vmware.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Yong Wang <yongwang@vmware.com>
7 years agonet/mlx5: add out of buffer counter to extended statistic
Shahaf Shuler [Tue, 14 Feb 2017 14:31:06 +0000 (16:31 +0200)]
net/mlx5: add out of buffer counter to extended statistic

This commit adds RX out of buffer counter to xstats report.
The counter counts the number of dropped occurred due to lack of buffers
on device RX queues.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/tap: fix possibly unterminated string
Keith Wiles [Fri, 17 Feb 2017 15:43:04 +0000 (09:43 -0600)]
net/tap: fix possibly unterminated string

Calling strncpy with a maximum size argument of 16 bytes on destination
array "ifr.ifr_ifrn.ifrn_name" of size 16 bytes might leave the
destination string unterminated.

Coverity issue: 1407499
Fixes: 6b38b2725cdb ("net/tap: fix multi-queue support")
Cc: stable@dpdk.org
Signed-off-by: Keith Wiles <keith.wiles@intel.com>
7 years agokni: fix build on Suse 12 SP3
Nirmoy Das [Tue, 4 Apr 2017 14:16:23 +0000 (16:16 +0200)]
kni: fix build on Suse 12 SP3

Add support for SLES12SP3, which uses kernel 4.4,
but backported features from newer kernels.

Signed-off-by: Nirmoy Das <ndas@suse.de>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agocfgfile: support empty value
Allain Legacy [Fri, 31 Mar 2017 13:52:03 +0000 (09:52 -0400)]
cfgfile: support empty value

This commit adds support to the cfgfile library for parsing a key=value
line that has no value string specified (e.g., "key=").  This can be used
to override a configuration attribute that has a default value or default
list of values to set it back to an undefined value to disable
functionality.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
7 years agocfgfile: fix parsing of long fields
Joseph Richard [Fri, 31 Mar 2017 13:52:02 +0000 (09:52 -0400)]
cfgfile: fix parsing of long fields

When parsing a ini file with a "key = value" line that has both "key" and
"value" sized to the maximum allowed length causes a parsing failure.  The
internal "buffer" variable should be sized at least as large as the maximum
for both fields.  This commit updates the local array to be sized to hold
the max name, max value, " = ", and the nul terminator.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
7 years agocfgfile: constrain string search
Allain Legacy [Fri, 31 Mar 2017 13:52:01 +0000 (09:52 -0400)]
cfgfile: constrain string search

The call to memchr() uses the absolute length of the string buffer instead
of the actual length of the string returned by fgets().  This causes the
search to go beyond the '\n' character and find ';' characters in random
garbage on the stack.  This then causes the 'len' variable to be updated
and the subsequent search for the '=' character to potentially find one
beyond the first newline character.

Since this bug relies on ';' and '=' characters appearing in random places
in the 'buffer' variable it is intermittently reproducible at best.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
7 years agocfgfile: support configurable comment character
Allain Legacy [Fri, 31 Mar 2017 13:52:00 +0000 (09:52 -0400)]
cfgfile: support configurable comment character

The current cfgfile comment character is hardcoded to ';'.  This commit a
new API to allow the user to specify which comment character to use while
parsing the file.

This is to ease adoption by applications that have an existing
configuration file which may use a different comment character.  For
instance, an application may already have a configuration file that uses
the '#' as the comment character.

The approach of using a new API with an extensible parameters structure was
used rather than simply adding a new argument to the existing API to allow
for additional arguments to be introduced in the future.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
7 years agocfgfile: support global properties section
Allain Legacy [Fri, 31 Mar 2017 13:51:59 +0000 (09:51 -0400)]
cfgfile: support global properties section

The current implementation of the cfgfile library requires that all
key=value pairs be within [SECTION] definitions.  The ini file standard
allows for key=value pairs in an unnamed section.

   https://en.wikipedia.org/wiki/INI_file#Global_properties

This commit adds the capability of parsing key=value pairs from such an
unnamed section. The CFG_FLAG_GLOBAL_SECTION flag must be passed to the
rte_cfgfile_load() API to enable this functionality.  Any key=value pairs
found before the first section can be accessed in the section named
"GLOBAL".

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
7 years agotest/cfgfile: add basic unit tests
Allain Legacy [Fri, 31 Mar 2017 13:51:58 +0000 (09:51 -0400)]
test/cfgfile: add basic unit tests

This commit adds the basic infrastructure for the cfgfile library unit
tests.  It includes success path tests for the most commonly used APIs.
More unit tests will be added later.

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
7 years agodoc: fix a typo in howto guide
Yong Wang [Wed, 29 Mar 2017 08:27:35 +0000 (04:27 -0400)]
doc: fix a typo in howto guide

Fixes: 0ba3870e7559 ("doc: add guide to use virtio-user as exceptional path")
Cc: stable@dpdk.org
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agodistributor: fix creation error checks
David Hunt [Tue, 4 Apr 2017 02:42:41 +0000 (03:42 +0100)]
distributor: fix creation error checks

Coverity issue 143258: not freeing distributor instance
Coverity issue 143254: not checking return code from malloc
Fixes: 775003ad2f96 ("distributor: add new burst-capable library")

Signed-off-by: David Hunt <david.hunt@intel.com>
7 years agoexamples/ip_fragmentation: fix check of packet type
Wei Dai [Tue, 14 Mar 2017 14:47:49 +0000 (22:47 +0800)]
examples/ip_fragmentation: fix check of packet type

The packet_type in mbuf is not correctly filled by ixgbe 82599 NIC.
To use the ether_type in ethernet header to check packet type is
more reliaber.

Fixes: 3c0184cc0c60 ("examples: replace some offload flags with packet type")
Fixes: ab351fe1c95c ("mbuf: remove packet type from offload flags")
Cc: stable@dpdk.org
Reported-by: Fangfang Wei <fangfangx.wei@intel.com>
Signed-off-by: Wei Dai <wei.dai@intel.com>
Tested-by: Fangfang Wei <fangfangx.wei@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
7 years agodoc: add option -d for plugins in Linux guide
Reshma Pattan [Mon, 27 Mar 2017 12:32:17 +0000 (13:32 +0100)]
doc: add option -d for plugins in Linux guide

Update the document with the available EAL command
line option to install the pmd drivers that are built
as shared libraries.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agoeal/linux: fix build with glibc 2.25
Jerin Jacob [Mon, 3 Apr 2017 08:35:14 +0000 (14:05 +0530)]
eal/linux: fix build with glibc 2.25

glibc 2.25 is warning about if applications depend on
sys/types.h for makedev macro, it expects to be included
from <sys/sysmacros.h>

Found this error while testing with GCC 6.3.1 on archlinux.

lib/librte_eal/linuxapp/eal/eal_pci_uio.c: In function ‘pci_mknod_uio_dev’:
lib/librte_eal/linuxapp/eal/eal_pci_uio.c:134:13:
error: In the GNU C Library, "makedev" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "makedev", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"makedev", you should undefine it after including <sys/types.h>. [-Werror]
 dev = makedev(major, minor);
             ^~~~~~~~~~~~~~~~~

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
7 years agonic_uio: fix device binding at boot
Bruce Richardson [Fri, 24 Mar 2017 14:30:11 +0000 (14:30 +0000)]
nic_uio: fix device binding at boot

When loading nic_uio from /boot/loader.conf as specified in the Getting
Started Guide doc, the NIC devices were not bound at boot. Unloading the
nic_uio driver and reloading it would cause them to be bound, however.

The root cause appears to be the fact that when the module is loaded at
boot, the call to find the pci device when parsing the b:d:f parameter
fails to return the device. That means that later on when the device
is probed as part of a PCI scan, no action is taken as it's not recorded
as a device to be used.

We fix this by having the b:d:f string parsed again on probe if the
initial check to see if it's an already-known device fails. In my tests,
this causes the NIC devices to be successfully bound at boot time, as
well as leaving things working as before in the case the module is loaded
post-boot.

Fixes: 764bf26873b9 ("add FreeBSD support")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
7 years agovfio: fix secondary process start
Jianfeng Tan [Thu, 16 Mar 2017 16:28:44 +0000 (16:28 +0000)]
vfio: fix secondary process start

When binding with vfio-pci, secondary process cannot be started with
an error message:

    cannot find TAILQ entry for PCI device.

It's due to: struct rte_pci_addr is padded with 1 byte for alignment
by compiler. Then below comparison in commit 2f4adfad0a69
("vfio: add multiprocess support") will fail if the last byte is not
initialized.

    memcmp(&vfio_res->pci_addr, &dev->addr, sizeof(dev->addr)

And commit cdc242f260e7 ("eal/linux: support running as unprivileged user")
just triggers this bug by using a stack un-initialized variable.

The fix is to use rte_eal_compare_pci_addr() for pci addr comparison.

Fixes: 2f4adfad0a69 ("vfio: add multiprocess support")
Fixes: cdc242f260e7 ("eal/linux: support running as unprivileged user")
Cc: stable@dpdk.org
Reported-by: Pawel Rutkowski <pawelx.rutkowski@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
7 years agovfio: fix build
Anatoly Burakov [Mon, 3 Apr 2017 12:58:05 +0000 (13:58 +0100)]
vfio: fix build

Some compilers require definition of vfio_iommu_spapr_tce_ddw_info
before its use in vfio_iommu_spapr_tce_info, so move tce_info
definition below tce_ddw_info.

Fixes: 468f42cc2645 ("vfio: fix build on old kernel")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agoigb_uio: fix build with kernel < 3.2
Ferruh Yigit [Mon, 3 Apr 2017 16:49:01 +0000 (17:49 +0100)]
igb_uio: fix build with kernel < 3.2

Recently added "dma_zalloc_coherent()" call is causing build error
for Linux kernels < 3.2.

compile error:
lib/librte_eal/linuxapp/igb_uio/igb_uio.c:
  In function ‘igbuio_pci_probe’:
lib/librte_eal/linuxapp/igb_uio/igb_uio.c:434:2:
error: implicit declaration of function ‘dma_zalloc_coherent’
  [-Werror=implicit-function-declaration]
  map_addr = dma_zalloc_coherent(&dev->dev, 1024,
  ^

dma_zalloc_coherent() introduced with Linux kernel 3.2, with commit
Linux: 842fa69f3e0c ("include/linux/dma-mapping.h: add dma_zalloc_coherent()")
Since it does not exist for older kernels, causing a build error.

Switched to dma_alloc_coherent() API to prevent build error.

Fixes: d287e4d41be0 ("igb_uio: map dummy DMA forcing IOMMU domain attachment")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agomempool: move stack handler as a driver
Shreyansh Jain [Fri, 31 Mar 2017 05:35:37 +0000 (11:05 +0530)]
mempool: move stack handler as a driver

Moved from lib/librte_mempool, stack mempool handler is an independent
driver.
Shared builds would now require to link in librte_mempool_stack for
"stack" mempool handler.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomempool: move ring handler as a driver
Shreyansh Jain [Fri, 31 Mar 2017 05:35:36 +0000 (11:05 +0530)]
mempool: move ring handler as a driver

Moved from lib/librte_mempool, ring mempool is now an independent
driver.
Shared builds would now need to add librte_mempool_ring for:
* ring_mp_mc
* ring_sp_sc
* ring_sp_mc
* ring_mp_sc

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomempool: fix crash when handler not found
Shreyansh Jain [Fri, 31 Mar 2017 05:35:35 +0000 (11:05 +0530)]
mempool: fix crash when handler not found

In case the stack or ring mempool handler are compiled as shared
library and not linked in with test binary, segfault is reported.
This is because return value of rte_mempool_set_ops_byname is not
being checked in rte_mempool_ops_alloc.

This patch handles error returned from rte_mempool_set_ops_byname
when a mempool is not found.

Fixes: 449c49b93a6b ("mempool: support handler operations")

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomempool: fix typos
Andriy Berestovskyy [Fri, 31 Mar 2017 14:03:54 +0000 (16:03 +0200)]
mempool: fix typos

Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomempool: update non-EAL thread note
Gage Eads [Thu, 30 Mar 2017 23:02:00 +0000 (18:02 -0500)]
mempool: update non-EAL thread note

Commit 30e6399892276 ("mempool: support non-EAL thread") added the
capability for non-EAL threads to use the mempool library. This commit
removes the note indicating that the mempool library cannot be used safely
by non-EAL threads, and replaces it with a more up-to-date note.

Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agomk: use icc default inline limit
Ferruh Yigit [Mon, 27 Mar 2017 14:35:44 +0000 (15:35 +0100)]
mk: use icc default inline limit

ICC build time
Before this patch (bnx2x PMD enabled [1])
real    8m16.622s

After this patch (bnx2x enabled)
real    0m35.140s

[1]
bnx2x cause the build take a lot, otherwise build times are more sane
numbers.

ICC has a default inline limit and when this limit is hit it generates
a warning, and in DPDK this breaks the build.

Previous solution was to remove the inline limit, which does more
aggressive inlining and build may take too much time.

This patch keeps the default inline limits, but prevents the warning ICC
generates.

Fixes: 8acbad88c4fa ("mk: fix build with icc-15")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agoigb_uio: use non-threaded ISR
David Su [Fri, 20 Jan 2017 23:08:19 +0000 (15:08 -0800)]
igb_uio: use non-threaded ISR

This eliminates the overhead of a task switch when an interrupt arrives.

Signed-off-by: David Su <david.w.su@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agoigb_uio: map dummy DMA forcing IOMMU domain attachment
Alejandro Lucero [Wed, 18 Jan 2017 12:27:55 +0000 (12:27 +0000)]
igb_uio: map dummy DMA forcing IOMMU domain attachment

For using a DPDK app when iommu is enabled, it requires to
add iommu=pt to the kernel command line. But using igb_uio driver
makes DMAR errors because the device has not an IOMMU domain.

Since kernel 3.15, iommu=pt requires to use the internal kernel
DMA API for attaching the device to the IOMMU 1:1 mapping, aka
si_domain. Previous versions did attach the device to that
domain when intel iommu notifier was called.

This is not a problem if the driver does later some call to the
DMA API because the mapping can be done then. But DPDK apps do
not use that DMA API at all.

Doing this dma map and unmap is harmless even when iommu is not
enabled at all.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agovfio: support hotplug
Alejandro Lucero [Wed, 29 Mar 2017 09:54:50 +0000 (10:54 +0100)]
vfio: support hotplug

Current device hotplug is just supported by UIO managed devices.
This patch adds same functionality with VFIO.

It has been validated through tests using IOMMU and also with
VFIO and no-iommu mode.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agovfio: fix disabling INTx
Nikhil Rao [Tue, 28 Mar 2017 23:54:07 +0000 (05:24 +0530)]
vfio: fix disabling INTx

The flags member of irq_set should be ORed with VFIO_IRQ_SET_ACTION_MASK
and not VFIO_IRQ_SET_ACTION_UNMASK. The bug was found by code inspection.

Fixes: 5c782b3928b8 ("vfio: interrupts")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agovfio: fix build on old kernel
Anatoly Burakov [Tue, 28 Mar 2017 15:53:43 +0000 (16:53 +0100)]
vfio: fix build on old kernel

Fixing compile failures for kernels without sPAPR IOMMU support.

Fixes: 0fe9830b5345 ("eal/ppc: support sPAPR IOMMU for vfio-pci")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agokni: fix build with kernel 4.11
Ferruh Yigit [Tue, 21 Mar 2017 09:54:48 +0000 (09:54 +0000)]
kni: fix build with kernel 4.11

compile error:
.../build/build/lib/librte_eal/linuxapp/kni/kni_net.c:124:6:
error: implicit declaration of function ‘signal_pending’
[-Werror=implicit-function-declaration]
  if (signal_pending(current) || ret_val <= 0) {
      ^~~~~~~~~~~~~~

Linux 4.11 moves signal function declarations to its own header file:
Linux: 174cd4b1e5fb ("sched/headers: Prepare to move signal wakeup &
sigpending methods from <linux/sched.h> into <linux/sched/signal.h>")

Use new header file "linux/sched/signal.h" to fix the build error.

Cc: stable@dpdk.org
Reported-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: Pankaj Gupta <pagupta@redhat.com>
7 years agomk: fix dependencies to optional configs
Olivier Matz [Thu, 30 Mar 2017 12:32:28 +0000 (14:32 +0200)]
mk: fix dependencies to optional configs

In rte.lib.mk, the list of libraries passed to the link
command (LDLIBS) is generated from the DEPDIRS-xxx variables.
If a library is not compiled because it is disabled in
configuration, it should not appear in DEPDIRS-xxx.

- librte_port depends on librte_kni only if it is enabled.
- librte_table depends on librte_acl only if it is enabled.

Fixes: feb9f680cd2c ("mk: optimize directory dependencies")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agonet/mlx5: implement descriptor status API
Olivier Matz [Wed, 29 Mar 2017 08:36:32 +0000 (10:36 +0200)]
net/mlx5: implement descriptor status API

Since there is no "descriptor done" flag like on Intel drivers, the
approach is different on mlx5 driver.
- for Tx, we call txq_complete() to free descriptors processed by
  the hw, then we check if the descriptor is between tail and head
- for Rx, we need to browse the cqes, managing compressed ones,
  to get the number of used descriptors.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
7 years agonet/i40e: implement descriptor status API
Olivier Matz [Wed, 29 Mar 2017 08:36:33 +0000 (10:36 +0200)]
net/i40e: implement descriptor status API

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/ixgbe: implement descriptor status API
Olivier Matz [Wed, 29 Mar 2017 08:36:29 +0000 (10:36 +0200)]
net/ixgbe: implement descriptor status API

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
7 years agonet/igb: implement descriptor status API
Olivier Matz [Wed, 29 Mar 2017 08:36:30 +0000 (10:36 +0200)]
net/igb: implement descriptor status API

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/e1000: implement descriptor status API
Olivier Matz [Wed, 29 Mar 2017 08:36:31 +0000 (10:36 +0200)]
net/e1000: implement descriptor status API

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoethdev: add descriptor status API
Olivier Matz [Wed, 29 Mar 2017 08:36:28 +0000 (10:36 +0200)]
ethdev: add descriptor status API

Introduce a new API to get the status of a descriptor.

For Rx, it is almost similar to rx_descriptor_done API, except it
differentiates "used" descriptors (which are hold by the driver and not
returned to the hardware).

For Tx, it is a new API.

The descriptor_done() API, and probably the rx_queue_count() API could
be replaced by this new API as soon as it is implemented on all PMDs.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
7 years agoring: make struct and macros type agnostic
Bruce Richardson [Wed, 29 Mar 2017 15:21:30 +0000 (16:21 +0100)]
ring: make struct and macros type agnostic

Modify the enqueue and dequeue macros to support copying any type of
object by passing in the exact object type. Rather than using the "ring"
structure member of rte_ring, which is of type "array of void *", instead
have the macros take the start of the ring a a pointer value, thereby
leaving the rte_ring structure as purely a header value. This allows it
to be reused by other future ring types which can add on extra fields if
they want, or even to have the actual ring elements, of whatever type
stored separate from the ring header.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: create common function for updating tail index
Bruce Richardson [Wed, 29 Mar 2017 15:21:29 +0000 (16:21 +0100)]
ring: create common function for updating tail index

Both producer and consumer use the same logic for updating the tail
index so merge into a single function.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: separate out head index manipulation
Bruce Richardson [Wed, 29 Mar 2017 15:21:28 +0000 (16:21 +0100)]
ring: separate out head index manipulation

We can write a single common function for head manipulation for enq
and a common one for deq, allowing us to have a single worker function
for enq and deq, rather than two of each. Update all other inline
functions to use the new functions.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: reduce scope of local variables
Bruce Richardson [Wed, 29 Mar 2017 15:21:27 +0000 (16:21 +0100)]
ring: reduce scope of local variables

The local variable i is only used for loop control so define it in
the enqueue and dequeue blocks directly, rather than at the function
level.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoexamples/quota_watermark: use ring space for watermarks
Bruce Richardson [Wed, 29 Mar 2017 15:21:26 +0000 (16:21 +0100)]
examples/quota_watermark: use ring space for watermarks

Now that the enqueue function returns the amount of space in the ring,
we can use that to replace the old watermark functionality. Update the
example app to do so, and re-enable it in the examples Makefile.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: return remaining entry count when dequeuing
Bruce Richardson [Wed, 29 Mar 2017 15:21:25 +0000 (16:21 +0100)]
ring: return remaining entry count when dequeuing

Add an extra parameter to the ring dequeue burst/bulk functions so that
those functions can optionally return the amount of remaining objs in the
ring. This information can be used by applications in a number of ways,
for instance, with single-consumer queues, it provides a max
dequeue size which is guaranteed to work.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: return free space when enqueuing
Bruce Richardson [Wed, 29 Mar 2017 15:21:24 +0000 (16:21 +0100)]
ring: return free space when enqueuing

Add an extra parameter to the ring enqueue burst/bulk functions so that
those functions can optionally return the amount of free space in the
ring. This information can be used by applications in a number of ways,
for instance, with single-producer queues, it provides a max
enqueue size which is guaranteed to work. It can also be used to
implement watermark functionality in apps, replacing the older
functionality with a more flexible version, which enables apps to
implement multiple watermark thresholds, rather than just one.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: make bulk and burst return values consistent
Bruce Richardson [Wed, 29 Mar 2017 15:21:23 +0000 (16:21 +0100)]
ring: make bulk and burst return values consistent

The bulk fns for rings returns 0 for all elements enqueued and negative
for no space. Change that to make them consistent with the burst functions
in returning the number of elements enqueued/dequeued, i.e. 0 or N.
This change also allows the return value from enq/deq to be used directly
without a branch for error checking.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: remove watermark support
Bruce Richardson [Wed, 29 Mar 2017 15:21:22 +0000 (16:21 +0100)]
ring: remove watermark support

Remove the watermark support. A future commit will add support for having
enqueue functions return the amount of free space in the ring, which will
allow applications to implement their own watermark checks, while also
being more useful to the app.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: remove the yield when waiting for tail update
Bruce Richardson [Wed, 29 Mar 2017 15:21:21 +0000 (16:21 +0100)]
ring: remove the yield when waiting for tail update

There was a compile time setting to enable a ring to yield when
it entered a loop in mp or mc rings waiting for the tail pointer update.
Build time settings are not recommended for enabling/disabling features,
and since this was off by default, remove it completely. If needed, a
runtime enabled equivalent can be used.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: remove debug setting
Bruce Richardson [Wed, 29 Mar 2017 15:21:20 +0000 (16:21 +0100)]
ring: remove debug setting

The debug option only provided statistics to the user, most of
which could be tracked by the application itself. Remove this as a
compile time option, and feature, simplifying the code.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: eliminate duplication of size and mask fields
Bruce Richardson [Wed, 29 Mar 2017 15:21:19 +0000 (16:21 +0100)]
ring: eliminate duplication of size and mask fields

The size and mask fields are duplicated in both the producer and
consumer data structures. Move them out of that into the top level
structure so they are not duplicated.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: create common structure for prod and cons metadata
Bruce Richardson [Wed, 29 Mar 2017 15:21:18 +0000 (16:21 +0100)]
ring: create common structure for prod and cons metadata

create a common structure to hold the metadata for the producer and
the consumer, since both need essentially the same information - the
head and tail values, the ring size and mask.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
7 years agoring: remove split cacheline build setting
Bruce Richardson [Wed, 29 Mar 2017 15:21:17 +0000 (16:21 +0100)]
ring: remove split cacheline build setting

Users compiling DPDK should not need to know or care about the arrangement
of cachelines in the rte_ring structure.  Therefore just remove the build
option and set the structures to be always split. On platforms with 64B
cachelines, for improved performance use 128B rather than 64B alignment
since it stops the producer and consumer data being on adjacent cachelines.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>