dpdk.git
4 years agonet/bnxt: support TruFlow core table scope
Farah Smith [Wed, 15 Apr 2020 08:18:48 +0000 (13:48 +0530)]
net/bnxt: support TruFlow core table scope

- Added TruFlow Table public API
- Added Table Scope capability including Table Type support code for
  setting and getting Table Types.

Signed-off-by: Farah Smith <farah.smith@broadcom.com>
Signed-off-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support TruFlow core TCAM
Shahaji Bhosle [Wed, 15 Apr 2020 08:18:47 +0000 (13:48 +0530)]
net/bnxt: support TruFlow core TCAM

- Add TruFlow TCAM public API functions
- Add TCAM support functions as well as public APIs.

Signed-off-by: Shahaji Bhosle <sbhosle@broadcom.com>
Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add TruFlow core identifier
Farah Smith [Wed, 15 Apr 2020 08:18:46 +0000 (13:48 +0530)]
net/bnxt: add TruFlow core identifier

- Add TruFlow Identifier resource support
- Add TruFlow public API for Identifier resources.
- Add support code and stack for Identifier resource allocation control.

Signed-off-by: Farah Smith <farah.smith@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add resource manager
Michael Wildt [Wed, 15 Apr 2020 08:18:45 +0000 (13:48 +0530)]
net/bnxt: add resource manager

- Add TruFlow RM functionality for resource handling
- Update the TruFlow Resource Manager (RM) with resource
  support functions for debugging as well as resource cleanup.
- Add support for Internal and external pools.

Signed-off-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add initial TruFlow core resource management
Shahaji Bhosle [Wed, 15 Apr 2020 08:18:44 +0000 (13:48 +0530)]
net/bnxt: add initial TruFlow core resource management

- Add TruFlow public API definitions for resources
  as well as RM infrastructure

Signed-off-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add TruFlow core session SRAM
Michael Wildt [Wed, 15 Apr 2020 08:18:43 +0000 (13:48 +0530)]
net/bnxt: add TruFlow core session SRAM

- Add TruFlow session resource support functionality
- Add TruFlow session hw flush capability as well as
  sram support functions.
- Add resource definitions for session pools.

Signed-off-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add initial TruFlow core session close
Michael Wildt [Wed, 15 Apr 2020 08:18:42 +0000 (13:48 +0530)]
net/bnxt: add initial TruFlow core session close

- Add TruFlow session and resource support functions
- Add Truflow session close API and related message support functions
  for both session and hw resources

Signed-off-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add initial TruFlow core session open
Michael Wildt [Wed, 15 Apr 2020 08:18:41 +0000 (13:48 +0530)]
net/bnxt: add initial TruFlow core session open

- Add infrastructure support
- Add tf_core open session support

Signed-off-by: Michael Wildt <michael.wildt@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add TruFlow message handlers
Pete Spreadborough [Wed, 15 Apr 2020 08:18:40 +0000 (13:48 +0530)]
net/bnxt: add TruFlow message handlers

- Add bnxt message functions for truflow APIs

Signed-off-by: Pete Spreadborough <peter.spreadborough@broadcom.com>
Signed-off-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: update HWRM prep to use pointer
Randy Schacher [Wed, 15 Apr 2020 08:18:39 +0000 (13:48 +0530)]
net/bnxt: update HWRM prep to use pointer

- Change HWRM_PREP to use pointer and use the full
  HWRM enum

Signed-off-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: update HSI structure
Ajit Khaparde [Wed, 15 Apr 2020 08:18:38 +0000 (13:48 +0530)]
net/bnxt: update HSI structure

- Add most recent bnxt dpdk header.
- HWRM version updated to 1.10.1.30

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Randy Schacher <stuart.schacher@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/tap: fix unexpected link handler
Yunjian Wang [Thu, 16 Apr 2020 13:50:52 +0000 (21:50 +0800)]
net/tap: fix unexpected link handler

The nic's interrupt source has some active handler, which maybe call
tap_dev_intr_handler() to set link handler. We should cancel the link
handler before close fd to prevent executing the link handler. It
triggers segfault.

Call Trace:
   0x00007f15e08dad99 in __rte_panic (Error adding fd %d epoll_ctl, %s\n")
   0x00007f15e08e9b87 in eal_intr_thread_main ()
   0x00007f15e249be15 in start_thread ()
   0x00007f15d5322f9d in clone ()

Fixes: c0bddd3a057f ("net/tap: add link status notification")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/i40e: add ESP patterns
Bernard Iremonger [Wed, 15 Apr 2020 11:14:15 +0000 (12:14 +0100)]
net/i40e: add ESP patterns

Add ESP patterns to i40e_flow_parse_rss_pattern().
Update i40e PMD user guide with download link for esp-ah.pkg file.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agoapp/testpmd: handle RSS offload types ESP and AH
Bernard Iremonger [Wed, 15 Apr 2020 11:14:14 +0000 (12:14 +0100)]
app/testpmd: handle RSS offload types ESP and AH

Parse RSS offload types ESP and AH add printf for rss_hf

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
4 years agoethdev: add RSS offload types for ESP and AH
Bernard Iremonger [Wed, 15 Apr 2020 11:14:13 +0000 (12:14 +0100)]
ethdev: add RSS offload types for ESP and AH

Add ETH_RSS_ESP and ETH_RSS_AH macros

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Beilei Xing <beilei.xing@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/memif: enable promiscuous mode
Jakub Grajciar [Thu, 16 Apr 2020 11:10:17 +0000 (13:10 +0200)]
net/memif: enable promiscuous mode

Enable promisc mode

Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/tap: fix fd leak on creation failure
Yunjian Wang [Thu, 16 Apr 2020 03:04:56 +0000 (11:04 +0800)]
net/tap: fix fd leak on creation failure

When eth_dev_tap_create() is failed, nlsk_fd and ka_fd won't be closed
thus leading fds leak. Zero is a valid fd. Ultimately leads to a valid
fd was closed by mistake.

Fixes: bf7b7f437b49 ("net/tap: create netdevice during probing")
Fixes: cb7e68da630a ("net/tap: fix cleanup on allocation failure")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/tap: fix file close on remove
Yunjian Wang [Thu, 16 Apr 2020 03:04:45 +0000 (11:04 +0800)]
net/tap: fix file close on remove

The internal structure is freed and set to NULL in the
rte_eth_dev_release_port() and zero is a valid fd. Ultimately
leads to a valid fd was closed by mistake.

Fixes: 3101191c63ab ("net/tap: fix device removal when no queue exist")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/tap: fix check for mbuf number of segment
Yunjian Wang [Thu, 16 Apr 2020 03:04:35 +0000 (11:04 +0800)]
net/tap: fix check for mbuf number of segment

Now the rxq->pool is mbuf concatenation, but its nb_segs is 1. When
conducting some sanity checks on the mbuf with debug enabled, it fails.

Fixes: 0781f5762cfe ("net/tap: support segmented mbufs")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/tap: fix mbuf and mem leak during queue release
Yunjian Wang [Thu, 16 Apr 2020 03:04:25 +0000 (11:04 +0800)]
net/tap: fix mbuf and mem leak during queue release

For the tap PMD, we should release mbufs and iovecs from the Rx queue
when closing device. In order to remove duplicated code,
rte_pmd_tap_remove() calls tap_dev_close().

Fixes: 0781f5762cfe ("net/tap: support segmented mbufs")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/tap: fix mbuf double free when writev fails
Yunjian Wang [Thu, 16 Apr 2020 03:04:07 +0000 (11:04 +0800)]
net/tap: fix mbuf double free when writev fails

When the tap_write_mbufs() function return with break, mbuf was freed
without increasing num_packets, which could cause applications to free
the mbuf again. And the pmd_tx_burst() function should returns the
number of original packets it actually sent excluding tso mbufs.

Fixes: 9396ad334672 ("net/tap: fix reported number of Tx packets")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/mlx5: fix validation of push VLAN without full mask
Xiaoyu Min [Mon, 13 Apr 2020 03:32:56 +0000 (06:32 +0300)]
net/mlx5: fix validation of push VLAN without full mask

Due the limitation of HW, when PMD create push VLAN action it needs to
know what exactly the value of VID/PCP.

PMD try to figure out them via:
  - of_set_vlan_vid/pcp actions
  - VLAN item in pattern
If none of above is provided, default value - zero is used.

However user will write rule like [1] which match on a range of VID and
without of_set_vlan_vid action and expect the VID will inherit from
original packet. This is not supported by HW currently. PMD will set VID
to default value - zero because it cannot figure out the exact value of
VID from VLAN item.

This is sort of misleading for some users.

In order to avoid this, PMD will spit out error for rule like [1] to
force user to provide explicit VID/PCP for new pushed VLAN headers.

[1]: testpmd> flow create 2 ingress transfer group 0 priority 3 pattern
               eth / vlan vid spec 2859 vid prefix 4 / ipv4 / end
       actcions  of_push_vlan ethertype 0x88A8 /
       of_set_vlan_pcp vlan_pcp 6 / port_id id 0 / end

Fixes: 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Reviewed-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix push VLAN action to use item info
Xiaoyu Min [Mon, 13 Apr 2020 03:29:03 +0000 (06:29 +0300)]
net/mlx5: fix push VLAN action to use item info

Currently when PMD create push VLAN action it need to provide VID to HW
and PMD get VID value from item VLAN in pattern if there is no
of_set_vlan_vid action following.

When user create rule like [1], which has of_set_vlan_vid action
before of_push_vlan, the intention is to modify VID on existing VLAN
header and push a new VLAN header with VID _inherit_ from the previous
of_set_vlan_vid.

Currently the above is not covered by PMD, PMD always fetch the VLAN
information from item for of_push_vlan action.

Fix it by only fetch VLAN information from item when there is no
previous of_set_vlan_vid action.

[1]: testpmd> flow create 2 ingress transfer group 1 priority 3 pattern
                eth / vlan vid is 2731 / ipv4 / end actions
of_set_vlan_vid vlan_vid 3209 / of_push_vlan ethertype
0x88A8 / port_id id 1 / end

Fixes: b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Reviewed-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/enic: allow multiple mark and flag actions
John Daley [Wed, 15 Apr 2020 01:06:41 +0000 (18:06 -0700)]
net/enic: allow multiple mark and flag actions

1400 series adapters support multiple MARK and FLAG action types.
  e.g.: mark id 10 / queue index 2 / mark id 11 / queue index 3

Remove the restriction in the Flow Manager implementation.

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
4 years agonet/enic: support flow API RSS ranges on outer headers
John Daley [Wed, 15 Apr 2020 01:06:40 +0000 (18:06 -0700)]
net/enic: support flow API RSS ranges on outer headers

Support rte_flow RSS action on outer headers (level 0). RSS ranges on
the non-default port is OK.
Restrictions:
 - The RETA is ignored. The hash function is simply applied across
   the RSS queue range.
 - The queues used in the RSS group must be sequential.
 - There is a performance hit if the number of queues is not a power
   of 2.

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
4 years agonet/enic: change Rx queue ordering to enable RSS action
John Daley [Wed, 15 Apr 2020 01:06:39 +0000 (18:06 -0700)]
net/enic: change Rx queue ordering to enable RSS action

Each RTE RQ is represented on enic as a Start Of Packet (SOP) queue
and overflow queue (DATA). There were arranged SOP0/DATA0, SOP1/DATA1,..
But need to be arranged SOP0, SOP1,..., DATA0, DATA1... so that
rte_flow RSS queue ranges work.

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
4 years agonet/enic: update flow manager API
John Daley [Wed, 15 Apr 2020 01:06:38 +0000 (18:06 -0700)]
net/enic: update flow manager API

Update the VIC Flow Manager API. The extensions will allow support for:
  - Decap and strip VLAN
  - Remove outer VLAN
  - Set Egress port
  - Set VLAN when replicating encapped packets
  - RSS queue ranges on outer header

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
4 years agonet/enic: fix flow action reordering
Hyong Youb Kim [Wed, 15 Apr 2020 01:06:37 +0000 (18:06 -0700)]
net/enic: fix flow action reordering

The current implementation produces wrong ordering for several cases
like these:

1. mark, decap, steer
Current: steer, mark, decap
Correct: mark, steer, decap

2. decap, steer, steer
Current: steer, steer, decap
Correct: steer, decap, steer

Simplify the logic and swap 1st steer and decap.
Also, allow just one decap action per flow.

Fixes: ea7768b5bba8 ("net/enic: add flow implementation based on Flow Manager API")
Cc: stable@dpdk.org
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
4 years agocommon/mlx5: refactor memory management
Vu Pham [Mon, 13 Apr 2020 21:17:48 +0000 (14:17 -0700)]
common/mlx5: refactor memory management

Refactor common memory btree and cache management to common driver.
Replace some input parameters of MR APIs to more common data structure
like PD, port_id, share_cache,... so that multiple PMD drivers can
use those MR APIs.

Modify mlx5 net pmd driver to use MR management APIs from common driver.

Signed-off-by: Vu Pham <vuhuong@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: refactor IPC handling from net driver
Vu Pham [Mon, 13 Apr 2020 21:17:47 +0000 (14:17 -0700)]
common/mlx5: refactor IPC handling from net driver

Refactor common multi-process handling codes from net PMD to common
driver. Using tuple mp_id{name, port_id} as standard input parameter
for all multi-process IPC APIs instead of using rte_eth_dev.

Modify net PMD to use multi-process APIs from common driver.

Signed-off-by: Vu Pham <vuhuong@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix jump table leak
Suanming Mou [Mon, 13 Apr 2020 13:29:13 +0000 (21:29 +0800)]
net/mlx5: fix jump table leak

Currently, when translate jump action, the table reference will be
increased all the time. But when release the jump action, the table
resource reference will only be decreased when jump action is released.
It means for jump action which was referenced more than one time, the
increased table reference only decrease one time when jump action is
released.

Add table release when the jump action was not new created.

Fixes: 684b9a1b1f5c ("net/mlx5: support jump action")
Cc: stable@dpdk.org
Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix meter suffix table leak
Suanming Mou [Mon, 13 Apr 2020 13:29:12 +0000 (21:29 +0800)]
net/mlx5: fix meter suffix table leak

Currently, the meter suffix table is created and saved in the mlx5
shared struct. It causes the suffix table will never be released
even without any meter rules.

Move the suffix table to meter domain struct to help the suffix table
be released when all the meter rules are destroyed.

Fixes: 46a5e6bc6a85 ("net/mlx5: prepare meter flow tables")
Cc: stable@dpdk.org
Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: add multi-segment packets in MPRQ mode
Alexander Kozyrev [Thu, 9 Apr 2020 22:23:53 +0000 (22:23 +0000)]
net/mlx5: add multi-segment packets in MPRQ mode

The multi-stride operations now allow to reduce a stride size
while supporting Jumbo frames. That means that it is possible
to have mbufs configured with a size smaller than the whole
packet received. It is not an issue during normal MPRQ operations
since we attach external buffers instead of copying the data
into the mbuf itself. But it is not the case in "emergency mode"
when we have to copy every packet because of no more external
mbufs are available. Assemble a multi-segment packet to overcome
this issue in case scatter mode is enabled, drop a packet if not.

Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: enable MPRQ multi-stride operations
Alexander Kozyrev [Thu, 9 Apr 2020 22:23:52 +0000 (22:23 +0000)]
net/mlx5: enable MPRQ multi-stride operations

MPRQ feature should be updated to allow a packet to be received
into multiple strides in order to support the MTU exceeding 8KB.
Special care is needed to prevent the headroom corruption in the
multi-stride mode since the headroom space is borrowed by the PMD
from the tail of the preceding stride. Copy the whole packet into
a separate mbuf in this case or just the overlapping data if the
Rx scattering is supported by an application.

Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add device parameter for MPRQ stride size
Alexander Kozyrev [Thu, 9 Apr 2020 22:23:51 +0000 (22:23 +0000)]
net/mlx5: add device parameter for MPRQ stride size

Define a device parameter to configure log 2 of a stride size for MPRQ
- mprq_log_stride_size. User is able to specify a stride size in a range
allowed by an underlying hardware. The default stride size is defined as
2048 bytes to encompass most commonly used packet sizes in the Internet
(MTU 1518 and less) and will be used in case a maximum configured packet
size cannot fit into the largest possible stride size. Otherwise a
stride size is set to a large enough value to encompass a whole packet.

Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/i40e: support hash configuration in RSS flow
Chenxu Di [Wed, 15 Apr 2020 08:46:09 +0000 (08:46 +0000)]
net/i40e: support hash configuration in RSS flow

This patch supports:

- Symmetric hash configuration
- Hash input set configuration

Signed-off-by: Chenxu Di <chenxux.di@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/ice/base: force switch to use different recipe
Wei Zhao [Fri, 10 Apr 2020 00:41:57 +0000 (08:41 +0800)]
net/ice/base: force switch to use different recipe

When we use profile rule as switch rule to download, if
we download 2 different rules one by one, there will be
rejection from function ice_aq_sw_rules(), for example:

"flow create 0 priority 0 ingress pattern eth / ipv6 / ah
/ end actions queue index 3 / end"
"flow create 0 priority 0 ingress pattern eth / ipv6 / esp
/ end actions queue index 2 / end"

That is because the 2 rules has the same s_rule input set
except action queue index, so it will be rejected by
hardware. So we have to use different recipes for them.

Also, we need to add recipe_id to keep record of recipe
index, which will be used in rule remove, if not, there
will be error when search recipe in function
ice_rem_adv_rule() if we create 2 or more profile rule.
For example:

"flow create 0 priority 0 ingress pattern eth / ipv4 / udp
/ pfcp s_field is 1 / end actions queue index 4 / end"
"flow create 0 priority 0 ingress pattern eth / ipv4 / udp
/ pfcp s_field is 0 / end actions queue index 5 / end"

then,

"flow flush 0"

you will find only the first rule will be delete,
because ice_find_recp() will always return recipe
id of the first rule.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Tested-by: Yuan Peng <yuan.peng@intel.com>
4 years agonet/ice/base: add mask check to find switch recipe
Wei Zhao [Fri, 10 Apr 2020 00:41:56 +0000 (08:41 +0800)]
net/ice/base: add mask check to find switch recipe

In order to find accurate recipe for switch filter, we
need to add mask as an element when searching for recipe.
If we create different rules with the same input set, but
using different masks, then proper recipes should use
those different mask.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Tested-by: Nannan Lu <nannan.lu@intel.com>
4 years agonet/ice/base: check number of chained recipes
Wei Zhao [Fri, 10 Apr 2020 00:41:55 +0000 (08:41 +0800)]
net/ice/base: check number of chained recipes

When we add some long switch rule, we need check the
number of final recipe number, if it is large than
ICE_MAX_CHAIN_RECIPE, we should refuse this rule.
For example:

"flow create 0 ingress pattern eth / ipv6
src is CDCD:910A:2222:5498:8475:1111:3900:1536
dst is CDCD:910A:2222:5498:8475:1111:3900:2022
tc is 3 / udp dst is 45 / end actions queue index 2 / end"

This rule will consume 6 recipe, if it is not refused, it
will cause the following code over write of lkup_indx and mask.

LIST_FOR_EACH_ENTRY(entry, &rm->rg_list, ice_recp_grp_entry,
l_entry) {
last_chain_entry->fv_idx[i] = entry->chain_idx;
buf[recps].content.lkup_indx[i] = entry->chain_idx;
buf[recps].content.mask[i++] = CPU_TO_LE16(0xFFFF);
..........
}

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Tested-by: Nannan Lu <nannan.lu@intel.com>
4 years agonet/i40e: restrict pointer aliasing for NEON
Gavin Hu [Mon, 13 Apr 2020 16:40:25 +0000 (00:40 +0800)]
net/i40e: restrict pointer aliasing for NEON

Restrict pointer aliasing to optimize the code generated.

The patch showed ~3% performance uplift on Arm N1SDP platform, and no
degradation on ThunderX2. The tet case is RFC2544 zero-loss L2
forwarding running testpmd.

[1] https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Restricted-Pointers.html

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
4 years agonet/i40e: relax barrier in Tx for NEON
Gavin Hu [Mon, 13 Apr 2020 16:40:24 +0000 (00:40 +0800)]
net/i40e: relax barrier in Tx for NEON

To keep ordering of mixed accesses, 'DMB OSH' is sufficient.
'DSB' inside the I40E_PCI_REG_WRITE is overkill.[1]

This patch fixes by replacing with just sufficient barriers in the
normal PMD and vPMD.

It showed 7% performance uplift on ThunderX2 and 4% on Arm N1SDP.
The test case is the RFC2544 zero-loss test running testpmd.

[1] http://inbox.dpdk.org/dev/CALBAE1M-ezVWCjqCZDBw+MMDEC4O9
qf0Kpn89EMdGDajepKoZQ@mail.gmail.com

Fixes: ae0eb310f253 ("net/i40e: implement vector PMD for ARM")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/igc: support flow API
Alvin Zhang [Wed, 15 Apr 2020 08:48:10 +0000 (16:48 +0800)]
net/igc: support flow API

Below type of flows are supported:
ether-type filter, 2-tuple filter, SYN filter, RSS.
Update docs too.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: support MAC loopback mode
Alvin Zhang [Wed, 15 Apr 2020 08:48:09 +0000 (16:48 +0800)]
net/igc: support MAC loopback mode

Enable mac-loopback mode.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: support VLAN
Alvin Zhang [Wed, 15 Apr 2020 08:48:08 +0000 (16:48 +0800)]
net/igc: support VLAN

Below ops ware added:
vlan_filter_set
vlan_offload_set
vlan_tpid_set
vlan_strip_queue_set

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: support RSS
Alvin Zhang [Wed, 15 Apr 2020 08:48:07 +0000 (16:48 +0800)]
net/igc: support RSS

Below ops are added:
reta_update
reta_query
rss_hash_update
rss_hash_conf_get

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: support flow control
Alvin Zhang [Wed, 15 Apr 2020 08:48:06 +0000 (16:48 +0800)]
net/igc: support flow control

Update feature list too.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: enable Rx queue interrupts
Alvin Zhang [Wed, 15 Apr 2020 08:48:05 +0000 (16:48 +0800)]
net/igc: enable Rx queue interrupts

Setup NIC to generate MSI-X interrupts.
Set the IVAR register to map interrupt causes to vectors.
Implement interrupt enable/disable functions.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: enable statistics
Alvin Zhang [Wed, 15 Apr 2020 08:48:04 +0000 (16:48 +0800)]
net/igc: enable statistics

Enable base statistics, extend statistics and per-queue statistics.

Below ops are added:
stats_get
xstats_get
xstats_get_by_id
xstats_get_names_by_id
xstats_get_names
stats_reset
xstats_reset
queue_stats_mapping_set

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: support Rx and Tx
Alvin Zhang [Wed, 15 Apr 2020 08:48:03 +0000 (16:48 +0800)]
net/igc: support Rx and Tx

Below ops are added too:
mac_addr_add
mac_addr_remove
mac_addr_set
set_mc_addr_list
mtu_set
promiscuous_enable
promiscuous_disable
allmulticast_enable
allmulticast_disable
rx_queue_setup
rx_queue_release
rx_queue_count
rx_descriptor_done
rx_descriptor_status
tx_descriptor_status
tx_queue_setup
tx_queue_release
tx_done_cleanup
rxq_info_get
txq_info_get
dev_supported_ptypes_get

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: implement device base operations
Alvin Zhang [Wed, 15 Apr 2020 08:48:02 +0000 (16:48 +0800)]
net/igc: implement device base operations

Bellow ops are implemented:
dev_configure
dev_start
dev_stop
dev_close
dev_reset
dev_set_link_up
dev_set_link_down
link_update
fw_version_get
dev_led_on
dev_led_off

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: support device initialization
Alvin Zhang [Wed, 15 Apr 2020 08:48:01 +0000 (16:48 +0800)]
net/igc: support device initialization

Update base codes, add readme.
Add OS specific functions and definitions.
Add device initialization codes.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/igc: add skeleton
Alvin Zhang [Wed, 15 Apr 2020 08:48:00 +0000 (16:48 +0800)]
net/igc: add skeleton

Implement device detection and loading.
Add igc driver guide docs.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/octeontx2: disable unnecessary error interrupts
Nithin Dabilpuram [Mon, 13 Apr 2020 13:45:40 +0000 (19:15 +0530)]
net/octeontx2: disable unnecessary error interrupts

Disable CQ_DISABLED error interrupt in NIX_LF_ERR_INT
to fix spurious interrupts in event dev mode. Also skip
configuring RSS when RQ count is '0' because
RSS table initialization is done incorrectly due to
divide-by-zero error and it is leading to RQ_OOR error
in NIX_LF_ERR_INT.

Fixes: 83ce2880e22e ("net/octeontx2: support RSS")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/bnx2x: handle guest VLAN for SR-IOV
Souvik Dey [Mon, 13 Apr 2020 23:09:30 +0000 (16:09 -0700)]
net/bnx2x: handle guest VLAN for SR-IOV

In case of bnx2xvf pmd, tx packets can support vland id in 2 ways:
1. Setting the mbuf ol_flags=PKT_TX_VLAN_PKT and passing the
vlanid in mbuf->vlan_tci.
2. The tx packet itself has the vlan id included in the packet.
The first case is working as expected but the second case where
the vlan id is included in thetx packets itself was found not
working as expected. To handle that we need to properly set the
start_bd bitfield and the vlan_or_ethertype instead of setting it
to just the ethertype in case of VF.

Signed-off-by: Souvik Dey <sodey@rbbn.com>
Acked-by: Rasesh Mody <rmody@marvell.com>
4 years agonet/bnx2x: add multicast MAC address filtering
Souvik Dey [Mon, 13 Apr 2020 23:09:02 +0000 (16:09 -0700)]
net/bnx2x: add multicast MAC address filtering

Add support the set_mc_addr_list device operation in the bnx2xvf PMD.

The configured addresses are stored in the device private area, so
they can be flushed before adding new ones.
Without this v6 multicast packets were properly forwarded to the
Guest VF.

Signed-off-by: Souvik Dey <sodey@rbbn.com>
Acked-by: Rasesh Mody <rmody@marvell.com>
4 years agonet/mlx5: use open/read/close for ib stats query
Mohsin Shaikh [Thu, 9 Apr 2020 20:37:06 +0000 (04:37 +0800)]
net/mlx5: use open/read/close for ib stats query

fgets(3)/fread(3)/fscanf(3) etc. use mmap(2)/munmap(2) which leads
to TLB shutdown interrupts to all DPDK app cores including RX cores.
This can cause packet drops. Use read(2)/write(2) instead.

Bugzilla ID: 440
Cc: stable@dpdk.org
Signed-off-by: Mohsin Shaikh <mohsinshaikh@niometrics.com>
Reviewed-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix index when creating flow
Bing Zhao [Thu, 9 Apr 2020 14:38:41 +0000 (22:38 +0800)]
net/mlx5: fix index when creating flow

When creating a flow, usually the creating routine is called in
serial. No parallel execution is supported right now. The same
function will be called only once for a single flow creation.

But there is a special case that the creating routine will be called
nested. If the xmeta feature is enabled and there is FLAG / MARK in
the actions list, some metadata reg copy flow needs to be created
before the original flow is applied to the hardware.
In the flow non-cached mode, resources only for flow creation will
not be saved anymore. The memory space is pre-allocated and reused
for each flow. A global index for each device is used to indicate
the memory address of the resources. If the function is called in a
nested mode, then the index will be reset and make everything get
corrupted.

To solve this, a nested index is introduced to save the position for
the original flow creation. Currently, only one level nested call
of the flow creating routine is supported.

Fixes: e7bfa3596a0a ("net/mlx5: separate the flow handle resource")

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx4: fix build with -fno-common
Thomas Monjalon [Wed, 8 Apr 2020 00:09:00 +0000 (02:09 +0200)]
net/mlx4: fix build with -fno-common

The variable storages of the same name are merged together
if compiled with -fcommon. This is the default.
This default behaviour allows to declare a variable in a header file and
share the variable in every .o binaries thanks to merge at link-time.

In the case of dlopen linking of the glue library, the pointer mlx4_glue
is referencing the glue functions struct and is set after calling
dlopen.

If compiling with -fno-common (default in GCC 10), the variables must be
declared as extern to avoid multiple re-definitions.
In case the glue layer is split in glue library, the variable mlx4_glue
needs to have its own storage for the rest of the PMD.

Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agocommon/mlx5: fix build with -fno-common
Thomas Monjalon [Wed, 8 Apr 2020 00:08:59 +0000 (02:08 +0200)]
common/mlx5: fix build with -fno-common

The variable storages of the same name are merged together
if compiled with -fcommon. This is the default.
This default behaviour allows to declare a variable in a header file and
share the variable in every .o binaries thanks to merge at link-time.

In the case of dlopen linking of the glue library, the pointer mlx5_glue
is referencing the glue functions struct and is set after calling
dlopen.

If compiling with -fno-common (default in GCC 10), the variable must be
declared as extern to avoid multiple re-definitions.
In case the glue layer is split in glue library, the variable mlx5_glue
needs to have its own storage for the rest of the PMD.

Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agocommon/mlx5: split glue initialization
Thomas Monjalon [Wed, 8 Apr 2020 00:08:58 +0000 (02:08 +0200)]
common/mlx5: split glue initialization

The function mlx5_glue_init was doing three things:
- initialize logs
- load glue library if in dlopen mode
- initialize glue layer
They are split in three functions for clarity.

The config option RTE_IBVERBS_LINK_DLOPEN is not used anymore
outside of make and meson files. It is replaced with MLX5_GLUE,
which is defined in the same condition and is already used with dlopen.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agocommon/iavf: update version
Qi Zhang [Sun, 12 Apr 2020 12:50:29 +0000 (20:50 +0800)]
common/iavf: update version

Update base code release version in readme

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agocommon/iavf: support flow director in virtual channel
Qi Zhang [Mon, 13 Apr 2020 09:32:56 +0000 (17:32 +0800)]
common/iavf: support flow director in virtual channel

Adds new ops and structures to support VF to add/delete/validate/
query flow director.

ADD and VALIDATE FDIR share one ops: VIRTCHNL_OP_ADD_FDIR_FILTER.
VF sends this request to PF by filling out the related field in
virtchnl_fdir_add. If the rule is created successfully, PF
will return flow id and program status to VF. If the rule is
validated successfully, the PF will only return program status
to VF.

DELETE FDIR uses ops: VIRTCHNL_OP_DEL_FDIR_FILTER.
VF sends this request to PF by filling out the related field in
virtchnl_fdir_del. If the rule is deleted successfully, PF
will return program status to VF.

Query FDIR uses ops: VIRTCHNL_OP_QUERY_FDIR_FILTER.
VF sends this request to PF by filling out the related field in
virtchnl_fdir_query. If the request is successfully done by PF,
PF will return program status and query info to VF.

Signed-off-by: Simei Su <simei.su@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agocommon/iavf: support advanced RSS input set change
Qi Zhang [Mon, 13 Apr 2020 09:32:55 +0000 (17:32 +0800)]
common/iavf: support advanced RSS input set change

Add new ops and a new VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF flag to support
VF to add or del a specific rss configuration by virtchnl.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agocommon/iavf: add virtual channel protocol header
Qi Zhang [Mon, 13 Apr 2020 09:32:54 +0000 (17:32 +0800)]
common/iavf: add virtual channel protocol header

To support advanced AVF's FDIR and RSS feature, we need to figure out
what kind of data structure should be passed from VF to PF to describe
an FDIR rule or RSS config rule. The common part of the requirement is
we need a data structure to represent the input set selection of a rule's
hash key.

An input set selection is a group of fields be selected from one or more
network protocol layers that could be identified as a specific flow.
For example, select dst IP address from an IPv4 header combined with
dst port from the TCP header as the input set for an IPv4/TCP flow.

The patch adds a new data structure virtchnl_proto_hdrs to abstract
a network protocol headers group which is composed of layers of network
protocol header(virtchnl_proto_hdr).

A protocol header contains a 32 bits mask (field_selector) to describe
which fields are selected as input sets, as well as a header type
(enum virtchnl_proto_hdr_type). Each bit is mapped to a field in
enum virtchnl_proto_hdr_field guided by its header type.

+------------+-----------+------------------------------+
|            | Proto Hdr | Header Type A                |
|            |           +------------------------------+
|            |           | BIT 31 | ... | BIT 1 | BIT 0 |
|            |-----------+------------------------------+
|Proto Hdrs  | Proto Hdr | Header Type B                |
|            |           +------------------------------+
|            |           | BIT 31 | ... | BIT 1 | BIT 0 |
|            |-----------+------------------------------+
|            | Proto Hdr | Header Type C                |
|            |           +------------------------------+
|            |           | BIT 31 | ... | BIT 1 | BIT 0 |
|            |-----------+------------------------------+
|            |    ....                                  |
+-------------------------------------------------------+

All fields in enum virtchnl_proto_hdr_fields are grouped with header type
and the value of the first field of a header type is always 32 aligned.

enum proto_hdr_type {
header_type_A = 0;
header_type_B = 1;
....
}

enum proto_hdr_field {
/* header type A */
header_A_field_0 = 0,
header_A_field_1 = 1,
header_A_field_2 = 2,
header_A_field_3 = 3,

/* header type B */
header_B_field_0 = 32, // = header_type_B << 5
header_B_field_0 = 33,
header_B_field_0 = 34
header_B_field_0 = 35,
....
};

So we have:
proto_hdr_type = proto_hdr_field / 32
bit offset = proto_hdr_field % 32

To simply the protocol header's operations, couple help macros are added.
For example, to select src IP and dst port as input set for an IPv4/UDP
flow.

we have:
struct virtchnl_proto_hdr hdr[2];

VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[0], IPV4)
VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[0], IPV4, SRC)

VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[1], UDP)
VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[1], UDP, DST)

A protocol header also contains a byte array, this field should only
be used by an FDIR rule and should be ignored by RSS. For an FDIR rule,
the byte array is used to store the protocol header of a training
package. The byte array must be network order.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agocommon/iavf: support virtual channel for Flex RXD
Qi Zhang [Mon, 13 Apr 2020 09:32:53 +0000 (17:32 +0800)]
common/iavf: support virtual channel for Flex RXD

Add new VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC flag, opcode
VIRTCHNL_OP_GET_SUPPORTED_RXDIDS and add member rxdid
in struct virtchnl_rxq_info to support AVF Flex RXD
extension.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agocommon/iavf: add DDP package query in virtual channel
Qi Zhang [Mon, 13 Apr 2020 09:32:52 +0000 (17:32 +0800)]
common/iavf: add DDP package query in virtual channel

Add VIRTCHNL_OP_DCF_GET_PKG_INFO to query DDP package identification.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agocommon/iavf: add packet type aborted code
Qi Zhang [Mon, 13 Apr 2020 09:32:51 +0000 (17:32 +0800)]
common/iavf: add packet type aborted code

Add IAVF_RX_PTYPE_PARSER_ABORTED definition, so iavf driver will know
opcode for parser aborted packets.
Without this definition driver would have to rely on magic numbers.

Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/ice/base: update version
Qi Zhang [Sun, 12 Apr 2020 12:47:57 +0000 (20:47 +0800)]
net/ice/base: update version

Update base code version in readme.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/hns3: fix VLAN filter when setting promisucous mode
Chengchang Tang [Fri, 10 Apr 2020 11:09:30 +0000 (19:09 +0800)]
net/hns3: fix VLAN filter when setting promisucous mode

Currently, when upper level application call the API function named
rte_eth_dev_set_vlan_offload to configure the hardware vlan filter
offload and call the rte_eth_promiscuous_enable API to enable
promiscuous mode based on hns3 PF device, driver can't receive the
packets with a vlan tag which has not been added by calling the API
function named rte_eth_dev_vlan_filter.

This patch fixes it by disabling the vlan filter when setting the
promiscuous mode and enabling the vlan filter again after the
promiscuous mode are disabled.

Fixes: 19a3ca4c99cf ("net/hns3: add start/stop and configure operations")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix default VLAN filter configuration for PF
Chengchang Tang [Fri, 10 Apr 2020 11:09:29 +0000 (19:09 +0800)]
net/hns3: fix default VLAN filter configuration for PF

Currently, By default VLAN filter is enabled during initialization and
couldn't be turned off based on hns3 PF device. If upper applications
don't call rte_eth_dev_vlan_filter API function to set vlan based on
hns3 PF device, hns3 PF PMD driver will can't receive the packets with
vlan tag.  It will leads to some compatibility issues, the behaviors of
using hns3 network engine and other NICs are different.

This patch disables the VLAN filter during initialization and allows the
upper level applications to enable or disable the VLAN filter.

Fixes: 411d23b9eafb ("net/hns3: support VLAN")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix RSS key length
Lijun Ou [Fri, 10 Apr 2020 11:09:28 +0000 (19:09 +0800)]
net/hns3: fix RSS key length

When upper application calls the rte_eth_dev_rss_hash_conf_get API
function to get the RSS key parameters, the function should return the
RSS key length supported by the device. Otherwise, an error will occur
when the upper application needs to use the RSS key length supported
by this specified hardware for judgment and configure the specified
key into hardware.

For example, in the following scenario:
When users want to use their own RSS key, but the length of the key is
bigger than the one of the supported by hardware.

As a result, users need to get the RSS key length supported by hardware
according to the above API firstly, and then compare the actual obtained
RSS key length with the length of their own RSS key.

If the driver does not return the actual value, error may occur when
user calls the rte_eth_dev_rss_hash_update API function to configure
their own key into hardware.

Besides, this patch fixes the problem of stepping on memory when the RSS
key array configured by users are less than the RSS key length supported
by the driver at the same time.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
4 years agonet/hns3: add RSS hash offload to capabilities
Lijun Ou [Fri, 10 Apr 2020 11:09:27 +0000 (19:09 +0800)]
net/hns3: add RSS hash offload to capabilities

Currently, when upper application calls rte_eth_dev_info_get API
function to query the Rx offload capability based on hns3 network
engine, RSS hash offload capacity is missing.

This patch fixes it by adding the related capacity in the
'.dev_infos_get' ops implementation function named hns3_dev_infos_get
and hns3vf_dev_infos_get for hns3 PF/VF PMD driver.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: clear residual flow rules on init
Chengwen Feng [Fri, 10 Apr 2020 11:09:26 +0000 (19:09 +0800)]
net/hns3: clear residual flow rules on init

This patch fixes that the flow director rules are not cleared during
initialization, which lead to remaining flow director rules after upper
application (such as testpmd) restarted.

Fixes: fcba820d9b9e ("net/hns3: support flow director")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix Rx interrupt after reset
Chengwen Feng [Fri, 10 Apr 2020 11:09:25 +0000 (19:09 +0800)]
net/hns3: fix Rx interrupt after reset

Currently, Rx interrupt cannot work normally after reset (such as FLR,
global reset and IMP reset), when running l3fwd-power application based
on hns3 network engine.

The root cause is that the hardware configuration about Rx interrupt
does not recover after reset.

This patch fixes it with the following modification.
1. The internal static function named hns3(vf)_init_ring_with_vector is
   moved from hns3_init_pf to hns3(vf)_init_hardware because
   hns3(vf)_init_hardware is called both in the initialization and the
   RESET_STAGE_DEV_INIT stage of the reset process.
2. The internal static function named hns3(vf)_restore_rx_interrupt is
   added in hns3(vf)_restore_conf, it is used to recover hardware
   configuration about interrupt vectors of rx queues in the
   RESET_STAGE_DEV_INIT stage of the reset process.
3. The internal static function named hns3_dev_all_rx_queue_intr_enable
   and hns3_enable_all_queues are added in hns3(vf)_dev_start(which
   called in the initialization, so after calling the rte_eth_dev_start
   API successfully, the driver is ready to work.
4. The function named hns3_dev_all_rx_queue_intr_enable and
   hns3_enable_all_queues are also added in hns3(vf)_start_service(which
   called in the RESET_STAGE_DEV_INIT stage of the reset process), so
   after start_service, the driver is ready to work.

Note:
1. Because FLR will clear queue's interrupt enable bit hardware
   configuration, so we add calling hns3_dev_all_rx_queue_intr_enable to
   enable interrupt before enabling queues.
2. After finished the initialization, we can enable queues to work by
   calling the internal function named hns3_enable_all_queues.

Fixes: 02a7b55657b2 ("net/hns3: support Rx interrupt")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
4 years agonet/hns3: fix adding multicast MAC address
Chengchang Tang [Fri, 10 Apr 2020 11:09:24 +0000 (19:09 +0800)]
net/hns3: fix adding multicast MAC address

Currently, when upper application calls the rte_eth_dev_mac_addr_add API
function to add a MC mac address based on hns3 PF/VF device, it will
fail.

In hns3 network engine adding UC and MC mac address with different
commands with firmware. We need to determine whether the input address
is a UC or a MC address to call different commands in the
'.mac_addr_add' and '.mac_addr_remove' ops implementation functions in
hns3 PF and VF driver as below:
  hns3_add_mac_addr
  hns3vf_add_uc_mac_addr
  hns3_remove_mac_addr
  hns3vf_remove_mac_addr

By the way, it is recommended calling the rte_eth_dev_set_mc_addr_list API
function to set the MC mac address, because using the
rte_eth_dev_mac_addr_add API function to set MC mac address may affect the
specifications of UC mac addresses.

Fixes: 7d7f9f80bbfb ("net/hns3: support MAC address related operations")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
4 years agonet/hns3: replace interrupt vector zero with common macro
Wei Hu (Xavier) [Fri, 10 Apr 2020 11:09:23 +0000 (19:09 +0800)]
net/hns3: replace interrupt vector zero with common macro

This patch replaces the specific macro named RTE_INTR_VEC_ZERO_OFFSET
provided by DPDK framework instead of the magic number 0.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: simplify process of some return values
Lijun Ou [Fri, 10 Apr 2020 11:09:22 +0000 (19:09 +0800)]
net/hns3: simplify process of some return values

Currently, the return value processing of some functions can be combined
and the result is that some codes can be optimized.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agovhost: prefix vDPA enum value for PCI address type
Maxime Coquelin [Thu, 26 Mar 2020 14:14:22 +0000 (15:14 +0100)]
vhost: prefix vDPA enum value for PCI address type

In order to avoid potential conflicts, rename the PCI_ADDR
enum value to VDPA_ADDR_PCI in vdpa_addr_type_enum.

All symbols referencing this enum are experimental, so it
does not break API policy.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agovhost: make IOTLB cache name unique among processes
Itsuro Oda [Wed, 11 Mar 2020 23:19:18 +0000 (08:19 +0900)]
vhost: make IOTLB cache name unique among processes

Currently, iotlb cache name is comprised of vid and virtqueue
index. For example, "iotlb_cache_0_0". Because vid is assigned
per process, iotlb cache name is not unique among multi processes.
For example a secondary process uses a vhost
(ex. eth_vhost0,iface=/tmp/sock0) and another secondary process
uses a vhost (ex. eth_vhost1,iface=/tmp/sock1), iotlb cache
name of both vhost ("iotlb_cache_0_0") are same and as a result
iotlb cache is broken.

This patch makes iotlb cache name unique among milti processes
by adding process id to the iotlb cache name.

The prefix of the name is shortened to "iotlb_" since the maximum
length of pool name is 25 bytes (RTE_MEMPOOL_NAMESIZE is 26).
Note that it is just 25 characters in maximum at the moment.
Here,
* pid_t == int: max 10 digits.
* vid < MAX_VHOST_DECICE(1024): max 4 digits.
* vq_index < VHOST_MAX_VRING(256): max 3 digits.

Fixes: d012d1f293f4 ("vhost: add IOTLB helper functions")
Cc: stable@dpdk.org
Signed-off-by: Itsuro Oda <oda@valinux.co.jp>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: remove unused variable
Xiaolong Ye [Sat, 7 Mar 2020 13:22:35 +0000 (21:22 +0800)]
vhost: remove unused variable

VHOST_FEATURES has been removed in previous refactoring.

Fixes: 0917f9d1f059 ("vhost: use new APIs to handle features")
Cc: stable@dpdk.org
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: fix outdated comment
Xiaolong Ye [Sat, 7 Mar 2020 13:22:34 +0000 (21:22 +0800)]
net/virtio: fix outdated comment

Fix comment that is no more correct as the code evolved.

Fixes: 9470427c88e1 ("net/virtio: do not store PCI device pointer at shared memory")
Cc: stable@dpdk.org
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/vhost: fix potential memory leak on close
Itsuro Oda [Thu, 5 Mar 2020 02:54:50 +0000 (11:54 +0900)]
net/vhost: fix potential memory leak on close

If a vhost device is closed before eth_dev_configure is done
to the device, internal resources allocated to the device
would not be freed. This patch fixes it.

Fixes: 3d01b759d267 ("net/vhost: delay driver setup")
Cc: stable@dpdk.org
Signed-off-by: Itsuro Oda <oda@valinux.co.jp>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/vhost: enable promiscuous and multicast by default
Xiaolong Ye [Wed, 26 Feb 2020 13:45:34 +0000 (21:45 +0800)]
net/vhost: enable promiscuous and multicast by default

With this patch, the promiscuous and multicast fields are initialized as
enabled for vhost PMD by default, this allows the devices to be used
when running applications that attempt to enable promiscuous or
multicast mode.
Similar things have done for other virtual PMDs by commit f165210321c4
("drivers/net: enable promiscuous and multicast by default")

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/vhost: add options for linear and external buffer
Sivaprasad Tummala [Wed, 26 Feb 2020 10:00:34 +0000 (10:00 +0000)]
net/vhost: add options for linear and external buffer

Added vHost PMD arguments 'linear-buffer' and 'ext-buffer'
to configure  'RTE_VHOST_USER_LINEARBUF_SUPPORT' and
'RTE_VHOST_USER_EXTBUF_SUPPORT' flags in the vhost library

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: fix packed ring zero-copy
Marvin Liu [Mon, 24 Feb 2020 15:14:19 +0000 (23:14 +0800)]
vhost: fix packed ring zero-copy

Available buffer ID should be stored in the zmbuf in the packed-ring
dequeue path. There's no guarantee that local queue avail index is
equal to buffer ID.

Fixes: d1eafb532268 ("vhost: add packed ring zcopy batch and single dequeue")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reported-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agoexamples/vhost_blk: use common macro for minimum
Thomas Monjalon [Wed, 19 Feb 2020 10:39:22 +0000 (11:39 +0100)]
examples/vhost_blk: use common macro for minimum

The macro RTE_MIN can be used in vhost-blk example.

This change implies fixing the sign of used_len as size_t
as defined in vhost_strcpy_pad().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost/crypto: add missing user protocol flag
Fan Zhang [Wed, 29 Jan 2020 10:19:37 +0000 (10:19 +0000)]
vhost/crypto: add missing user protocol flag

This patch fixes the vhost crypto missed
"VHOST_USER_PROTOCOL_F_CONFIG" flag problem during initialization.
Newer Qemu version requires this feature enabled.

Fixes: 939066d96563 ("vhost/crypto: add public function implementation")
Cc: stable@dpdk.org
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/hinic: adds Tx queue xstats members
Xiaoyun Wang [Fri, 10 Apr 2020 09:21:47 +0000 (17:21 +0800)]
net/hinic: adds Tx queue xstats members

Because some apps may pass illegal parameters, driver increases
checks on illegal parameters and DFX statistics, which includes
sge_len0 and mbuf_null txq xstats member.

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/hinic/base: optimize log style
Xiaoyun Wang [Fri, 10 Apr 2020 09:21:46 +0000 (17:21 +0800)]
net/hinic/base: optimize log style

The patch adds space between descriptors and variables in log files.

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/hinic/base: fix PF firmware hot-active problem
Xiaoyun Wang [Fri, 10 Apr 2020 09:21:45 +0000 (17:21 +0800)]
net/hinic/base: fix PF firmware hot-active problem

When FW is hotactive which means updating the FW but not needs
to reboot OS, FW returns HINIC_DEV_BUSY_ACTIVE_FW for pf driver
because firmware is being reinitialized, at which point the cmdq
initialization that relies on the fw channel will fail, so driver
should reinit the cmdq when port start.

Fixes: 0194313b2df6 ("net/hinic/base: fix port start during FW hot update")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/null: add argument for no Rx
Ferruh Yigit [Mon, 2 Mar 2020 17:36:45 +0000 (17:36 +0000)]
net/null: add argument for no Rx

Add an new device argument 'no-rx', which will prevent PMD receiving
packets.

This is useful for testing when a PMD is needed only to send packets to.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/null: group device arguments
Ferruh Yigit [Mon, 2 Mar 2020 17:36:44 +0000 (17:36 +0000)]
net/null: group device arguments

Group device argument to the struct, to increase code readability.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/null: prefer unsigned int
Ferruh Yigit [Mon, 2 Mar 2020 17:36:43 +0000 (17:36 +0000)]
net/null: prefer unsigned int

Prefer 'unsigned int' storage type keyword against 'unsigned', this also
silence the checkpatch warnings.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/null: remove redundant check
Ferruh Yigit [Mon, 2 Mar 2020 17:36:42 +0000 (17:36 +0000)]
net/null: remove redundant check

There is no need to check if the argument exist or not,
`rte_kvargs_process` returns success if the argument is not provided at
all.

Fixes: c743e50c475f ("null: new poll mode driver")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agodoc: add net null PMD guide
Ferruh Yigit [Mon, 2 Mar 2020 17:36:41 +0000 (17:36 +0000)]
doc: add net null PMD guide

Net null PMD was missing documentation, adding it.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/null: fix secondary burst function selection
Ferruh Yigit [Mon, 2 Mar 2020 17:36:40 +0000 (17:36 +0000)]
net/null: fix secondary burst function selection

Secondary process uses the primary process device and while setting the
Rx/Tx functions it uses the device arguments from the secondary process
instead of the primary ones.

This may cause primary and secondary process use different Rx/Tx
functions unintentionally.

Fixes: bccc77a6a74a ("net/null: fix multi-process Rx and Tx")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/i40e/base: update version
Jiaqi Min [Wed, 8 Apr 2020 10:05:23 +0000 (10:05 +0000)]
net/i40e/base: update version

Update base code release version in readme.

Signed-off-by: Jiaqi Min <jiaqix.min@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/i40e/base: add constants for PTP pins
Jiaqi Min [Wed, 8 Apr 2020 10:05:22 +0000 (10:05 +0000)]
net/i40e/base: add constants for PTP pins

Introduce constants for handling PTP pins used for external
clock source.

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Jiaqi Min <jiaqix.min@intel.com>
Acked-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/i40e/base: introduce device ID for V710-TL 5G
Jiaqi Min [Wed, 8 Apr 2020 10:05:21 +0000 (10:05 +0000)]
net/i40e/base: introduce device ID for V710-TL 5G

This change is adding new device ID and handling it in the same way as
X710-T*L head of family. A new device ID is for new V710-T*L adapter
supporting speeds up to 5G.

Signed-off-by: Zalfresso-Jundzillo <marekx.zalfresso-jundzillo@intel.com>
Signed-off-by: Jiaqi Min <jiaqix.min@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/i40e/base: update X722/X710 FW API version to 1.10
Jiaqi Min [Wed, 8 Apr 2020 10:05:20 +0000 (10:05 +0000)]
net/i40e/base: update X722/X710 FW API version to 1.10

update X722/X710 FW API version to 1.10.

Signed-off-by: Piotr Azarewicz <piotr.azarewicz@intel.com>
Signed-off-by: Jiaqi Min <jiaqix.min@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>