Commit Graph

1132 Commits

Author SHA1 Message Date
Kalesh AP
46c451d905 net/bnxt: remove unnecessary comment
Remove unnecessary comment in the code.

Fixes: 0a6d2a7200 ("net/bnxt: get device infos")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-09 00:50:02 +02:00
Kalesh AP
4a8ac3768f net/bnxt: improve probing log message
The existing log message is missing a space. Modified it to
a more meaningful log as part of this change.

Before this patch:

bnxt_dev_init(): bnxtfound at mem D67E0000, node addr 0x2101112000M

With this patch:

bnxt_dev_init(): Found bnxt device at mem D67E0000, node addr 0x2101112000M

Fixes: 1bf01f5135 ("net/bnxt: prevent device access when device is in reset")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-09 00:47:22 +02:00
Kalesh AP
a642112c91 net/bnxt: fix check for PTP support in FW
On Thor, driver must use HWRM to access the timestamp information.
Driver should not advertise PTP support to application
if PTP information is not available via HWRM commands.

Fixes: 6cbd89f9f3 ("net/bnxt: support PTP for Thor")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-09 00:41:25 +02:00
Kalesh AP
3e3fecf4b8 net/bnxt: use common function to free VNIC resource
Use the function bnxt_vnic_destroy() to destroy VNIC resources
and thereby eliminate few duplicate code.

Fixes: 8d0a244b40 ("net/bnxt: cleanup VNIC after flow validate")
Fixes: 49d0709b25 ("net/bnxt: delete and flush L2 filters cleanly")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-09 00:27:45 +02:00
Kalesh AP
25ee03f532 net/bnxt: set flow error after tunnel redirection free
During flow destroy, when bnxt_hwrm_tunnel_redirect_free() fails,
driver is not setting flow error using "rte_flow_error_set".

Fixes: 11e5e19695 ("net/bnxt: support redirecting tunnel packets to VF")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-09 00:26:57 +02:00
Kalesh AP
4171ac66e5 net/bnxt: fix error handling in VNIC prepare
Resources should be freed on error conditions. i.e, VNIC and
VNIC context created in HW and memory allocated in
bnxt_vnic_grp_alloc() should be freed.

Added a new function bnxt_vnic_destroy() to do the cleanup.
This lightweight function can be used in flow destroy/flush
path to avoid duplicate code as well.

Fixes: d24610f7bf ("net/bnxt: allow flow creation when RSS is enabled")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-09 00:10:25 +02:00
Kalesh AP
b93fe4db51 net/bnxt: remove unnecessary code
Also removed a log message which does not convey any
useful information.

Fixes: d24610f7bf ("net/bnxt: allow flow creation when RSS is enabled")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-08 23:29:18 +02:00
Kalesh AP
94df7953ac net/bnxt: set flow error when free filter not available
In bnxt_flow_validate(), when bnxt_get_unused_filter() fails due to
no filter resources available, driver is not setting flow error using
"rte_flow_error_set".

Also, fixed the error code.

Fixes: 5ef3b79fdf ("net/bnxt: support flow filter ops")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-08 23:29:18 +02:00
Kalesh AP
52b0e588eb net/bnxt: fix error messages in VNIC prepare
The bnxt_vnic_prep() can fail due to multiple reasons.
But when bnxt_vnic_prep() fails, PMD is not returning
the actual error/string to the application.

Fix it by moving the "rte_flow_error_set" to bnxt_vnic_prep()
to set the actual error code.

Fixes: d24610f7bf ("net/bnxt: allow flow creation when RSS is enabled")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
2021-06-08 23:29:18 +02:00
Somnath Kotur
219842b999 net/bnxt: workaround spurious zero stats in Thor
There is a HW bug that can result in certain stats being reported as
zero.
Workaround this by ignoring stats with a value of zero based on the
previously stored snapshot of the same stat.
This bug mainly manifests in the output of func_qstats as FW aggregrates
each ring's stat value to give the per function stat and if one of
them is zero, the per function stat value ends up being lower than the
previous snapshot which shows up as a zero PPS value in testpmd.
Eliminate invocation of func_qstats and aggregate the per-ring stat
values in the driver itself to derive the func_qstats output post
accounting for the spurious zero stat value.

Bugzilla ID: 641
Fixes: f8168ca0e6 ("net/bnxt: support thor controller")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-08 23:01:29 +02:00
Somnath Kotur
03c8f2fe11 net/bnxt: detect bad opaque in Rx completion
There is a rare hardware bug that can cause a bad opaque value in the RX
or TPA start completion. When this happens, the hardware may have used the
same buffer twice for 2 Rx packets.  In addition, the driver might also
crash later using the bad opaque as an index into the ring.

The Rx opaque value is predictable and is always monotonically increasing.
The workaround is to keep track of the expected next opaque value and
compare it with the one returned by hardware during RX and TPA start
completions. If they miscompare, log it, discard the completion,
schedule a ring reset and move on to the next one.

Fixes: 0958d8b643 ("net/bnxt: support LRO")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-08 19:17:25 +02:00
Lance Richardson
c4e4c18963 net/bnxt: add AVX2 RX/Tx
Implement AVX2 vector PMD.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-07 23:36:13 +02:00
Lance Richardson
008feb839f net/bnxt: fix Rx burst size constraint
The burst receive function should return all packets currently
present in the receive ring up to the requested burst size,
update vector mode receive functions accordingly.

Fixes: 3983583414 ("net/bnxt: support NEON")
Fixes: bc4a000f2f ("net/bnxt: implement SSE vector mode")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-07 23:36:02 +02:00
Lance Richardson
1aa8a8c7b9 net/bnxt: refactor HW ptype mapping table
Make the definition of the table used to map hardware packet type
information to DPDK packet type more generic.

Add macro definitions for constants used in creating table
indices, use these to eliminate raw constants in code.

Add build-time assertions to validate ptype mapping constants.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-07 23:35:39 +02:00
Thierry Herbelot
dc59260fb6 net/bnxt: check access to possible null pointer
Check that pointers are valid before using them.

Fixes: 7bc8e9a227 ("net/bnxt: support async link notification")
Cc: stable@dpdk.org

Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-06-07 23:14:12 +02:00
David Marchand
eeded2044a log: register with standardized names
Let's try to enforce the convention where most drivers use a pmd. logtype
with their class reflected in it, and libraries use a lib. logtype.

Introduce two new macros:
- RTE_LOG_REGISTER_DEFAULT can be used when a single logtype is
  used in a component. It is associated to the default name provided
  by the build system,
- RTE_LOG_REGISTER_SUFFIX can be used when multiple logtypes are used,
  and then the passed name is appended to the default name,

RTE_LOG_REGISTER is left untouched for existing external users
and for components that do not comply with the convention.

There is a new Meson variable log_prefix to adapt the default name
for baseband (pmd.bb.), bus (no pmd.) and mempool (no pmd.) classes.

Note: achieved with below commands + reverted change on net/bonding +
edits on crypto/virtio, compress/mlx5, regex/mlx5

$ git grep -l RTE_LOG_REGISTER drivers/ |
  while read file; do
    pattern=${file##drivers/};
    class=${pattern%%/*};
    pattern=${pattern#$class/};
    drv=${pattern%%/*};
    case "$class" in
      baseband) pattern=pmd.bb.$drv;;
      bus) pattern=bus.$drv;;
      mempool) pattern=mempool.$drv;;
      *) pattern=pmd.$class.$drv;;
    esac
    sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file;
    sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file;
  done

$ git grep -l RTE_LOG_REGISTER lib/ |
  while read file; do
    pattern=${file##lib/};
    pattern=lib.${pattern%%/*};
    sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern',/RTE_LOG_REGISTER_DEFAULT(\1,/' $file;
    sed -i -e 's/RTE_LOG_REGISTER(\(.*\), '$pattern'\.\(.*\),/RTE_LOG_REGISTER_SUFFIX(\1, \2,/' $file;
  done

Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2021-05-11 15:17:55 +02:00
Kalesh AP
c967098a4c net/bnxt: prevent device access in error state
Driver should prevent any DMA with the device when it
detects an error. When firmware is in fatal state,
stop tx/rx by assigning them to dummy functions.

Fixes: be14720def ("net/bnxt: support FW reset")
Fixes: 9d0cbaecc9 ("net/bnxt: support periodic FW health monitoring")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-05-04 05:56:14 +02:00
Ajit Khaparde
a49844ffa3 net/bnxt: fix ring count calculation
Fix ring count calculation for Thor. VNIC count does not have a
direct bearing on the number of rings that can be used.

Fixes: fe8dd26f86 ("net/bnxt: cap max Rx rings for Thor")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-05-03 00:17:17 +02:00
Ajit Khaparde
0797fcb004 net/bnxt: fix mismatched type comparison in Rx
Fix comparison between uint16_t and uint32_t types.

Fixes: 6dc83230b4 ("net/bnxt: support port representor data path")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-05-03 00:17:17 +02:00
Ajit Khaparde
52c3373458 net/bnxt: check PCI config read
Return value where return value of rte_pci_read_config was not checked.
Fix it.

Coverity issue: 349919
Fixes: 9d0cbaecc9 ("net/bnxt: support periodic FW health monitoring")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2021-05-03 00:17:17 +02:00
Ajit Khaparde
c8e8154390 net/bnxt: fix mismatched type comparison in MAC restore
dev_info.max_mac_addrs is of type uint32_t. But the counter i is
of type uint16_t. This mismatch may cause the loop condition may
always be true. Change the loop counter variable to uint32_t.

Fixes: b02f1573cd ("net/bnxt: restore MAC filters during reset recovery")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2021-05-03 00:17:17 +02:00
Kalesh AP
7712a39cc4 net/bnxt: fix single PF per port check
The check BNXT_SINGLE_PF(bp) returns false for a VF. So there is no
extra check needed for VF along with BNXT_SINGLE_PF(bp).

Also make error messages more explicit.

Fixes: ff947c6ce1 ("net/bnxt: add check for multi host PF per port")
Fixes: f86febfb46 ("net/bnxt: support VF")
Fixes: 3e12fdb78e ("net/bnxt: support VLAN pvid")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-05-03 00:16:35 +02:00
Lance Richardson
a0c2315a2a net/bnxt: fix dynamic VNIC count
Ensure that the current count of in-use VNICs is decremented
when a VNIC is freed. Don't attempt VNIC allocation when the
maximum supported number of VNICs is currently allocated.

Fixes: 49d0709b25 ("net/bnxt: delete and flush L2 filters cleanly")
Fixes: d24610f7bf ("net/bnxt: allow flow creation when RSS is enabled")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reported-by: Stephen Hemminger <sthemmin@microsoft.com>
2021-05-03 00:15:57 +02:00
Somnath Kotur
f8120fd07b net/bnxt: fix Rx timestamp when FIFO pending bit is set
Fix to clear the Rx FIFO while reading the timestamp.
If the Rx FIFO has pending bit set, keep reading to clear it
and return the last valid timestamp instead of unconditionally
returning an error.

Fixes: b11cceb83a ("net/bnxt: support timesync")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-05-03 00:15:19 +02:00
Somnath Kotur
21b1677d87 net/bnxt: refactor multi-queue Rx configuration
Eliminate separate codepath/handling for single queue
as the multiqueue code path takes care of it as well.
The only difference being the end_grp_id being 1
now instead of 0 for single queue, but that does not matter
for single queue and does not alter any functionality.

Fixes: 6133f20797 ("net/bnxt: add Rx queue create/destroy")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-05-03 00:14:58 +02:00
Kalesh AP
4f28d9a1a6 net/bnxt: drop unused attribute
Remove "__rte_unused" instances that are wrongly marked.

Fixes: 6dc83230b4 ("net/bnxt: support port representor data path")
Fixes: 1bf01f5135 ("net/bnxt: prevent device access when device is in reset")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-04-24 21:23:09 +02:00
Stephen Hemminger
c02bbaa96b net/bnxt: use prefix on global function
When statically linked the function prandom_bytes is exposed
and might conflict with something in application. All driver
functions should use the same prefix.

Fixes: 9738793f28 ("net/bnxt: add VNIC functions and structs")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-04-24 21:39:12 +02:00
Kalesh AP
91f7a2d437 net/bnxt: remove unused function parameters
1. Clean up unused function parameters.
2. Declare no external referenced function as static and remove
   their prototype from the header file.

Fixes: ec77c62983 ("net/bnxt: add stats context allocation")
Fixes: 200b64ba0b ("net/bnxt: free statistics context")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-04-24 21:05:07 +02:00
Kalesh AP
b3577e2aa6 net/bnxt: remove unnecessary forward declarations
This patch removes several redundant forward declarations of
functions and structure.

Fixes: 0b42b92ae4 ("net/bnxt: fix xstats by id")
Fixes: cf4f055a65 ("net/bnxt: remove EEM system memory support")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
2021-04-24 21:00:37 +02:00
Stephen Hemminger
6aba4a036e net/bnxt: skip get statistics for stopped queues
An application using rte_flow may define a large number of queues
but only use a small subset of them at any one time.

Since querying the status of each queue requires a request/spin/reply
with the firmware, optimize by skipping the request for queues not
running.
For those queues the statistics will be 0.

This cuts the cost of single xstats query in half and has even
bigger gain for simple stats query.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-04-24 20:53:45 +02:00
Ferruh Yigit
d345d6c957 drivers/net: fix FW version query
Fixes a few different things:
* Remove 'fw_version' NULL checks, it is allowed if the 'fw_size' is
  zero, 'fw_version' being NULL but 'fw_size' not zero condition checked
  in ethdev layer
* Be sure required buffer size is returned if provided one is not big
  enough, instead of returning success (0)
* Document in doxygen comment the '-EINVAL' is a valid return type
* Take into account that 'snprintf' can return negative value
* Cast length to 'size_t' to compare it with 'fw_size'

Fixes: bb42aa9ffe ("net/atlantic: configure device start/stop")
Fixes: ff70acdf42 ("net/axgbe: support reading FW version")
Fixes: e2652b0a20 ("net/bnxt: support get FW version")
Fixes: cf0fab1d2c ("net/dpaa: support firmware version get API")
Fixes: 748eccb97c ("net/dpaa2: add support for firmware version get")
Fixes: b883c0644a ("net/e1000: add firmware version get")
Fixes: 293430677e ("net/enic: add handler to return firmware version")
Fixes: 1f5ca0b460 ("net/hns3: support some device operations")
Fixes: bd5b86732b ("net/hns3: modify format for firmware version")
Fixes: ed0dfdd0e9 ("net/i40e: add firmware version get")
Fixes: e31cb9a362 ("net/ice: support FW version getting")
Fixes: 4f09bc55ac ("net/igc: implement device base operations")
Fixes: eec10fb0ce ("net/ionic: support FW version")
Fixes: 8b0b565742 ("net/ixgbe: add firmware version get")
Fixes: 4d9f5b8adc ("net/octeontx2: add FW version get operation")
Fixes: f97b56f9f1 ("net/qede: support FW version query")
Fixes: 83fef46a22 ("net/sfc: add callback to retrieve FW version")
Fixes: bc84ac0fad ("net/txgbe: support getting FW version")
Fixes: 2191347120 ("ethdev: add firmware version get")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Rasesh Mody <rmody@marvell.com>
Acked-by: Jiawen Wu <jiawenwu@trustnetic.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2021-04-26 13:50:42 +02:00
Kalesh AP
d723d1fe5d net/bnxt: fix health check alarm cancellation
Driver cancels the health check alarm only if error recovery is enabled
in the FW. This can cause an issue. There is a small window where the
driver receives the async event from FW and port close is invoked
immediately. Driver clears BNXT_FLAG_RECOVERY_ENABLED flag when it gets
the async event from FW. As a result, the health check alarm will not
get canceled during port close and causes a segfault when the alarm tries
to read Heartbeat register.

Fix this by canceling the health check alarm unconditionally during
port stop.

Fixes: 9d0cbaecc9 ("net/bnxt: support periodic FW health monitoring")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-04-20 07:29:23 +02:00
Ajit Khaparde
fe8dd26f86 net/bnxt: cap max Rx rings for Thor
For Thor devices, RSS table can only accommodate 512 Rx queues.
When RSS is enabled, Cap the max Rx rings to 512.
For non-RSS case, the number will be limited by number of VNICs.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
2021-04-20 00:56:43 +02:00
Ajit Khaparde
e2895305a5 net/bnxt: fix resource cleanup
Fix resource cleanup in port close.
Once the pointers are freed, set them to NULL.
Make sure access to the pointers is validated before use.

Fixes: bb81e07323 ("net/bnxt: support LED on/off")
Fixes: 804e746c7b ("net/bnxt: add hardware resource manager init code")
Fixes: 1d0704f4d7 ("net/bnxt: add device configure operation")
Fixes: 698aa7e953 ("net/bnxt: add code to determine the Tx COS queue")
Fixes: 322bd6e702 ("net/bnxt: add port representor infrastructure")
Fixes: 0bf5a0b5eb ("net/bnxt: add a failure log")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-04-19 21:32:11 +02:00
Bruce Richardson
4ad4b20a79 drivers: change indentation in build files
Switch from using tabs to 4 spaces for meson.build indentation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-04-21 14:04:09 +02:00
Kalesh AP
8c46bd112e net/bnxt: fix FW unregister log
The "Unregistered with fw" message was being logged in a wrong function.
Moved it to the right place.

Fixes: a7dda7e0a0 ("net/bnxt: log port id in async events")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-04-07 04:57:26 +02:00
Kalesh AP
e73fb98b69 net/bnxt: fix configuring LRO
While configuring LRO, driver should check the return value
of bnxt_hwrm_vnic_tpa_cfg() HWRM command and return error
when the FW command fails.

Fixes: 0958d8b643 ("net/bnxt: support LRO")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2021-04-07 04:56:43 +02:00
Kalesh AP
39a03b401e net/bnxt: fix double free in port start failure
During port start when bnxt_start_nic() fails, it tries to free
"intr_handle->intr_vec" but the variable is not set to NULL after that.
If port start fails, driver invokes bnxt_dev_stop() which will lead
to a double free of "intr_handle->intr_vec".

Fix it by removing the call to free "intr_handle->intr_vec" in the
bnxt_start_nic() failure path as it is anyway doing in bnxt_dev_stop().

Fixes: 9d276b439a ("net/bnxt: fix error handling in device start")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-04-07 04:56:03 +02:00
Thomas Monjalon
058ac0ddc5 drivers/net: remove useless autoneg capability
The flag ETH_LINK_SPEED_AUTONEG is 0,
so it cannot be used in a capability bitmap.

Having 0 in speed capability means all speeds are accepted.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-04-01 15:16:53 +02:00
Thomas Monjalon
fb7ad441d4 ethdev: replace callback getting filter operations
Since rte_flow is the only API for filtering operations,
the legacy driver interface filter_ctrl was too much complicated
for the simple task of getting the struct rte_flow_ops.

The filter type RTE_ETH_FILTER_GENERIC and
the filter operarion RTE_ETH_FILTER_GET are removed.
The new driver callback flow_ops_get replaces filter_ctrl.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-03-26 18:37:13 +01:00
Kalesh AP
4f1d8fdc3f net/bnxt: fix memory allocation for command response
Driver re-allocates memory for the command response buffer
when the installed firmware version is newer (and has a larger
max response length) than the version of HWRM that was used to
build the PMD.

This change helps to avoid the re-allocation by allocating the
memory for the command response buffer with PAGE_SIZE.

Coverity issue: 366256, 366204, 366180
Fixes: b7778e8a1c ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
2021-03-22 19:27:47 +01:00
Ajit Khaparde
29ce7059e8 net/bnxt: check kvargs parsing
Check return value of rte_kvargs_process()

Coverity issue: 357765
Fixes: ba404aacc5 ("net/bnxt: set maximum flow count")
Fixes: 02a95625fe ("net/bnxt: add flow stats in extended stats")
Fixes: 7b09406537 ("net/bnxt: support host memory based TruFlow")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
2021-03-19 20:29:57 +01:00
Lance Richardson
dea1afc71f net/bnxt: fix handling of null flow mask
When the mask field of an rte_flow pattern item is NULL,
the default mask for that item type should be used.

Fixes: 5ef3b79fdf ("net/bnxt: support flow filter ops")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-03-19 20:29:56 +01:00
Lance Richardson
74f2172177 net/bnxt: fix Tx length hint threshold
Use correct threshold when selecting "greater than or equal to
2K" length hint.

Fixes: 6eb3cc2294 ("net/bnxt: add initial Tx code")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2021-03-19 20:29:56 +01:00
Lance Richardson
bb4f70d275 net/bnxt: fix Rx buffer posting
Remove early buffer posting logic from burst receive loop to address
several issues:
   - Posting receive descriptors without first posting completion
     entries risks overflowing the completion queue.
   - Posting receive descriptors without updating rx_raw_prod
     creates the possibility that the receive descriptor doorbell
     can be written twice with the same value.
   - Having this logic in the inner descriptor processing loop
     can impact performance.

Fixes: 637e34befd ("net/bnxt: optimize Rx processing")
Fixes: 04067844a3 ("net/bnxt: reduce CQ queue size without aggregation ring")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-03-19 20:29:56 +01:00
Kalesh AP
ab15dd5a1c net/bnxt: fix timesync when PTP is not supported
Fixed to return error when PTP support is not supported on the port.
Also, removed an unnecessary check inside bnxt_get_rx_ts().

Fixes: b11cceb83a ("net/bnxt: support timesync")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2021-03-19 20:29:55 +01:00
Kalesh AP
586d9da38a net/bnxt: fix link state operations
VFs does not have the privilege to change link configuration.
But the driver silently returns success to these ethdev callbacks
without actually issuing the HWRM command to bring the link up/down.

Fixes: 5c206086fe ("net/bnxt: add link state operations")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-03-19 20:29:55 +01:00
Ajit Khaparde
670ab55384 net/bnxt: fix RSS context cleanup
The PMD is allocating an extra RSS context with each port start.
But it is freeing only one RSS context during port stop. So at some point
we run out of RSS contexts when we do multiple port stop/start sequences.
bnxt_hwrm_vnic_ctx_alloc() is called by bnxt_setup_one_vnic(), but
bnxt_hwrm_vnic_ctx_free() is not called in the corresponding
bnxt_free_one_vnic().

Fix this by calling bnxt_hwrm_vnic_ctx_free() in bnxt_free_one_vnic().

Fixes: 7fe5668d2e ("net/bnxt: support VLAN filter and strip")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-03-19 20:29:54 +01:00
Kalesh AP
fcf953791c net/bnxt: fix PCI write check
CID 363716 (#1 of 1): Unchecked return value (CHECKED_RETURN)
check_return: Calling rte_pci_write_config without checking
return value (as is done elsewhere 46 out of 49 times).

Coverity issue: 363716
Fixes: be14720def ("net/bnxt: support FW reset")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2021-03-19 20:29:46 +01:00
Somnath Kotur
aa764bae8d net/bnxt: fix Tx timestamp init
Fix to read the sequence ID register to get Tx timestamp.
Reading the sequence ID register is necessary for the HW FIFO to
advance and thereby get the correct value of the timestamp on Tx side.
This patch fixes that.

Fixes: b11cceb83a ("net/bnxt: support timesync")
Cc: stable@dpdk.org

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
2021-03-19 20:29:29 +01:00