Commit graph

107 commits

Author SHA1 Message Date
Vladimir Kondratyev 07c7c41ca1 LinuxKPI: Add min_not_zero() to linux/minmax.h
It returns the minimum that is not zero, except both equals to zero.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	bz, emaste, ssaxena
Differential Revision:	https://reviews.freebsd.org/D45450
Differential Revision:	https://reviews.freebsd.org/D45451
2024-06-06 23:42:06 +03:00
Mark Johnston bbe42332e5 bnxt_re: Explicitly cast pointer-to-integer conversions
Reported by:	Jenkins
Fixes:	acd884dec9 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
2024-05-28 09:12:42 -04:00
Sumit Saxena acd884dec9 RDMA/bnxt_re: Add bnxt_re RoCE driver
This patch introduces the RoCE driver for the
Broadcom NetXtreme-E 10/25/50/100/200G RoCE HCAs.

The RoCE driver is a two part driver that relies
on the bnxt_en NIC driver to operate. The changes
needed in the bnxt_en driver is included through
another patch "L2-RoCE driver communication interface"
in this set.

Presently, There is no user space support, Hence
recommendation to use the krping kernel module for
testing. User space support will be incorporated in
subsequent patch submissions.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D45011
2024-05-28 10:36:11 +00:00
Chandrakanth patil 862af86f4b bnxt_en: Driver version update to 230.0.133.0
Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D45010
2024-05-28 10:36:11 +00:00
Chandrakanth patil 3d8bbe0011 bnxt_en: Firmware header version update to 1.10.3.42
This file is automatically generated from the firmware code to
export the driver interfaces.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D45009
2024-05-28 10:36:11 +00:00
Chandrakanth patil c9965974a5 bnxt_en: Firmware error recovery support
Implement firmware error recovery support for Thor adapters.
This entails enabling the capability for the firmware to initiate
error recovery. Specifically, the firmware will send the reset notify
asynchronous event to notify the driver of an error and impending reset.
Subsequently, the driver will queue a task to execute the following steps.

1. Deactivate the allocated resources.
2. Await completion of the firmware's recovery process.
3. Configure the resources and reactivate the network interface.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D45008
2024-05-28 10:36:11 +00:00
Chandrakanth patil 032899b59c bnxt_en: Added support for priority queues extended stats
Below priority queues extended stats are exposed to sysctl:

tx_bytes_pri{0-7}
rx_bytes_pri{0-7}
tx_packets_pri{0-7}
rx_packets_pri{0-7}

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D45007
2024-05-28 10:36:11 +00:00
Chandrakanth patil 050d28e13c bnxt_en: L2-RoCE driver communication interface
- Added Aux bus support for RoCE.
- Implemented the ulp ops that are required by RoCE driver.
- Restructure context memory data structures
- DBR pacing support

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D45006
2024-05-28 10:36:10 +00:00
Chandrakanth patil 35b53f8c98 bnxt_en: Add PFC, ETS & App TLVs protocols support
Created new directory "bnxt_en" in /dev/bnxt and /modules/bnxt
and moved source files and Makefile into respective directory.

ETS support:

   - Added new files bnxt_dcb.c & bnxt_dcb.h
   - Added sysctl node 'dcb' and created handlers 'ets' and
     'dcbx_cap'
   - Add logic to validate user input and configure ETS in
     the firmware
   - Updated makefile to include bnxt_dcb.c & bnxt_dcb.h

PFC support:

   - Created sysctl handlers 'pfc' under node 'dcb'
   - Added logic to validate user input and configure PFC in
     the firmware.

App TLV support:

   - Created 3 new sysctl handlers under node 'dcb'
       - set_apptlv (write only): Sets a specified TLV
       - del_apptlv (write only): Deletes a specified TLV
       - list_apptlv (read only): Lists all APP TLVs configured
   - Added logic to validate user input and configure APP TLVs
     in the firmware.

Added Below DCB ops for management interface:

   - Set PFC, Get PFC, Set ETS, Get ETS, Add App_TLV, Del App_TLV
     Lst App_TLV

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D45005
2024-05-28 10:15:29 +00:00
Chandrakanth Patil 770e7ba3eb if_bnxt: Set 1G/10G baseT force speed as auto speeds
The firmware lacks support for manually setting 1G and 10G baseT speeds.
However, the driver can enable auto speed masks to achieve automatic configuration
at these speeds.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42960
2024-03-07 19:26:34 +00:00
Chandrakanth Patil c63d67e137 if_bnxt: 50G, 100G and 200G PAM4 support
Add support for 50G, 100G and 200G PAM4 support

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42959
2024-03-07 19:16:39 +00:00
Sumit Saxena 3320f0f69f if_bnxt: Pluggable Module Display Support
This update enables the display of pluggable module information
to users via the ifconfig utility.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42958
2024-03-07 19:16:39 +00:00
Chandrakanth Patil d36b36621a if_bnxt: Implementation of Extended Port Hardware Stats Support for THOR Controller
The newly added port extended hardware statistics are now accessible to
users through the sysctl interface. Also, Few obsolete stats are removed
and few stats are renamed.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42957
2024-03-07 19:16:39 +00:00
Chandrakanth Patil 816abba22e if_bnxt: Integrate AOC Cable Support into Current 40G PHY Speed
Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D429506
2024-03-07 19:16:39 +00:00
Chandrakanth Patil 25f38d0990 if_bnxt: Update Firmware Header to Latest Version 1.10.2.136
Update Firmware Header to Latest Version 1.10.2.136.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42955
2024-03-07 19:16:39 +00:00
Chandrakanth Patil 8a3aab53e3 if_bnxt: Update Maximum Configurable MTU from 9000 to 9600
Increasing the maximum configurable MTU from 9000 to 9600 to
align with the firmware's capability of handling an MTU up to 9600.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42954
2024-03-07 19:16:39 +00:00
Chandrakanth Patil 0f8d1a9e0c if_bnxt: Enabled support for 1G SX, CX, and LX forced speed settings
Enabled User Configuration of 1G Speed on Wh+ SFP28 Port with AOC
cable.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42953
2024-03-07 19:16:38 +00:00
Chandrakanth Patil c5108e37fb if_bnxt: Incorrect Labeling of Supported Medium in ifconfig -m <inf> Command
The 1G speed on DAC medium is incorrectly labeled as 1000baseT, it
should be 1000baseCX. Updated the label accordingly.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42952
2024-03-07 19:09:13 +00:00
Chandrakanth Patil 7cbffbfcd9 if_bnxt: Fix media speed update issue in "ifconfig -m" during PHY hot plug
Currently, if a media type (e.g., DAC) is hot-plugged out and another type
(e.g., optical cable) is hot-plugged in, the new speed is not reflected in
ifconfig. This occurs when the driver fails to update speeds with unchanged
tx and rx flow control.

To fix, a phy_type check ensures update of phy speeds upon detecting the new
phy.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42951
2024-03-07 18:42:39 +00:00
Sumit Saxena e436cb7966 if_bnxt: Correcting the firmware package version parsing logic
The firmware package version currently appears as "Unknown" through
the sysctl interface. The parsing logic for extracting the firmware
package version from the package log has been modified to ensure
compatibility with all controllers.

Reviewed by:            imp
Approved by:            imp
Differential revision:  https://reviews.freebsd.org/D42950
2024-03-06 12:17:29 +00:00
Mark Johnston 243e3ab3d3 bnxt: Handle errors from copyout() in ioctl handlers
This is in preparation for annotating copyin() and related functions
with __result_use_check.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D43178
2024-01-04 08:39:53 -05:00
Warner Losh fdafd315ad sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:00 -07:00
John Baldwin 99159b076a Update a couple of tools to not embed __FBSDID in generated files
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41955
2023-09-25 07:50:11 -07:00
Kevin Bowling bce864d1c2 bnxt: Don't restart on VLAN changes
In rS360398, a new iflib device method was added with default of opt out
for VLAN events needing an interface reset.

This is unintentional for bnxt(4) and is causing another bug in its VLAN
initialization code to affect the common case of adding and removing
VLANs on an existing interface.

PR:		269133
Tested by:	kp
MFC after:	2 weeks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D41558
2023-08-24 13:46:56 -07:00
Marius Strobl 51e235148a iflib drivers: Constify PCI ID LUTs
Since d49e83eac3, iflib(9) is ready
for this change.
While at it, make isc_driver_version strings (static) const where
not apparently un-const on purpose, too.
This reduces the size of the amd64 GENERIC by about 10 KiB.
2023-08-17 20:34:23 +02:00
Warner Losh 031beb4e23 sys: Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:58 -06:00
Warner Losh 685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Justin Hibbits 56c1eafe50 IfAPI: Finish conversion of bnxt(4) to IfAPI.
Sponsored by:	Juniper Networks, Inc.
2023-01-31 15:02:18 -05:00
Justin Hibbits ec22a3a259 DrvAPI: Trivial mechanical conversions for various drivers
Mechanically convert the following drivers, with trivial changes:
* ipw(4)
* igc(4)
* enetc(4)
* malo(4)
* nfe(4)
* bxe(4)
* awg(4)
* otus(4)
* rtwn(4)
* bnxt(4)
* ath(4)

Sponsored by:	Juniper Networks, Inc.
2022-12-21 15:36:59 -05:00
Warner Losh eb40e3e757 bnxt: Only filter out i386
Only i386 is missing bus_read_8. The other 32-bit platforms can be fixed
with a cast to a printf.

Suggested by:	kevans
Sponsored by:	Netflix
2022-11-04 22:40:00 -06:00
Sumit Saxena 58d84ef870 if_bnxt: Added support for mgmt interface for passthrough hwrms
Added support for application management interface. There are two types of commands supported:

1. Firmware IOCTLs: These ioctls are meant for firmware
   consumption. Driver acts as a transport for these.
2. Driver only IOCTLs: These ioctls are meant for driver
   consumption. Driver will serve these ioctls without sending them down
   to firmware.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36448
2022-11-04 16:40:29 -06:00
Sumit Saxena 2ed061f08d if_bnxt: Add support for smaller backing_store_cfg message size
Add compat logic to fallback to the older/smaller backing_store_cfg
message size.

Reviewed by: imp
Differentil Revision: https://reviews.freebsd.org/D36447
2022-11-04 16:33:21 -06:00
Sumit Saxena 19a57f85ba if_bnxt: Fix the PORT_PHY_CFG HWRM requests while setting Pause
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36446
2022-11-04 16:31:24 -06:00
Sumit Saxena baef1301a2 if_bnxt: Fix the issue when kernel invokes _init() again without _stop()
Fixed the issue when kernel invokes _init() when it is already in
_init() state by invoking _stop() in such case.

Reviewed by: imp
Differential Revsion: https://reviews.freebsd.org/D36445
2022-11-04 16:28:51 -06:00
Sumit Saxena 72e9dbb58c if_bnxt: Remove sysctl node vlan_only which is not being used
Removed sysctl node vlan_only which is not being used after migrating
from l2_set_rx_mask to l2_filter_alloc.

Reviewed by: imp
Differential Revsion: https://reviews.freebsd.org/D36444
2022-11-04 16:26:03 -06:00
Sumit Saxena 91fcacc355 if_bnxt: Add support for VLAN on Thor
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36443
2022-11-04 16:24:32 -06:00
Sumit Saxena cfdca95f78 if_bnxt: Add support for RSS on Thor
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36442
2022-11-04 16:21:20 -06:00
Sumit Saxena 6033382aab if_bnxt: Display firmware version along with SIT package version
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36441
2022-11-04 16:18:38 -06:00
Sumit Saxena fb4b7e02d2 if_bnxt: Add support for async link status update
Reivewed by: imp
Differential Revision: https://reviews.freebsd.org/D36440
2022-11-04 16:14:49 -06:00
Sumit Saxena 055196a7d7 if_bnxt: Add support for admin down/up and jumbo
Make ifconfig up/down work, as well as adding support for jumbo frames.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36439
2022-11-04 16:11:10 -06:00
Sumit Saxena 8945584f93 if_bnxt: add support for Thor controller
Added support for Thor controller.
Below are the supported operations:

1. IPv4 ping (ICMP)
2. iperf / netperf (IPv4 TCP)
3. Promiscuous (tcpdump)
4. Can achieve 20 Gbps on a 25 G link (Uni-Di)
5. Can achieve 60 Gbps on a 100 G link (Uni-Di)
6. Port level and queue level driver stats.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36438
2022-11-04 16:05:57 -06:00
Sumit Saxena 49a3df78c7 if_bnxt: Convert all doorbell writes into function pointers
This is preparatory patch for making a base for Broadcom's Thor
controller support. It converts all doorbell writes into function
pointers.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36437
2022-11-04 16:02:29 -06:00
Sumit Saxena 97315f68fe if_bnxt: update hsi_struct_def.h headers
Updates the drivers to Broadcom's latest:
	HWRM Version 1.10.2.34 using HSI definition version 1.8.4

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36436
2022-11-04 15:58:43 -06:00
John Baldwin 64d3221c61 bnxt: Remove unused devclass argument to DRIVER_MODULE. 2022-05-09 12:22:00 -07:00
Misho 0c6a2fa33e if_bnxt: Allow bnxt interfaces to use vlans
When VLAN HW filter is disabled, the NIC does not pass any vlan tagged
traffic. Setting these flags on the device allows vlan tagged traffic to
pass.

PR:		236983
Tested by:	pi
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34824
2022-04-21 09:31:51 +01:00
Warner Losh 44b4f0370f bnxt: Remove dead write to cp_ring_id
Since this is read from memory, reading it and then ignoring it is dead
code...

Sponsored by:		Netflix
2022-02-28 10:14:34 -07:00
Alexander Motin 9895a2073f bnxt(4): Mark sysctls MP-safe.
MFC after:	1 month
2021-09-03 13:51:08 -04:00
Alexander Motin 8c14d7da5b bnxt(4): Fix bugs in WOL support.
Before this change driver reported IFCAP_WOL_MAGIC enabled, but not
supported.  It caused errors on some SIOCSIFCAP calls.  Instead
report the support if hardware supports WOL, and enabled status if
it has such filter installed on boot.

Also bnxt_wol_config() should check WOL status in if_getcapenable(),
not in if_getcapabilities() to get current one.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2021-09-02 18:23:05 -04:00
Mark Johnston ffe3def903 iflib: Make if_shared_ctx_t a pointer to const
This structure is shared among multiple instances of a driver, so we
should ensure that it doesn't somehow get treated as if there's a
separate instance per interface.  This is especially important for
software-only drivers like wg.

DEVICE_REGISTER() still returns a void * and so the per-driver sctx
structures are not yet defined with the const qualifier.

Reviewed by:	gallatin, erj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29102
2021-03-08 12:39:06 -05:00
Matt Macy 81be655266 iflib: ensure that tx interrupts enabled and cleanups
Doing a 'dd' over iscsi will reliably cause stalls. Tx
cleaning _should_ reliably happen as data is sent.
However, currently if the transmit queue fills it will
wait until the iflib timer (hz/2) runs.

This change causes the the tx taskq thread to be run
if there are completed descriptors.

While here:

- make timer interrupt delay a sysctl

- simplify txd_db_check handling

- comment on INTR types

Background on the change:

Initially doorbell updates were minimized by only writing to the register
on every fourth packet. If txq_drain would return without writing to the
doorbell it scheduled a callout on the next tick to do the doorbell write
to ensure that the write otherwise happened "soon". At that time a sysctl
was added for users to avoid the potential added latency by simply writing
to the doorbell register on every packet. This worked perfectly well for
e1000 and ixgbe ... and appeared to work well on ixl. However, as it
turned out there was a race to this approach that would lockup the ixl MAC.
It was possible for a lower producer index to be written after a higher one.
On e1000 and ixgbe this was harmless - on ixl it was fatal. My initial
response was to add a lock around doorbell writes - fixing the problem but
adding an unacceptable amount of lock contention.

The next iteration was to use transmit interrupts to drive delayed doorbell
writes. If there were no packets in the queue all doorbell writes would be
immediate as the queue started to fill up we could delay doorbell writes
further and further. At the start of drain if we've cleaned any packets we
know we've moved the state machine along and we write the doorbell (an
obvious missing optimization was to skip that doorbell write if db_pending
is zero). This change required that tx interrupts be scheduled periodically
as opposed to just when the hardware txq was full. However, that just leads
to our next problem.

Initially dedicated msix vectors were used for both tx and rx. However, it
was often possible to use up all available vectors before we set up all the
queues we wanted. By having rx and tx share a vector for a given queue we
could halve the number of vectors used by a given configuration. The problem
here is that with this change only e1000 passed the necessary value to have
the fast interrupt drive tx when appropriate.

Reported by: mav@
Tested by: mav@
Reviewed by:    gallatin@
MFC after:      1 month
Sponsored by:   iXsystems
Differential Revision:  https://reviews.freebsd.org/D27683
2021-01-07 14:07:35 -08:00