mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-25 01:55:19 +01:00
dpaa2: fix MRU for dpni (and software vlans along)
0480dccd3f
tried to fix the MTU for software VLANs given dpni announces IFCAP_VLAN_MTU. Unfortunately the initial MRU during setup is reduced from the maximum supported by the HW to our maximum ethernet RX frame length so only after further mtu toggles the solution there would work. Set the maximum RX frame size (without CRC) to jumbo length + vlan encap len by default given we also announce IFCAP_JUMBO_MTU. While here improve the manual (ioctl) MTU setting by checking if IFCAP_VLAN_MTU is currently enabled and only then add the extra bytes. Fixes:0480dccd3f
MFC after: 3 days Reviewed by: dsl Differential Revision: https://reviews.freebsd.org/D47066
This commit is contained in:
parent
1a37caeb07
commit
fa3dfeff95
@ -138,8 +138,9 @@ MALLOC_DEFINE(M_DPAA2_TXB, "dpaa2_txb", "DPAA2 DMA-mapped buffer (Tx)");
|
||||
#define DPNI_IRQ_LINK_CHANGED 1 /* Link state changed */
|
||||
#define DPNI_IRQ_EP_CHANGED 2 /* DPAA2 endpoint dis/connected */
|
||||
|
||||
/* Default maximum frame length. */
|
||||
#define DPAA2_ETH_MFL (ETHER_MAX_LEN - ETHER_CRC_LEN)
|
||||
/* Default maximum RX frame length w/o CRC. */
|
||||
#define DPAA2_ETH_MFL (ETHER_MAX_LEN_JUMBO + ETHER_VLAN_ENCAP_LEN - \
|
||||
ETHER_CRC_LEN)
|
||||
|
||||
/* Minimally supported version of the DPNI API. */
|
||||
#define DPNI_VER_MAJOR 7
|
||||
@ -2561,8 +2562,10 @@ dpaa2_ni_ioctl(if_t ifp, u_long c, caddr_t data)
|
||||
DPNI_UNLOCK(sc);
|
||||
|
||||
/* Update maximum frame length. */
|
||||
error = DPAA2_CMD_NI_SET_MFL(dev, child, &cmd,
|
||||
mtu + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN);
|
||||
mtu += ETHER_HDR_LEN;
|
||||
if (if_getcapenable(ifp) & IFCAP_VLAN_MTU)
|
||||
mtu += ETHER_VLAN_ENCAP_LEN;
|
||||
error = DPAA2_CMD_NI_SET_MFL(dev, child, &cmd, mtu);
|
||||
if (error) {
|
||||
device_printf(dev, "%s: failed to update maximum frame "
|
||||
"length: error=%d\n", __func__, error);
|
||||
|
Loading…
Reference in New Issue
Block a user