Commit graph

146 commits

Author SHA1 Message Date
Mark Johnston 9da1b6dc16 bxe: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Doug Moore b0056b31e9 libkern: add ilog2 macro
The kernel source contains several definitions of an ilog2 function;
some are slower than necessary, and one of them is incorrect.
Elimininate them all and define an ilog2 macro in libkern to replace
them, in a way that is fast, correct for all argument types, and, in a
GENERIC kernel, includes a check for an invalid zero parameter.

Folks at Microsoft have verified that having a correct ilog2
definition for their MANA driver doesn't break it.

Reviewed by:	alc, markj, mhorne (older version), jhibbits (older version)
Differential Revision:	https://reviews.freebsd.org/D45170
Differential Revision:	https://reviews.freebsd.org/D45235
2024-06-03 11:37:55 -05:00
Gordon Bergling e2f3649613 bxe(4): Fix two typos in a kernel messages
- s/successfull/successful/

MFC after:	3 days
2024-02-27 17:38:53 +01: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
Justin Hibbits 2a3716432d IfAPI: Retire if_etherbpfmtap() and if_bpfmtap()
Summary:
These came in the original DrvAPI commits in 2014, and are obsoleted by
bpf_mtap_if() and ether_bpf_mtap_if().  The `_if` suffix, rather than
prefix, conveys that it's operating on the bpf of the interface, instead
than the interface itself.

Reviewed by:	glebius
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D41146
2023-08-25 12:50:14 -04: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
Ed Maste ed2e50508c bxe: prefer C99 bool to boolean_t
Differential Revision:	https://reviews.freebsd.org/D20853
2023-05-01 16:23:39 -04:00
Zhenlei Huang 8bd9afe9e1 bxe(4): Use CTLFLAG_RDTUN flag definition
sysctl variables rx_budget and max_aggregation_size are read-only loader
tunable. Mark them with CTLFLAG_RD flag.

No functional change intended.

Reviewed by:	hselasky, erj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D39466
2023-04-12 12:20:38 +08: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
Gordon Bergling e902e62644 bxe(4): Fix a typo in a source code comment
- s/interrutps/interrupts/

MFC after:	3 days
2022-11-01 07:55:55 +01:00
Gordon Bergling 6e9e7b0583 bxe(4): Grammar fix for a source code comment
- s/that that/that the/

MFC after:	3 days
2022-09-04 17:43:15 +02:00
Gordon Bergling f93ef3ff06 bxe(4): Fix two typos in source code comments
- s/overriden/overridden/

MFC after:	3 days
2022-09-03 15:36:00 +02:00
Mitchell Horne 258958b3c7 ddb: use _FLAGS command macros where appropriate
Some command definitions were forced to use DB_FUNC in order to specify
their required flags, CS_OWN or CS_MORE. Use the new macros to simplify
these.

Reviewed by:	markj, jhb
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35582
2022-07-05 11:56:55 -03:00
John Baldwin b15b1fc193 bxe: Remove unused devclass argument to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
John Baldwin 583df2db5c bxe: Quiet set but not used warnings.
Comment out other references to more_tx since the only use is commented out.

Remove unused is_parity variable.
2022-04-06 16:45:28 -07:00
Gordon Bergling e443f2102e bxe(4): Fix a typo in an error message
- s/intergers/integers/

MFC after:	3 days
2022-04-02 08:56:06 +02:00
Mateusz Guzik 8117f96f24 bxe: plug some of set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-10 12:19:16 +00:00
Gleb Smirnoff 8a6f38c8ac ifnet: garbage collect drbr_*_drv().
They were left in 62d76917b8 but after years proved not to be useful.
2021-11-22 19:49:57 -08:00
Elyes HAOUAS 9097ac9af4 Fix typo on "Celsius"
"Celcius" --> "Celsius"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/551/files
2021-11-18 23:05:32 -07:00
Gordon Bergling 80abcfbdfe bxe(4): Fix a few common typos in source code comments
- s/controled/controlled/
- s/allignment/alignment/

MFC after:	3 days
2021-10-27 06:15:06 +02:00
Alexander Motin 4081c895e5 bxe(4): Mark sysctls and callout MP-safe.
MFC after:	1 month
2021-09-03 12:25:32 -04:00
Ed Maste c3295781fd bxe: tag files to skip clang-format formatting
bxe contains three files which are sets of constants or other data, and
might be auto-generated or have an upstream.  They are rather large
files and clang-format takes quite some time when run against them, so
just skip formatting.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27806
2021-08-16 10:48:44 -04:00
Gordon Bergling 646f3a36c8 Fix a typo that was introduced while fixing a typo
- s/enrtry/entry/

MFC after:	5 days
2021-08-14 14:30:59 +02:00
Gordon Bergling 86b74b7368 Fix a common typo in a comment
- s/enrty/entry/

MFC after: 5 days
2021-08-14 13:31:51 +02:00
Warner Losh 8b8af16875 Remove newline from bxe description, it's not done elsewhere. 2020-11-09 03:02:34 +00:00
Warner Losh f90045602b Remove support for ancient compilers
We don't support building the kernel from such old compilers, nor with
the Intel Compiler specifically. Remove support for this old construct
that was copied from stdbool.h and not relevant here.
2020-10-24 23:21:18 +00:00
Ed Maste aeb665b538 remove extraneous double ;s in sys/ 2020-03-30 16:04:25 +00:00
Warner Losh eab6ecc0ae Finish removing support from old versions
Eliminate code for old versions, inline pci_find_cap instead of relying on
compat ifdef.

This commit should have been combined with r358488 before pushing it in.
2020-03-01 18:17:51 +00:00
Warner Losh e602f0c85d Remove FreeBSD 7-10 support from bxe driver.
Use new PCIER and PCIEM names in the driver rather than relying on old, compat
shims.
2020-03-01 17:46:28 +00:00
Pawel Biernacki 7029da5c36 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2020-02-26 14:26:36 +00:00
Gleb Smirnoff 6c3e93cb5a Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process
incoming packets in taskqueue context.

Reviewed by:	hselasky
Differential Revision:	https://reviews.freebsd.org/D23518
2020-02-11 18:57:07 +00:00
Gleb Smirnoff 349ecfc38a Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:06:31 +00:00
Conrad Meyer 7790c8c199 Split out a more generic debugnet(4) from netdump(4)
Debugnet is a simplistic and specialized panic- or debug-time reliable
datagram transport.  It can drive a single connection at a time and is
currently unidirectional (debug/panic machine transmit to remote server
only).

It is mostly a verbatim code lift from netdump(4).  Netdump(4) remains
the only consumer (until the rest of this patch series lands).

The INET-specific logic has been extracted somewhat more thoroughly than
previously in netdump(4), into debugnet_inet.c.  UDP-layer logic and up, as
much as possible as is protocol-independent, remains in debugnet.c.  The
separation is not perfect and future improvement is welcome.  Supporting
INET6 is a long-term goal.

Much of the diff is "gratuitous" renaming from 'netdump_' or 'nd_' to
'debugnet_' or 'dn_' -- sorry.  I thought keeping the netdump name on the
generic module would be more confusing than the refactoring.

The only functional change here is the mbuf allocation / tracking.  Instead
of initiating solely on netdump-configured interface(s) at dumpon(8)
configuration time, we watch for any debugnet-enabled NIC for link
activation and query it for mbuf parameters at that time.  If they exceed
the existing high-water mark allocation, we re-allocate and track the new
high-water mark.  Otherwise, we leave the pre-panic mbuf allocation alone.
In a future patch in this series, this will allow initiating netdump from
panic ddb(4) without pre-panic configuration.

No other functional change intended.

Reviewed by:	markj (earlier version)
Some discussion with:	emaste, jhb
Objection from:	marius
Differential Revision:	https://reviews.freebsd.org/D21421
2019-10-17 16:23:03 +00:00
Xin LI 92e9c0608b Update bxe(4) to use new zlib.
PR:		229763
Submitted by:	Yoshihiro Ota <ota j email ne jp>
Differential Revision:	https://reviews.freebsd.org/D21175
2019-08-08 06:30:12 +00:00
David C Somayajulu 36baf17e54 Add support for Error Recovery
Submitted by:Vaishali.Kulkarni@cavium.com
Approved by:re(kib)
MFC after:5 days
2018-10-15 18:39:33 +00:00
David C Somayajulu 9d50798c61 Fixed isses:
State check before enqueuing transmit task in bxe_link_attn() routine.
 State check before invoking bxe_nic_unload in bxe_shutdown().

Submitted by:Vaishali.Kulkarni@cavium.com
Approved by:re(gjb)
2018-09-17 20:15:18 +00:00
David C Somayajulu 38b42191fb Fixes for the following issues:
1. Fix taskqueues drain/free to fix panic seen when interface is being
   bought down and in parallel asynchronous link events happening.

2. Fix bxe_ifmedia_status()

Submitted by:Vaishali.Kulkarni@cavium.com and Anand.Khoje@cavium.com
MFC after:5 days
2018-07-17 23:56:13 +00:00
Dimitry Andric 48f00bafa1 Fix build of bxe with base gcc on i386
Casting from rman_res_t to a pointer results in "cast to pointer from
integer of different size" warnings with base gcc on i386, so print
these without casting.  The kva field of struct bxe_bar is of type
vm_offset_t, which can be 32 or 64 bit, so cast it to uintmax_t before
printing.

Reviewed by:	markj
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D15733
2018-06-11 10:08:22 +00:00
Matt Macy d7c5a620e2 ifnet: Replace if_addr_lock rwlock with epoch + mutex
Run on LLNW canaries and tested by pho@

gallatin:
Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5
based ConnectX 4-LX NIC, I see an almost 12% improvement in received
packet rate, and a larger improvement in bytes delivered all the way
to userspace.

When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,
I see, using nstat -I mce0 1 before the patch:

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
4.98   0.00   4.42   0.00 4235592     33   83.80 4720653 2149771   1235 247.32
4.73   0.00   4.20   0.00 4025260     33   82.99 4724900 2139833   1204 247.32
4.72   0.00   4.20   0.00 4035252     33   82.14 4719162 2132023   1264 247.32
4.71   0.00   4.21   0.00 4073206     33   83.68 4744973 2123317   1347 247.32
4.72   0.00   4.21   0.00 4061118     33   80.82 4713615 2188091   1490 247.32
4.72   0.00   4.21   0.00 4051675     33   85.29 4727399 2109011   1205 247.32
4.73   0.00   4.21   0.00 4039056     33   84.65 4724735 2102603   1053 247.32

After the patch

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
5.43   0.00   4.20   0.00 3313143     33   84.96 5434214 1900162   2656 245.51
5.43   0.00   4.20   0.00 3308527     33   85.24 5439695 1809382   2521 245.51
5.42   0.00   4.19   0.00 3316778     33   87.54 5416028 1805835   2256 245.51
5.42   0.00   4.19   0.00 3317673     33   90.44 5426044 1763056   2332 245.51
5.42   0.00   4.19   0.00 3314839     33   88.11 5435732 1792218   2499 245.52
5.44   0.00   4.19   0.00 3293228     33   91.84 5426301 1668597   2121 245.52

Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch

Reviewed by:	gallatin
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15366
2018-05-18 20:13:34 +00:00
Mark Johnston b4fa90d6f9 Fix bxe(4) netdump rx polling.
Reviewed by:	cem, rstone
X-MFC with:	r333287
Sponsored by:	Dell EMC Isilon
2018-05-09 19:54:34 +00:00
Mark Johnston 6eadb68b14 Add netdump support to bxe(4).
Tested with a NetXtreme II BCM57810 adapter.

Reviewed by:	davidcs
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D15257
2018-05-06 00:47:39 +00:00
David C Somayajulu cbbd5be004 Fix Issue with adding MUltiCast Addresses. When multicast addresses are
added/deleted, the delete the multicast addresses previously programmed
in HW and reprogram the new set of multicast addresses.

Submitted by:Vaishali.Kulkarni@cavium.com
MFC after:5 days
2018-04-25 18:06:22 +00:00
Pedro F. Giffuni c93a33340f dev/bxe: make use of mallocarray(9).
Use mallocarray in a couple of cases where a calloc-like operation is
taking place.
2018-01-10 20:05:19 +00:00
Pedro F. Giffuni 7282444b10 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:36:21 +00:00
Andrey V. Elsukov 27a8713f74 Add HPE FlexFabric 10Gb 4-port 536FLR-T device id to the bxe(4) driver.
Tested by:	David Miguel Almas <dmalmas gmail com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D11478
2017-07-19 14:21:29 +00:00
David C Somayajulu 7a1297c821 1. state checks in bxe_tx_mq_start_locked() and bxe_tx_mq_start() to sync threads during interface down or detach.
2. add sysctl to set pause frame parameters
3. increase max segs for TSO packets to BXE_TSO_MAX_SEGMENTS (32)
4. add debug messages for PHY
5. HW LRO support restricted to FreeBSD versions 8.x and above.

Submitted by:Vaishali.Kulkarni@cavium.com
MFC after:5 days
2017-02-27 23:38:51 +00:00
Roger Pau Monné f33f887e94 bxe: enable usage with NetXtreme II BCM57840 2x20GbE chip
Current bxe probe function won't attach to devices with the NetXtreme II
BCM57840 2x20GbE chip, enable it by adding it's chip ID to the list of
supported chips.

Tested on:		HP ProLiant WS460c Gen9
Reviewed by:		gnn
MFC after:		1 week
Sponsored by:		Citrix Systems R&D
Differential Revision:	https://reviews.freebsd.org/D9609
2017-02-15 14:34:40 +00:00
Sean Bruno 4f3a4c0163 r266979 missed a call to enable capabilities of the hw leading to an
inability to enable features of the device.

PR:             213845
Submitted by:   pherman@frenchfries.net
MFC after:      1 week
2016-11-05 16:17:07 +00:00
Bryan Drewery 1648616981 Use proper if_getdrvflags() API.
This is a NOP.

Sponsored by:	Dell EMC Isilon
2016-10-25 03:55:56 +00:00
David C Somayajulu c7873d969c 1. Use taskqueue_create() instead of taskqueue_create_fast() for both
fastpath and slowpath taskqueues.
2. Service all transmits in taskqueue threads.
3. additional stats counters for  keeping track of
	- bd availability
	- tx buf ring not emptied in the fp task queue.
	  These are drained via timeout taskqueue.
	- tx attempts during link down.

MFC after: 5 days
2016-10-18 21:33:57 +00:00