Commit Graph

112 Commits

Author SHA1 Message Date
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
David C Somayajulu
106961b640 Revert commit
r306284 - Fixes for issues under high workloads

Will fix and recommit patch
2016-09-30 18:08:16 +00:00
David C Somayajulu
678b8d82ee Fixes for issues under high workloads
MFC after:5 days
2016-09-23 23:18:54 +00:00
Pedro F. Giffuni
f0be707d74 sys/dev: replace comma with semicolon when pertinent.
Uses of commas instead of a semicolons can easily go undetected. The comma
can serve as a statement separator but this shouldn't be abused when
statements are meant to be standalone.

Detected with devel/coccinelle following a hint from DragonFlyBSD.

MFC after:	1 month
2016-08-09 19:41:46 +00:00
Ryan Stone
f57637a47b Don't enqueue NULL on a drbr
In one corner case in the bxe TX path, a NULL mbuf could be enqueued onto
a drbr queue.  This could case a KASSERT to fire with INVARIANTS enabled,
or the processing of packets from the queue to be prematurely ended later
on.

Submitted by:	Matt Joras (matt.joras AT isilon.com)
Reviewed by:	davidcs
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7041
2016-08-08 16:19:24 +00:00
Eitan Adler
cef367e6a1 Don't repeat the the word 'the'
(one manual change to fix grammar)

Confirmed With: db
Approved by: secteam (not really, but this is a comment typo fix)
2016-05-17 12:52:31 +00:00
Scott Long
dde1276e8e Don't jam the softc in the device_probe routine. The softc isn't owned by
the driver here, so it shouldn't be accessed, let alone written to.  Remove
the nearby debug line, it's the only thing that depended on the softc, and
it depended on it in a way that couldn't work in this part of the code.

This fixes some reports of use-after-free and system instability with
DEBUG_MEMGUARD enabled.

Submitted by:	Matthew Macy
MFC after:	3 days
2016-05-13 05:57:21 +00:00
Pedro F. Giffuni
453130d9bf sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
2016-05-03 03:41:25 +00:00
David C Somayajulu
05c6aa727f 1. Removed -Wno-shift-negative-value from Makefile
2. Fixed warning its absence caused in bxe_elink.c

MFC after:5 days
2016-04-25 18:55:01 +00:00
David C Somayajulu
e5baa39aec Remove Unused/Dead Code
MFC after:5 days
2016-04-23 01:22:12 +00:00
David C Somayajulu
6f39c760f8 1. modify fwdump (a.k.a grcdump) so that grcdump memory is allocated
and freed on as needed basis.
2. grcdump can be taken at failure points by invoking bxe_grc_dump()
   when trigger_grcdump sysctl flag is set. When grcdump is taken
   grcdump_done sysctl flag is set.
3. grcdump_done can be monitored by the user to retrieve the grcdump.

Submitted by:vaishali.kulkarni@qlogic.com
2016-04-19 20:28:30 +00:00
David C Somayajulu
3e8a5445e5 reversed commits r297916 r297909 r297898 due to i386 build failures.
MFC after:5 days
2016-04-13 13:14:18 +00:00
David C Somayajulu
9f4d1b488f Fix compilation error on i386 2016-04-13 11:24:24 +00:00
David C Somayajulu
9bca1d24f4 Fix build failure on i386. Need to typecast a bunch of variables to (uintmax_t)
MFC after:5 days
2016-04-13 04:13:36 +00:00
David C Somayajulu
6dbd80fa74 1. modify fwdump (a.k.a grcdump) memory is allocated and freed on as needed
basis.
2. grcdump can be taken at failure points by invoking bxe_grc_dump() when
   trigger_grcdump sysctl flag is set. When grcdump is taken grcdump_done
   sysctl flag is set.
3. grcdump_done can be monitored by the user to retrieve the grcdump.

Submitted by:vaishali.kulkarni@qlogic.com
Approved by:davidcs@freebsd.org
MFC after:5 days
2016-04-13 00:53:04 +00:00
David C Somayajulu
6ba5a1d9ee Add support for Flash Update
Submitted by:nrapendra.singh@qlogic.com;vaishali.kulkarni@qlogic.com;davidcs@freebsd.org
Approved by:davidcs@freebsd.org
MFC after:5 days
2016-04-12 22:31:48 +00:00
David C Somayajulu
b1d4590283 1. Process tx completions in bxe_periodic_callout_func() and restart
transmissions if possible.
2. For SIOCSIFFLAGS call bxe_init_locked() only if !BXE_STATE_DISABLED
3. remove code not needed in bxe_init_internal_common()

Submitted by:vaishali.kulkarni@qlogic.com;venkata.bhavaraju@qlogic.com
Approved by:davidcs@freebsd.org
MFC after:5 days
2016-04-12 21:00:38 +00:00
Pedro F. Giffuni
74b8d63dcc Cleanup unnecessary semicolons from the kernel.
Found with devel/coccinelle.
2016-04-10 23:07:00 +00:00
David C Somayajulu
32020557a6 Modifications to achieve a common source base from FreeBSD7.x thru 10.x
MFC after:5 days
2016-03-21 18:48:20 +00:00
Justin Hibbits
da1b038af9 Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.
On some architectures, u_long isn't large enough for resource definitions.
Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but
type `long' is only 32-bit.  This extends rman's resources to uintmax_t.  With
this change, any resource can feasibly be placed anywhere in physical memory
(within the constraints of the driver).

Why uintmax_t and not something machine dependent, or uint64_t?  Though it's
possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on
32-bit architectures.  64-bit architectures should have plenty of RAM to absorb
the increase on resource sizes if and when this occurs, and the number of
resources on memory-constrained systems should be sufficiently small as to not
pose a drastic overhead.  That being said, uintmax_t was chosen for source
clarity.  If it's specified as uint64_t, all printf()-like calls would either
need casts to uintmax_t, or be littered with PRI*64 macros.  Casts to uintmax_t
aren't horrible, but it would also bake into the API for
resource_list_print_type() either a hidden assumption that entries get cast to
uintmax_t for printing, or these calls would need the PRI*64 macros.  Since
source code is meant to be read more often than written, I chose the clearest
path of simply using uintmax_t.

Tested on a PowerPC p5020-based board, which places all device resources in
0xfxxxxxxxx, and has 8GB RAM.
Regression tested on qemu-system-i386
Regression tested on qemu-system-mips (malta profile)

Tested PAE and devinfo on virtualbox (live CD)

Special thanks to bz for his testing on ARM.

Reviewed By: bz, jhb (previous)
Relnotes:	Yes
Sponsored by:	Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D4544
2016-03-18 01:28:41 +00:00
David C Somayajulu
988f26f9ff Fix code so that buf_ring allocation for Tx Queues and their mutexes
is done during during bxe_attach() and freed during bxe_detach()

MFC after: 5 days
2016-03-09 21:12:26 +00:00
John Baldwin
cbc4d2db75 Remove taskqueue_enqueue_fast().
taskqueue_enqueue() was changed to support both fast and non-fast
taskqueues 10 years ago in r154167.  It has been a compat shim ever
since.  It's time for the compat shim to go.

Submitted by:	Howard Su <howard0su@gmail.com>
Reviewed by:	sephe
Differential Revision:	https://reviews.freebsd.org/D5131
2016-03-01 17:47:32 +00:00
David C Somayajulu
4ef8ebfd62 Upgrade the firmware carried in driver and loaded during hardware
initialization (a.k.a STORM firmware) to version 7.13.1 (latest version)
2016-02-25 22:44:00 +00:00
David C Somayajulu
bb329d4b5a Remove dead code. Code Cleanup. Improve clarity in debug messages
MFC after:5 days
2016-02-19 22:46:52 +00:00
David C Somayajulu
34b133bcd5 Modified the use of bxe_grc_dump() function so that it can be invoked directly at any potential error path, where a fwdump is needed. The fwdump (a.k.a grcdump) is stored in a driver buffer. The sysctl grcdump_done indicates if a fwdump was taken and waiting to be retrieved.
The sysctl trigger_grcdump can be used to manually trigger a fwdump.

MFC after:5 days
2016-02-19 21:32:49 +00:00
David C Somayajulu
29e6019890 Add support for firmware dump (a.k.a grcdump)
MFC after:5 days
2015-12-23 03:19:12 +00:00
David C Somayajulu
6dbbc5f655 Check for packet_length is greater than 60 bytes as well as packet_length is
greater than len_on_bd, before invoking the routine to handle jumbo over SGL
(bxe_service_rxsgl()).
Add counters for number of jumbo_over_SGL packets (rx_bxe_service_rxsgl) and
erroneous jumbo_over_SGL packets (rx_erroneous_jumbo_sge_pkts)

Fix formatting in bxe_sysctl_state()

MFC after:5 days
2015-12-23 01:31:32 +00:00
David C Somayajulu
56c55e6513 Add support for reading device temperature
MFC after:5 days
2015-10-12 20:21:17 +00:00
Dimitry Andric
5bf328b6f4 Avoid left-shifting negative signed values in bxe(4).
Reviewed by:	davidcs
MFC after:	3 days
2015-08-13 18:24:41 +00:00
David C Somayajulu
ab97207add - Avoid lock contention in the if_transmit callback by using trylock and
enqueueing the frames when it fails. This way there is some latency
 removed from the transmitting path.
- If IFF_DRV_OACTIVE is set (and also if IFF_DRV_RUNNING is not) just
 enqueue the desired frames and return successful transmit. This way we
 avoid to return errors on transmit side and resulting in
 possible out-of-order frames. Please note that IFF_DRV_OACTIVE is set
 everytime we get the threshold ring hit, so this can be happening quite
 often.

Submitted by:	Attilio.Rao@isilon.com
MFC after:5 days
2015-07-28 19:15:44 +00:00
David C Somayajulu
c197bf4fe1 tx_mtx should be grabbed before calling buf_ring_dequeue_sc()
Submitted by:Attilio.Rao@isilon.com
MFC after:5 days
2015-06-23 20:09:52 +00:00
David C Somayajulu
284d94cfc8 Simplified implementation of bxe_set_mc_list()
removed bxe_free_mcast_macs_list() and bxe_init_mcast_macs_list()
fixed bug where copy of multicast list mta was deleted prior to passing the list to firmware

MFC after:5 days
2015-06-20 22:24:44 +00:00
David C Somayajulu
9987f30536 In bxe_init_mcast_macs_list(): mc_mac->mac needs to point to the multicast mac address
In bxe_set_mc_list(): added missing BXE_MCAST_UNLOCK()
In __ecore_vlan_mac_h_exec_pending(): need to check for ECORE_PENDING

Submitted by:gary.zambrano@qlogic.com
2015-06-16 21:11:32 +00:00
David C Somayajulu
04e9541d02 PHY LOCK acquires the hardware lock via bxe_acquire_phy_lock() and releases it via bxe_release_phy_lock(). It was simply acquiring a mutex earlier which can cause the PHY to use bogus values. Fixes intermittent link failures.
bxe_ioctl() completes all functions within its context as opposed to a taskqueue earlier.

bxe_handle_rx_mode_tq() no longer required. bxe_set_rx_mode() handles the functionality within its context

Submitted by:gary.zambrano@qlogic.com
MFC after:5 days
2015-06-13 01:28:19 +00:00
David C Somayajulu
bfdeba0cb3 Add stat counters for Jumbo Frames using SGE ring.
Also remove the checks for IFCAP_LRO in bxe_alloc_fp_buffers() and bxe_pf_rx_q_prep() since both TPA and Jumbo can use SGE ring.

Submitted by:gary.zambrano@qlogic.com
Approved by:davidcs@freebsd.org
MFC after:5 days
2015-05-22 01:44:07 +00:00