Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_mcx.c
RevisionDateAuthorComments
 1.29  07-Jul-2024  msaitoh mcx(4): Match on ConnectX-6 virtual functions, too. From OpenBSD.
 1.28  05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.27  11-Apr-2024  andvar branches: 1.27.2;
mcx(4): enforce full-duplex mark in mcx_media_status(), when link is up.

LACP protocol requires full-duplex to be enabled for lagg(4) to work,
however mcx(4) was not setting this capability making it to fail.

Fixes PR kern/58124. OK'd by msaitoh@
 1.26  26-Oct-2023  msaitoh mcx(4): Add Mellanox ConnectX-6 Lx from OpenBSD.
 1.25  28-Aug-2022  skrll branches: 1.25.4;
Empty if_watchdog functions are useless and now waste resources. Let's
remove them.
 1.24  07-Jul-2022  skrll Trailing whitespace
 1.23  05-Nov-2021  andvar mcx(4): ensure that RQT size is always a power of two.
Fixes PR kern/56484.
Thanks riastradh for the power of two patch :). OK: mrg, jmcneill, riastradh.
 1.22  26-Sep-2021  jmcneill Enable checksum offload features by default.
 1.21  26-Sep-2021  jmcneill We are not mapping registers prefetchable so no need for explicit bs
barriers.
 1.20  25-Sep-2021  jmcneill Sync with OpenBSD r1.101:

When processing a received packet, only sync the amount of bytes
mcx(4) told us has arrived. The DMA map's mapsize on RX packets
is the length of the allocated buffer. For mcx(4), this can be
more than around 9000 bytes, as each buffer will be at least as
big as the maximum supported MTU. There's no need to sync the
whole buffer, if it's only a small packet.
 1.19  20-Sep-2021  jmcneill Use coherent DMA mappings when possible.
 1.18  24-Jul-2021  andvar s/structres/structures + s/whenver/whenever
 1.17  20-Feb-2021  jmcneill branches: 1.17.4;
Sync with OpenBSD r1.99:

move the rearming of the cq after the refill of the rq.

this is the only real diff we have left outstanding on a box that
experienced rx lockups. since adding this change it's been happy
for the last 4 weeks and counting so far.
 1.16  05-Feb-2021  jmcneill mcx: Add if_transmit callback to enable more than one tx queue
 1.15  30-Jan-2021  jmcneill Sync with OpenBSD r1.98. Lots of improvements including checksum offload,
hardware vlan tagging, and support for multiple receive queues.
 1.14  25-May-2020  jmcneill branches: 1.14.2;
Add __KERNEL_RCSID
 1.13  24-Apr-2020  jmcneill mcx: sync with OpenBSD sys/dev/pci/if_mcx.c r1.44

1.44:
Fix typo which could lead into a double free

1.43:
Commands that create objects return a 24 bit object ID, so mask off the
high 8 bits of the value we extract, in case the firmware leaves junk there.
Hrvoje Popovski has seen this with newer firmware on a ConnectX 5 card,
which now works properly.

1.42:
Increase the completion queue size to prevent overflow. Under reasonably
unlikely circumstances - lots of single-fragment packets being sent, a
significant number of packets being received, while the interrupt handler
was unable to process the completion queue - the completion queue could
overflow, which would result in the interface locking up.

1.41:
Check if we've reached the end of the current mailbox before writing past
the end of it, rather than after. Now we can actually allocate queues
big enough to need multiple mailboxes.

1.40:
Don't call mcx_intr() from mcx_cmdq_poll(); this was a leftover from early
development that I forgot about, but turns out to be a potential race with
the actual interrupt handler.

1.39:
fix previous: use the correct offset for sq/rq creation, and don't
reset the mbox counter to 0 after calculating it.

1.38:
Add a helper function for writing physical addresses for queues into
command queue mailboxes, and use this for all queue setup commands.
Previously we just assumed the addresses would fit in the first mailbox,
which is currently true but may not be for much longer.

1.37:
(skipped)

1.36:
The event queue consumer counter also needs to be unsigned like the others.

1.35:
try to make if_baudrate look plausible.
this updates the eth proto capability map so it records the baudrate
against the different link types and their media, and then reads
it when the link state changes.

1.34:
(skipped)
 1.12  15-Mar-2020  thorpej branches: 1.12.2; 1.12.4;
Define and implement a locking protocol for the ifmedia / mii layers:
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
access to media-related structures / hardware regsiters. Converted
drivers use the new ifmedia_init_with_lock() function for this. The
new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
a compatibility lock to be used instead. Several media-related entry
points must be aware of this compatibility lock, and are able to acquire
it recursively a limited number of times, if needed. This is a SPIN
mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
MII-related data structures.

The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.

The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.

USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.

Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.

mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex. The mcx driver still needs to be fully converted to
NET_MPSAFE.
 1.11  29-Feb-2020  thorpej Use the 64-bit PCI DMA tag if available. Otherwise, we are needlessly
allocating (and using) bounce buffers on sytems with >4GB of RAM.

XXX pullup-9
 1.10  30-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.9  29-Nov-2019  msaitoh branches: 1.9.2;
Set if_baudrate.
 1.8  28-Nov-2019  msaitoh - Change IFM_10G_T(10GBase-T) entry to IFM_10G_CR1(10GBASE-CR1)
- Add the following entries:

20GBASE-KR2
56GBASE-R4
100GBASE-LR4
100BaseTX
1000baseT
10GBase-T
 1.7  26-Nov-2019  jmcneill Fix IFF_ALLMULTI handling.
 1.6  18-Nov-2019  nonaka Fixed incorrect m_defrag return value check.
 1.5  17-Oct-2019  msaitoh Use unsigned to avoid undefined behavior. Found by kUBSan.
 1.4  28-Sep-2019  tnn len -> m_len
 1.3  28-Sep-2019  tnn mcx(4): fix rx mbuf DMA overrun

pullup-9
 1.2  24-Sep-2019  msaitoh Use IFM_50G_SR2.
 1.1  21-Sep-2019  jmcneill branches: 1.1.2;
Add support for Mellanox 5th generation ethernet devices. This driver
supports the ConnectX-4 Lx EN, ConnectX-4 EN, ConnectX-5 EN, and
ConnectX-6 EN adapters.

Driver ported from OpenBSD.
 1.1.2.10  28-Apr-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #858):

sys/dev/pci/if_mcx.c: revision 1.13

mcx: sync with OpenBSD sys/dev/pci/if_mcx.c r1.44

1.44:
Fix typo which could lead into a double free

1.43:
Commands that create objects return a 24 bit object ID, so mask off the
high 8 bits of the value we extract, in case the firmware leaves junk there.
Hrvoje Popovski has seen this with newer firmware on a ConnectX 5 card,
which now works properly.

1.42:
Increase the completion queue size to prevent overflow. Under reasonably
unlikely circumstances - lots of single-fragment packets being sent, a
significant number of packets being received, while the interrupt handler
was unable to process the completion queue - the completion queue could
overflow, which would result in the interface locking up.

1.41:
Check if we've reached the end of the current mailbox before writing past
the end of it, rather than after. Now we can actually allocate queues
big enough to need multiple mailboxes.

1.40:
Don't call mcx_intr() from mcx_cmdq_poll(); this was a leftover from early
development that I forgot about, but turns out to be a potential race with
the actual interrupt handler.

1.39:
fix previous: use the correct offset for sq/rq creation, and don't
reset the mbox counter to 0 after calculating it.

1.38:
Add a helper function for writing physical addresses for queues into
command queue mailboxes, and use this for all queue setup commands.
Previously we just assumed the addresses would fit in the first mailbox,
which is currently true but may not be for much longer.

1.37:
(skipped)

1.36:
The event queue consumer counter also needs to be unsigned like the others.

1.35:
try to make if_baudrate look plausible.
this updates the eth proto capability map so it records the baudrate
against the different link types and their media, and then reads
it when the link state changes.

1.34:
(skipped)
 1.1.2.9  01-Mar-2020  martin Pull up following revision(s) (requested by thorpej in ticket #747):

sys/dev/pci/if_mcx.c: revision 1.11

Use the 64-bit PCI DMA tag if available. Otherwise, we are needlessly
allocating (and using) bounce buffers on sytems with >4GB of RAM.

XXX pullup-9
 1.1.2.8  31-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #671):

sys/dev/pci/if_bce.c: revision 1.53
sys/dev/pci/pccbbreg.h: revision 1.16
sys/dev/ic/rt2860.c: revision 1.34
sys/dev/pci/if_alc.c: revision 1.45
sys/dev/pci/if_mcx.c: revision 1.5
sys/dev/pci/if_pcn.c: revision 1.72
sys/dev/pci/if_ale.c: revision 1.37
sys/dev/pci/if_age.c: revision 1.65
sys/dev/ieee1394/fwohcireg.h: revision 1.20
sys/dev/ieee1394/fwohci.c: revision 1.143
sys/dev/ieee1394/firewire.c: revision 1.49
sys/dev/ic/am79900reg.h: revision 1.10

Use unsigned to avoid undefined behavior. Found by kUBSan.
 1.1.2.7  26-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #651):

sys/dev/pci/if_mcx.c: revision 1.8
sys/dev/pci/if_mcx.c: revision 1.9

- Change IFM_10G_T(10GBase-T) entry to IFM_10G_CR1(10GBASE-CR1)
- Add the following entries:
20GBASE-KR2
56GBASE-R4
100GBASE-LR4
100BaseTX
1000baseT
10GBase-T
Set if_baudrate.
 1.1.2.6  26-Nov-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #486):

sys/dev/pci/if_mcx.c: revision 1.7

Fix IFF_ALLMULTI handling.
 1.1.2.5  18-Nov-2019  martin Pull up following revision(s) (requested by nonaka in ticket #441):

sys/dev/hyperv/if_hvn.c: revision 1.7
sys/dev/pci/if_mcx.c: revision 1.6

Fixed incorrect m_defrag return value check.
 1.1.2.4  29-Sep-2019  martin Pull up following revision(s) (requested by tnn in ticket #266):

sys/dev/pci/if_mcx.c: revision 1.3
sys/dev/pci/if_mcx.c: revision 1.4

mcx(4): fix rx mbuf DMA overrun
pullup-9

-

len -> m_len
 1.1.2.3  26-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #247):

sys/dev/pci/if_mcx.c: revision 1.2

Use IFM_50G_SR2.
 1.1.2.2  23-Sep-2019  martin Pull up following revision(s) (requested by jmcneill in ticket #230):

sys/dev/pci/files.pci: revision 1.415
distrib/sets/lists/man/mi: revision 1.1655
sys/dev/pci/if_mcx.c: revision 1.1
share/man/man4/Makefile: revision 1.683
share/man/man4/mcx.4: revision 1.1
sys/arch/evbarm/conf/GENERIC64: revision 1.107
sys/dev/pci/files.pci: revision 1.414

Add support for Mellanox 5th generation ethernet devices. This driver
supports the ConnectX-4 Lx EN, ConnectX-4 EN, ConnectX-5 EN, and
ConnectX-6 EN adapters.

Driver ported from OpenBSD.

add mcx attachment.

Correct mcx comment, drop mii dependency
 1.1.2.1  21-Sep-2019  martin file if_mcx.c was added on branch netbsd-9 on 2019-09-23 07:04:40 +0000
 1.9.2.1  29-Feb-2020  ad Sync with head.
 1.12.4.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.12.4.1  15-Mar-2020  martin file if_mcx.c was added on branch phil-wifi on 2020-04-13 08:04:26 +0000
 1.12.2.1  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.14.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.17.4.1  01-Aug-2021  thorpej Sync with HEAD.
 1.25.4.2  18-Apr-2024  martin Pull up following revision(s) (requested by andvar in ticket #661):

sys/dev/pci/if_mcx.c: revision 1.27

mcx(4): enforce full-duplex mark in mcx_media_status(), when link is up.

LACP protocol requires full-duplex to be enabled for lagg(4) to work,
however mcx(4) was not setting this capability making it to fail.

Fixes PR kern/58124. OK'd by msaitoh@
 1.25.4.1  03-Nov-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #447):

sys/dev/pci/pcidevs: revision 1.1498
sys/dev/pci/if_mcx.c: revision 1.26
share/man/man4/mcx.4: revision 1.3

pcidevs: Add Mellanox ConnectX-6 Lx.

mcx(4): Add Mellanox ConnectX-6 Lx from OpenBSD.
 1.27.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed