Commit Graph

66 Commits

Author SHA1 Message Date
Andrew Rybchenko
6da0beb5ac sfxge: add assertions that required event handlers are implemented
efx_ev_mcdi() does not assert or check that all event handlers it
calls are non-null.  Add assertions at the top for all required
event handlers, as some events (in the case of this bug, monitor
events) are rare.

Submitted by:   Ben Hutchings
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 19:42:05 +00:00
Andrew Rybchenko
612d8e2828 sfxge: style fixes
Use nitem() to get number of array elements.
Remove unused define.
Use TAB to indent.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 19:39:40 +00:00
Andrew Rybchenko
9bdc809c17 sfxge: regenerate sensor map
Add Florence R7 and Modena sensors.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 19:37:10 +00:00
Andrew Rybchenko
8bf93a0428 sfxge: add Florence R7 turbo mode support to common code
Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 07:57:59 +00:00
Andrew Rybchenko
9013400b1c sfxge: regenerate MCDI protocol headers
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 07:54:35 +00:00
Andrew Rybchenko
b2c43c38e7 sfxge: handle fragmented TCP header in mbuf
TCP header is fragmented in the case of VLAN tagged IPv6 traffic without
HW VLAN tagging.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-20 07:53:46 +00:00
Andrew Rybchenko
d8574f4f45 sfxge: fix broken MCDI_EV_FIELD() macro
Submitted by:   Andrew Lee <alee at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-18 06:26:07 +00:00
Andrew Rybchenko
1f69766845 sfxge: support variable-length response to MCDI GET_BOARD_CFG
Allocate the minimum or maximum response length for GET_BOARD_CFG as
appropriate.  When looking up firmware subtypes by partition ID,
check the ID against the actual response length.

Merge of the patch made by Ben Hutchings in 2011.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-18 06:23:16 +00:00
Andrew Rybchenko
097de6f518 sfxge: add driver context member with number of event queues
Mainly to unify with similar member for transmit and receive queues.
It will be used in the future for resources allocation processing.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-18 06:21:59 +00:00
Andrew Rybchenko
133366a6e5 sfxge: add driver context member with number of receive queues
Mainly to unify with similar member for transmit queues.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-18 06:20:59 +00:00
Andrew Rybchenko
e2b05fe21c sfxge: add driver context member with number of transmit queues
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-18 06:19:35 +00:00
Andrew Rybchenko
d0f7387777 sfxge: add TCP segment size to sfxge_tso_state
It avoids access to m_pkthdr when TSO packet is started and also makes
tso_start_new_packet() function smaller.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-18 06:18:51 +00:00
Andrew Rybchenko
2cd617a883 sfxge: flush all Tx queues from if_qflush
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor), glebius
2015-02-16 06:16:38 +00:00
Andrew Rybchenko
0ff2378988 sfxge: style fixes
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-16 06:12:04 +00:00
Andrew Rybchenko
d67580d164 sfxge: SYSCTL_IN/OUT should not be called with non-sleepable lock held
The problem is found using WITNESS option enabled.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-16 06:10:17 +00:00
Andrew Rybchenko
0b28bbdca9 sfxge: remove inline specifiers
Now compiler does not need any help.
The patch does not change generated code.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor), glebius
2015-02-16 06:08:13 +00:00
Andrew Rybchenko
fd59fc3478 sfxge: remove used sfxge_tso_state member dma_seg_i
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-16 06:07:01 +00:00
Andrew Rybchenko
3f1e3499ed sfxge: remove full_packet_size from sfxge_tso_state
It makes sfxge_tso_state smaller and even makes tso_start_new_packet()
few bytes smaller. Data used to calculate packet size are used nearby,
so it should be no problems with cache etc.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor), glebius
2015-02-16 06:04:26 +00:00
Andrew Rybchenko
c9795115dc sfxge: remove unused variable
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor), glebius
2015-02-16 06:00:43 +00:00
Andrew Rybchenko
e1a3d10e9e sfxge: Add statistics for partially dropped TSO packets
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-05 12:10:23 +00:00
Andrew Rybchenko
0f999687bb sfxge: using 64-bit access for x86-64
Submitted by:   Artem V. Andreev <Artem.Andreev at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-05 12:08:25 +00:00
Andrew Rybchenko
33d45dc5e4 sfxge: make lock names unique
Lock name should include interface name.
Tx queue and event queue lock name should include queue number.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-05 11:39:15 +00:00
Andrew Rybchenko
d8e7a280bb sfxge: access statistics buffers under port lock
Allow access to statistics data not only from sysctl handlers.

Submitted by:   Boris Misenov <Boris.Misenov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-05 11:37:07 +00:00
Andrew Rybchenko
763cab7173 sfxge: Add macros to init, destroy, acquire, release and assert locks
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-04 20:03:57 +00:00
Andrew Rybchenko
7c00963a55 sfxge: Implement EFSYS_MEM_READ_BARRIER()
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-02-04 19:58:54 +00:00
Andrew Rybchenko
93929f253d sfxge: Separate software Tx queue limit for non-TCP traffic
Add separate software Tx queue limit for non-TCP traffic to make total
limit higher and avoid local drops of TCP packets because of no
backpressure.
There is no point to make non-TCP limit high since without backpressure
UDP stream easily overflows any sensible limit.

Split early drops statistics since it is better to have separate counter
for each drop reason to make it unabmiguous.

Add software Tx queue high watermark. The information is very useful to
understand how big queues grow under traffic load.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 19:11:37 +00:00
Andrew Rybchenko
d9e49c8352 sfxge: implemented parameter to restrict RSS channels
Submitted by:   Artem V. Andreev <Artem.Andreev at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 19:09:14 +00:00
Andrew Rybchenko
745714c104 sfxge: Use SFXGE_MODERATION to initialize event moderation
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 19:06:14 +00:00
Andrew Rybchenko
123b769617 sfxge: Pass correct address to free allocated memory in the case of load error
Most likely is was just memory leak on the error handling path since
typically efsys_mem_t is filled in by zeros on allocation.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 19:04:42 +00:00
Andrew Rybchenko
495d35b1d7 sfxge: Remove unused esm_size member of the efsys_mem_t structure
esm_size is not even initialized properly when memory is allocated.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 19:03:33 +00:00
Andrew Rybchenko
8402a8688e sfxge: Do not bzero() DMA allocated memory once again
sfxge_dma_alloc() calls bus_dmamem_alloc() with BUS_DMA_ZERO flag, so
allocated memory is already filled in by zeros

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 19:02:25 +00:00
Andrew Rybchenko
cc933626d4 sfxge: Add evq argument to sfxge_tx_qcomplete()
It removes necessity to get evq pointer by its index in soft context.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 19:01:09 +00:00
Andrew Rybchenko
a35485aa72 sfxge: fixed TSO code to cope with VLAN headers
Submitted by:   Artem V. Andreev <Artem.Andreev at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 18:59:22 +00:00
Andrew Rybchenko
76c8553679 sfxge: Remove extra cache-line alignment and reorder sfxge_evq_t
Remove the first member alignment to cacheline since it is nop.
Use __aligned() for the whole structure to make sure that the structure
size is cacheline aligned.
Remove lock alignment to make the structure smaller and fit all members
used on event queue processing into one cacheline (128 bytes) on x86-64.
The lock is obtained as well from different context when event queue
statistics are retrived from sysctl context, but it is infrequent.
Reorder members to avoid padding and go in usage order on event
processing.
As the result all structure members used on event queue processing fit
into exactly one cacheline (128 byte) now.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 18:57:27 +00:00
Andrew Rybchenko
fe9000816a sfxge: Make it possible to build without EVQ statistics
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 18:54:43 +00:00
Andrew Rybchenko
e5e313603c sfxge: Move txq->next pointer to part writable on completion path
In fact the pointer is used only if more than one TXQ is processed in
one interrupt.
It is used (read-write) on completion path only.
Also it makes the first part of the structure smaller and it fits now
into one 128byte cache line. So, TXQ structure becomes 128 bytes smaller.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 18:52:33 +00:00
Andrew Rybchenko
b64af6b0fb sfxge: Change sfxge_ev_qpoll() proto to avoid EVQ pointers array access
It was the only place on data path where sc->evq array is accessed.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
2015-01-29 18:50:25 +00:00
Hans Petter Selasky
c25290420e Start process of removing the use of the deprecated "M_FLOWID" flag
from the FreeBSD network code. The flag is still kept around in the
"sys/mbuf.h" header file, but does no longer have any users. Instead
the "m_pkthdr.rsstype" field in the mbuf structure is now used to
decide the meaning of the "m_pkthdr.flowid" field. To modify the
"m_pkthdr.rsstype" field please use the existing "M_HASHTYPE_XXX"
macros as defined in the "sys/mbuf.h" header file.

This patch introduces new behaviour in the transmit direction.
Previously network drivers checked if "M_FLOWID" was set in "m_flags"
before using the "m_pkthdr.flowid" field. This check has now now been
replaced by checking if "M_HASHTYPE_GET(m)" is different from
"M_HASHTYPE_NONE". In the future more hashtypes will be added, for
example hashtypes for hardware dedicated flows.

"M_HASHTYPE_OPAQUE" indicates that the "m_pkthdr.flowid" value is
valid and has no particular type. This change removes the need for an
"if" statement in TCP transmit code checking for the presence of a
valid flowid value. The "if" statement mentioned above is now a direct
variable assignment which is then later checked by the respective
network drivers like before.

Additional notes:
- The SCTP code changes will be committed as a separate patch.
- Removal of the "M_FLOWID" flag will also be done separately.
- The FreeBSD version has been bumped.

MFC after:	1 month
Sponsored by:	Mellanox Technologies
2014-12-01 11:45:24 +00:00
George V. Neville-Neil
974577b5cd Fixup the setting of the baud rate. 2014-10-02 22:05:48 +00:00
George V. Neville-Neil
f857a2b4a0 Properly handle a case that should never happen (the bus_dma
callback being called with error set to non-zero).
2014-10-02 15:03:51 +00:00
George V. Neville-Neil
060a95ef01 Support tunable to control Tx deferred packet list limits
Also increase default for Tx queue get-list limit.
Too small limit results in TCP packets drops especiall when many
streams are running simultaneously.
Put list may be kept small enough since it is just a temporary
location if transmit function can't get Tx queue lock.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
2014-09-30 20:57:25 +00:00
George V. Neville-Neil
bc85c897c7 The patch allows to check state of the software Tx queues at run time.
Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
2014-09-30 20:43:21 +00:00
George V. Neville-Neil
385b1d8e67 Make size of Tx and Rx rings configurable
Required size of event queue is calculated now.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
2014-09-30 20:36:07 +00:00
George V. Neville-Neil
b7b0edd17c cleanup: code style fixes
Remove trailing whitespaces and tabs.
Enclose value in return statements in parentheses.
Use tabs after #define.
Do not skip comparison with 0/NULL in boolean expressions.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
2014-09-30 20:18:10 +00:00
George V. Neville-Neil
092a178372 Check that port is started when MAC filter is set
The MAC filter set may be called without softc_lock held in the case of
SIOCADDMULTI and SIOCDELMULTI ioctls. The ioctl handler checks IFF_DRV_RUNNING
flag which implies port started, but it is not guaranteed to remain.
softc_lock shared lock can't be held in the case of these ioctls processing,
since it results in failure where kernel complains that non-sleepable
lock is held in sleeping thread.

Both problems are repeatable on LAG with LACP proto bring up.

Submitted by:   Andrew Rybchenko <Andrew.Rybchenko at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.

MFC after:	2 weeks
2014-04-22 20:19:09 +00:00
George V. Neville-Neil
cf07c70df7 Commit various fixes for the SolarFlare drivers, in particular
this set of patches fixes support for systems with > 32 cores.

Details include

sfxge: RXQ index (not label) comes from FW in flush done/failed events

Change the second argument name of the efx_rxq_flush_done_ev_t and
efx_rxq_flush_failed_ev_t prototypes to highlight that RXQ index (not label)
comes from FW in flush done and failed events.

sfxge: TXQ index (not label) comes from FW in flush done event

Change the second argument name of the efx_txq_flush_done_ev_t prototype to
highlight that TXQ index (not label) comes from FW in flush done event.

sfxge: use TXQ type as label to support more than 32 TXQs

There are 3 TXQs in event queue 0 and 1 TXQ (with TCP/UDP checksum offload)
in all other event queues.

Submitted by:	Andrew Rybchenko <Andrew.Rybchenko at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
2014-04-14 16:31:56 +00:00
Gleb Smirnoff
c1974e298d sfxge: limit software Tx queue size.
Previous implementation limits put queue size only (when Tx lock can't
be acquired), but get queue may grow unboundedly which results in mbuf
pools exhaustion and latency growth.

Submitted by:	Andrew Rybchenko <Andrew.Rybchenko at oktetlabs.ru>
Sponsored by:	Solarflare Communications, Inc.
2014-03-22 18:24:44 +00:00
Gleb Smirnoff
d7ac87d3a3 Add counter for Tx errors returned from if_transmit.
Submitted-by:	Boris Misenov <Boris.Misenov@oktetlabs.ru>
Sponsored by:	Solarflare Communications, Inc.
2014-03-19 06:03:26 +00:00
George V. Neville-Neil
10d0bdca87 fix mbuf leak if it does not fit in software queue
mbuf should be owned by if_transmit function in any case.

Submitted-by:   Andrew Rybchenko <Andrew.Rybchenko at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
2014-03-18 15:01:32 +00:00
Gleb Smirnoff
91350e5cd6 Return error when packet is dropped because of link down.
Submitted-by:	Boris Misenov <Boris.Misenov@oktetlabs.ru>
Sponsored by:	Solarflare Communications, Inc.
2014-03-18 12:50:22 +00:00