Commit Graph

544 Commits

Author SHA1 Message Date
David Marchand
1f37cb2bb4 bus/pci: make driver-only headers private
The pci bus interface is for drivers only.
Mark as internal and move the header in the driver headers list.

While at it, cleanup the code:
- fix indentation,
- remove unneeded reference to bus specific singleton object,
- remove unneeded list head structure type,
- reorder the definitions and macro manipulating the bus singleton object,
- remove inclusion of rte_bus.h and fix the code that relied on implicit
  inclusion,

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
2022-09-23 16:14:34 +02:00
Dmitry Kozlyuk
72b452c5f2 eal: remove unneeded includes from a public header
Do not include <ctype.h>, <errno.h>, and <stdlib.h> from <rte_common.h>,
because they are not used by this file.
Include the needed headers directly from the files that need them.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2022-09-21 15:31:03 +02:00
David Marchand
72206323a5 version: 22.11-rc0
Start a new release cycle with empty release notes.

The ABI version becomes 23.0.
The map files are updated to the new ABI major number (23).
The ABI exceptions are dropped and CI ABI checks are disabled because
compatibility is not preserved.
Special handling of removed drivers is also dropped in check-abi.sh and
a note has been added in libabigail.abignore as a reminder.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2022-07-21 12:13:48 +02:00
Dongdong Liu
4545a803e2 net/hns3: delete unused code
The RTE_HNS3_ONLY_1630_FPGA macro is not in use, so delete the code.

Fixes: 2192c428f9 ("net/hns3: fix firmware compatibility configuration")
Fixes: bdaf190f82 ("net/hns3: support link speed autoneg for PF")
Cc: stable@dpdk.org

Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2022-06-24 14:28:14 +02:00
Dongdong Liu
b597861353 net/hns3: clean some functions
Delete unnecessary code and adjust code to make code more clean.

Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2022-06-24 14:28:14 +02:00
Chengwen Feng
5125731f56 net/hns3: fix descriptors check with SVE
The SVE algorithm and NEON algorithm have the same requirements for
nb-desc, but the nb-desc is verified only when using NEON.

Fixes: fa29fe45a7 ("net/hns3: support queue start and stop")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2022-06-24 14:27:59 +02:00
Huisong Li
7b29666261 net/hns3: fix statistics locking
The stats_lock is used to protect statistics update in stats APIs and
periodic task, but current code only protect queue related statistics.

Fixes: a65342d9d5 ("net/hns3: fix MAC and queues HW statistics overflow")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2022-06-24 14:27:37 +02:00
Huisong Li
17d0a4b239 net/hns3: fix PTP interrupt logging
PMD driver will receive a PTP interrupt when receive a PTP packet.
But driver doesn't distinguish it. As a result, many unknown events
are printed when many PTP packets are received on the link. The PTP
interrupt is normal, so this patch doesn't log and ignores it.

Fixes: 38b539d96e ("net/hns3: support IEEE 1588 PTP")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2022-06-24 14:27:35 +02:00
Huisong Li
35e8a46f79 net/hns3: cancel heartbeat alarm when VF reset
The purpose of the heartbeat alarm is to keep alive for VF. The mailbox
channel is disabled when VF is reset, and the heartbeat mailbox message
will fail to send. If the reset is not complete, the error information
about the heartbeat sending failure will be printed continuously.
In fact, VF does set alive when VF restore its configuration. So the
heartbeat alarm can be canceled to prepare to start reset and start the
alarm when start service.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2022-06-24 14:27:23 +02:00
Chengwen Feng
916508f002 net/hns3: support backplane media type
The 802.11 physical PMA sub-layer defines three media: copper, fiber and
backplane. For PMD, the backplane is similar to the fiber, the main
differences are that backplane doesn't have optical module.

Because the interface of firmware fiber is also applicable to the
backplane, this patch supports the backplane only through simple
extension.

Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2022-06-24 13:10:01 +02:00
Huisong Li
a8e1bd096f net/hns3: fix link status capability query from VF
Currently, the VF LSC capability is obtained from PF driver in
the interrupt mailbox interrupt thread, it is asynchronous.
The VF driver waits for 500ms to get this capability in probe
process.

The primary process will receive a message and do probe in the
interrupt thread context when attach a device in the secondary
process. At this case, VF driver never obtains this capability
from PF.

The root cause is that 'vf->pf_push_lsc_cap' is not updated by
the handling mailbox thread until finishing probe. The reason
this update wouldn't be done is that the handling mailbox interrupt
thread and the probe alarm thread are both in epool thread, and
the probe alarm thread is before the mailbox interrupt thread.

Fixes: 9bc2289fe5 ("net/hns3: refactor VF LSC event report")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2022-06-24 13:10:01 +02:00
Chengwen Feng
24415ae34a net/hns3: fix TM capability
The TM capability should be bit-19 according to the user manual of
firmware.

Fixes: fc18d1b4b8 ("net/hns3: fix traffic management")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:58:26 +02:00
Huisong Li
8ba42ce98d net/hns3: fix crash from secondary process
If a hns3 device in the secondary process is attached to do probing
operation, 'rx_queues' and 'tx_queues' in dev->data are null in
eth_dev_fp_ops_setup when calling rte_eth_dev_probing_finish. The primary
process calls dev_start to re-setup their fp_ops. But the secondary process
can't call dev_start and has no chance to do it. If the application sends
and receives packets at this time, a segfault will occur. So this patch
uses the MP communication of the PMD to update the fp_ops of the device in
the secondary process.

Fixes: 96c33cfb06 ("net/hns3: fix Rx/Tx functions update")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:58:22 +02:00
Huisong Li
5bddaf383b net/hns3: unify wrapping style
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:58:11 +02:00
Huisong Li
52600004e7 net/hns3: modify a function name
The meaning of the "hns3_get_count" function is not precise enough.
Change from "hns3_get_count" to "hns3_fd_get_count".

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:57:54 +02:00
Huisong Li
66689dc09f net/hns3: fix return value for unsupported tuple
Driver should return false for unsupported tuple.

Fixes: 18a4b4c3fa ("net/hns3: add default to switch when parsing fd tuple")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:57:46 +02:00
Min Hu (Connor)
b902301e8a net/hns3: fix code check warning
In bitwise operation, "val" should be an unsigned type.

Fixes: 38b539d96e ("net/hns3: support IEEE 1588 PTP")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:57:44 +02:00
Huisong Li
d7050da870 net/hns3: remove duplicate definition
The default hash key array is defined twice. Remove the extra one.

Fixes: c37ca66f2b ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:57:32 +02:00
Huisong Li
ea1ef0b937 net/hns3: fix an unreasonable memset
Fixes: bba6366983 ("net/hns3: support Rx/Tx and related operations")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:57:13 +02:00
Huisong Li
67d0103469 net/hns3: adjust data type of some variables
Using the 'int' type and 'uint16_t' type to compare is insecure.
Make them consistent.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:56:57 +02:00
Huisong Li
56f8be3871 net/hns3: remove redundant parentheses
Remove redundant parentheses.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:56:55 +02:00
Huisong Li
ae5f21f287 net/hns3: add check for deferred start queue when rollback
Driver doesn't allocate mbufs for the deferred start queues, so no need to
free it when rollback.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-09 10:56:52 +02:00
Chengwen Feng
e15401f362 net/hns3: fix xstats get return if xstats is null
Many user (e.g. telemetry) invokes rte_eth_xstats_get(port_id, NULL, 0)
to retrieve the required number of elements, but currently hns3 PMD
returns zero when xstats is null.

Dedicated check for xstats vs null is not required, since ethdev layer
guarantees that it may be null only if number of entries n is 0 (which
is definitely smaller than total xstats count).

Fixes: 8839c5e202 ("net/hns3: support device stats")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-05-20 16:45:42 +02:00
Huisong Li
ec16914942 net/hns3: remove unnecessary RSS switch
Whether the RSS is enabled depends on RTE_ETH_MQ_RX_RSS_FLAG and packet
tuple are enabled. So the RSS switch is unnecessary.

Fixes: 5e782bc257 ("net/hns3: fix configuring RSS hash when rules are flushed")
Fixes: fd81968387 ("net/hns3: fix configuring device with RSS enabled")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-12 15:56:59 +02:00
Huisong Li
bfd0b54dc8 net/hns3: remove redundant RSS tuple field
The 'rss_tuple_fields' in struct struct hns3_rss_conf::rss_tuple_sets is
redundant. Because the enabled RSS tuple in PMD is already managed by
the 'types' in struct hns3_rss_conf::conf. This patch removes this
redundant variable.

Fixes: c37ca66f2b ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-12 10:28:54 +02:00
Huisong Li
07f64b5f57 net/hns3: fix rollback on RSS hash update
The RSS tuple isn't restored when RSS key length is invalid or setting
algo key failed. This patch fixes it.

Fixes: c37ca66f2b ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-12 10:28:54 +02:00
Huisong Li
75ccc3f3d7 net/hns3: fix RSS disable
Currently, hns3 PMD disable RSS by resetting redirection table when user
set rss_hf to 0 so as to all packets go to queue 0. The implementation
may cause following problems:
1) the same type packet may go to different queue on the case of
   disabling all tuples and partial tuples. The problem is determined by
   hardware design.
2) affect the configuration of redirection table and user experience.

For hns3 hardware, the packets with RSS disabled are always go to the
queue corresponding to first entry of the redirection table. Generally,
disable RSS should be implemented by disabling all tuples, This patch
fix the implementation.

Fixes: c37ca66f2b ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-12 10:28:54 +02:00
Chengwen Feng
2d287ea3c2 net/hns3: fix mbuf free on Tx done cleanup
Currently, the hns3 PMD may free more mbufs than free_cnt parameter,
this is an incorrect implementation. This patch fixes it.

Fixes: 0b77e8f3d3 ("net/hns3: optimize Tx performance")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-12 10:28:54 +02:00
Huisong Li
ec0147b569 net/hns3: fix pseudo-sharing between threads
Some fields in the end of 'struct hns3_rx_queue' and
'struct hns3_tx_queue' are not accessed in the I/O path.
But these fields may be accessed in other threads, which may lead to the
problem of cache pseudo-sharing of IO threads. This patch add a
cacheline alignment to avoid it.

Fixes: 9261fd3caf ("net/hns3: improve IO path data cache usage")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-12 10:28:54 +02:00
Huisong Li
a65342d9d5 net/hns3: fix MAC and queues HW statistics overflow
The MAC and queues statistics are 32-bit registers in hardware. If
hardware statistics are not obtained for a long time, these statistics
will be overflow.
So PF and VF driver have to periodically obtain and save these
statistics. Since the periodical task and the stats API are in different
threads, we introduce a statistics lock to protect the statistics.

Fixes: 8839c5e202 ("net/hns3: support device stats")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-12 10:28:54 +02:00
Huisong Li
1a1de9879f net/hns3: fix order of clearing imissed register in PF
Clearing imissed registers in PF hardware depends on the
'drop_stats_mode' in struct hns3_hw. The variable is initialized after
the "hns3_get_configuration". But, in current code, the clearing
operation runs before the function.
So this patch fixes this order. In addition, this patch extracts a
public function to initialize and uninitialize statistics to improve the
maintainability of these codes.

Fixes: 3e9f3042d7 ("net/hns3: add imissed packet stats")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-12 10:28:54 +02:00
Min Hu (Connor)
dfee5606af net/hns3: fix device info dump
Rx/Tx queue info dump and pvid info dump is both supported
in PF and VF. This patch fixed it.

Fixes: 1a03c659cb ("net/hns3: dump device basic info")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-05 14:57:10 +02:00
Min Hu (Connor)
c36f555bf4 net/hns3: fix TM info dump
Shouldn't dump TM info when TM is not supported by the NIC.
This patch fixed it.

Fixes: e4cfe6bb91 ("net/hns3: dump TM configuration info")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-05 14:57:10 +02:00
Min Hu (Connor)
da2c1aa41e net/hns3: refactor queue info dump
This patch refactors queue info dump.

Fixes: 6038c8a3f6 ("net/hns3: dump queue info")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-05 14:57:10 +02:00
Min Hu (Connor)
c448cf19b6 net/hns3: refactor feature capability dump
This patch refactors feature capability dump.

Fixes: 14ea9f0a62 ("net/hns3: dump device feature capability")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-05 14:57:10 +02:00
Min Hu (Connor)
aadcd32a6b net/hns3: refactor adapter state dump
This patch refactors adapter state dump.

Fixes: 1a03c659cb ("net/hns3: dump device basic info")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-05-05 14:57:10 +02:00
Huisong Li
d6a9f8fb26 net/hns3: increase time waiting for PF reset completion
On the case that PF and VF need to be reset, after the hardware reset is
complete, VF needs wait for 1 second to restore the configuration so
that VF does not fail to recover because PF reset isn't complete. But
the estimated time is not sufficient. This patch fixes it to 5 seconds.

Fixes: 2790c64647 ("net/hns3: support device reset")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
2022-03-02 12:38:52 +01:00
Huisong Li
87f9628e2c net/hns3: fix VF RSS TC mode entry
For packets with VLAN priorities destined for the VF, hardware still
assign Rx queue based on the Up-to-TC mapping PF configured. But VF has
only one TC. If other TC don't enable, it causes that the priority
packets that aren't destined for TC0 aren't received by RSS hash but is
destined for queue 0. So driver has to enable the unused TC by using TC0
queue mapping configuration.

Fixes: c37ca66f2b ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
2022-03-02 12:23:33 +01:00
Huisong Li
cdb9a7ae5f net/hns3: fix RSS TC mode entry
The driver allocates queues only to valid TCs. But the driver also
configure queues for invalid TCs, which is unreasonable.

Fixes: c37ca66f2b ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
2022-03-02 12:23:24 +01:00
Jie Hai
0983cdc187 net/hns3: remove duplicate macro definition
This patch fixes duplicate macro definition of HNS3_RSS_CFG_TBL_SIZE.

Fixes: 737f30e1c3 ("net/hns3: support command interface with firmware")
Cc: stable@dpdk.org

Signed-off-by: Jie Hai <haijie1@huawei.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
2022-03-02 12:23:19 +01:00
Ferruh Yigit
a41f593f1b ethdev: introduce generic dummy packet burst function
Multiple PMDs have dummy/noop Rx/Tx packet burst functions.

These dummy functions are very simple, introduce a common function in
the ethdev and update drivers to use it instead of each driver having
its own functions.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2022-02-11 21:17:34 +01:00
Min Hu (Connor)
f6eee8bcac net/hns3: dump flow control info
This patch dumps flow control info such as flow control mode
for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-02-11 18:49:03 +01:00
Min Hu (Connor)
e4cfe6bb91 net/hns3: dump TM configuration info
This patch dumps TM configuration info about shaper, port node, TC node,
queue node related info.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-02-11 18:49:03 +01:00
Min Hu (Connor)
e221a06747 net/hns3: dump flow director basic info
This patch dumps flow director basic info such rule numbers, hit counts
for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-02-11 18:49:03 +01:00
Min Hu (Connor)
871e5a4f88 net/hns3: dump VLAN configuration info
This patch dump VLAN filter, strip related info and Pvid info for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-02-11 18:49:03 +01:00
Min Hu (Connor)
6038c8a3f6 net/hns3: dump queue info
This patch dumps Rx/Tx queue info, such as queue numbers, queue enable
state for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-02-11 18:49:03 +01:00
Min Hu (Connor)
17063e44c9 net/hns3: dump device MAC info
This patch dumps device MAC info which hns3 PMD private info offers.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-02-11 18:49:03 +01:00
Min Hu (Connor)
14ea9f0a62 net/hns3: dump device feature capability
Kunpeng 920 and Kunpeng 930 support different feature capability.
This patch dumps feature capability Current device supports.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-02-11 18:49:03 +01:00
Min Hu (Connor)
1a03c659cb net/hns3: dump device basic info
This patch dumps device basic info such as device name, adapter state
for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-02-11 18:49:03 +01:00
Stephen Hemminger
06c047b680 remove unnecessary null checks
Functions like free, rte_free, and rte_mempool_free
already handle NULL pointer so the checks here are not necessary.

Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2022-02-12 12:07:48 +01:00