sync with OpenBSD -current
This commit is contained in:
parent
be76e7e421
commit
f093fb79c9
45 changed files with 620 additions and 360 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_bnxt.c,v 1.46 2024/02/13 13:58:19 bluhm Exp $ */
|
||||
/* $OpenBSD: if_bnxt.c,v 1.47 2024/02/14 22:41:48 bluhm Exp $ */
|
||||
/*-
|
||||
* Broadcom NetXtreme-C/E network driver.
|
||||
*
|
||||
|
@ -1432,10 +1432,8 @@ bnxt_start(struct ifqueue *ifq)
|
|||
if (ext.tcp) {
|
||||
lflags |= TX_BD_LONG_LFLAGS_LSO;
|
||||
hdrsize = sizeof(*ext.eh);
|
||||
if (ext.ip4)
|
||||
hdrsize += ext.ip4hlen;
|
||||
else if (ext.ip6)
|
||||
hdrsize += sizeof(*ext.ip6);
|
||||
if (ext.ip4 || ext.ip6)
|
||||
hdrsize += ext.iphlen;
|
||||
else
|
||||
tcpstat_inc(tcps_outbadtso);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
***************************************************************************/
|
||||
|
||||
/* $OpenBSD: if_em.c,v 1.372 2024/02/13 13:58:19 bluhm Exp $ */
|
||||
/* $OpenBSD: if_em.c,v 1.373 2024/02/14 22:41:48 bluhm Exp $ */
|
||||
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
|
||||
|
||||
#include <dev/pci/if_em.h>
|
||||
|
@ -2413,7 +2413,6 @@ em_tx_ctx_setup(struct em_queue *que, struct mbuf *mp, u_int head,
|
|||
struct e1000_adv_tx_context_desc *TD;
|
||||
uint32_t vlan_macip_lens = 0, type_tucmd_mlhl = 0, mss_l4len_idx = 0;
|
||||
int off = 0;
|
||||
uint8_t iphlen;
|
||||
|
||||
*olinfo_status = 0;
|
||||
*cmd_type_len = 0;
|
||||
|
@ -2433,8 +2432,6 @@ em_tx_ctx_setup(struct em_queue *que, struct mbuf *mp, u_int head,
|
|||
vlan_macip_lens |= (sizeof(*ext.eh) << E1000_ADVTXD_MACLEN_SHIFT);
|
||||
|
||||
if (ext.ip4) {
|
||||
iphlen = ext.ip4hlen;
|
||||
|
||||
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_IPV4;
|
||||
if (ISSET(mp->m_pkthdr.csum_flags, M_IPV4_CSUM_OUT)) {
|
||||
*olinfo_status |= E1000_TXD_POPTS_IXSM << 8;
|
||||
|
@ -2442,18 +2439,14 @@ em_tx_ctx_setup(struct em_queue *que, struct mbuf *mp, u_int head,
|
|||
}
|
||||
#ifdef INET6
|
||||
} else if (ext.ip6) {
|
||||
iphlen = sizeof(*ext.ip6);
|
||||
|
||||
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_IPV6;
|
||||
#endif
|
||||
} else {
|
||||
iphlen = 0;
|
||||
}
|
||||
|
||||
*cmd_type_len |= E1000_ADVTXD_DTYP_DATA | E1000_ADVTXD_DCMD_IFCS;
|
||||
*cmd_type_len |= E1000_ADVTXD_DCMD_DEXT;
|
||||
*olinfo_status |= mp->m_pkthdr.len << E1000_ADVTXD_PAYLEN_SHIFT;
|
||||
vlan_macip_lens |= iphlen;
|
||||
vlan_macip_lens |= ext.iphlen;
|
||||
type_tucmd_mlhl |= E1000_ADVTXD_DCMD_DEXT | E1000_ADVTXD_DTYP_CTXT;
|
||||
|
||||
if (ext.tcp) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_igc.c,v 1.16 2024/02/13 13:58:19 bluhm Exp $ */
|
||||
/* $OpenBSD: if_igc.c,v 1.17 2024/02/14 22:41:48 bluhm Exp $ */
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
|
@ -2005,7 +2005,6 @@ igc_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, int prod,
|
|||
struct igc_adv_tx_context_desc *txdesc;
|
||||
uint32_t type_tucmd_mlhl = 0;
|
||||
uint32_t vlan_macip_lens = 0;
|
||||
uint32_t iphlen;
|
||||
int off = 0;
|
||||
|
||||
vlan_macip_lens |= (sizeof(*ext.eh) << IGC_ADVTXD_MACLEN_SHIFT);
|
||||
|
@ -2028,8 +2027,6 @@ igc_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, int prod,
|
|||
ether_extract_headers(mp, &ext);
|
||||
|
||||
if (ext.ip4) {
|
||||
iphlen = ext.ip4hlen;
|
||||
|
||||
type_tucmd_mlhl |= IGC_ADVTXD_TUCMD_IPV4;
|
||||
if (ISSET(mp->m_pkthdr.csum_flags, M_IPV4_CSUM_OUT)) {
|
||||
*olinfo_status |= IGC_TXD_POPTS_IXSM << 8;
|
||||
|
@ -2037,15 +2034,13 @@ igc_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, int prod,
|
|||
}
|
||||
#ifdef INET6
|
||||
} else if (ext.ip6) {
|
||||
iphlen = sizeof(*ext.ip6);
|
||||
|
||||
type_tucmd_mlhl |= IGC_ADVTXD_TUCMD_IPV6;
|
||||
#endif
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
vlan_macip_lens |= iphlen;
|
||||
vlan_macip_lens |= ext.iphlen;
|
||||
type_tucmd_mlhl |= IGC_ADVTXD_DCMD_DEXT | IGC_ADVTXD_DTYP_CTXT;
|
||||
|
||||
if (ext.tcp) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_ix.c,v 1.207 2024/02/13 13:58:19 bluhm Exp $ */
|
||||
/* $OpenBSD: if_ix.c,v 1.209 2024/02/15 10:56:53 mglocker Exp $ */
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
|
@ -2494,16 +2494,12 @@ ixgbe_tx_offload(struct mbuf *mp, uint32_t *vlan_macip_lens,
|
|||
{
|
||||
struct ether_extracted ext;
|
||||
int offload = 0;
|
||||
uint32_t ethlen, iphlen;
|
||||
|
||||
ether_extract_headers(mp, &ext);
|
||||
ethlen = sizeof(*ext.eh);
|
||||
|
||||
*vlan_macip_lens |= (ethlen << IXGBE_ADVTXD_MACLEN_SHIFT);
|
||||
*vlan_macip_lens |= (sizeof(*ext.eh) << IXGBE_ADVTXD_MACLEN_SHIFT);
|
||||
|
||||
if (ext.ip4) {
|
||||
iphlen = ext.ip4hlen;
|
||||
|
||||
if (ISSET(mp->m_pkthdr.csum_flags, M_IPV4_CSUM_OUT)) {
|
||||
*olinfo_status |= IXGBE_TXD_POPTS_IXSM << 8;
|
||||
offload = 1;
|
||||
|
@ -2512,8 +2508,6 @@ ixgbe_tx_offload(struct mbuf *mp, uint32_t *vlan_macip_lens,
|
|||
*type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4;
|
||||
#ifdef INET6
|
||||
} else if (ext.ip6) {
|
||||
iphlen = sizeof(*ext.ip6);
|
||||
|
||||
*type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV6;
|
||||
#endif
|
||||
} else {
|
||||
|
@ -2522,7 +2516,7 @@ ixgbe_tx_offload(struct mbuf *mp, uint32_t *vlan_macip_lens,
|
|||
return offload;
|
||||
}
|
||||
|
||||
*vlan_macip_lens |= iphlen;
|
||||
*vlan_macip_lens |= ext.iphlen;
|
||||
|
||||
if (ext.tcp) {
|
||||
*type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP;
|
||||
|
@ -2548,7 +2542,7 @@ ixgbe_tx_offload(struct mbuf *mp, uint32_t *vlan_macip_lens,
|
|||
*mss_l4len_idx |= outlen << IXGBE_ADVTXD_MSS_SHIFT;
|
||||
*mss_l4len_idx |= thlen << IXGBE_ADVTXD_L4LEN_SHIFT;
|
||||
|
||||
hdrlen = ethlen + iphlen + thlen;
|
||||
hdrlen = sizeof(*ext.eh) + ext.iphlen + thlen;
|
||||
paylen = mp->m_pkthdr.len - hdrlen;
|
||||
CLR(*olinfo_status, IXGBE_ADVTXD_PAYLEN_MASK
|
||||
<< IXGBE_ADVTXD_PAYLEN_SHIFT);
|
||||
|
@ -3266,22 +3260,24 @@ ixgbe_rxeof(struct rx_ring *rxr)
|
|||
|
||||
if (pkts > 1) {
|
||||
struct ether_extracted ext;
|
||||
uint32_t hdrlen, paylen;
|
||||
uint32_t paylen;
|
||||
|
||||
/* Calculate header size. */
|
||||
/*
|
||||
* Calculate the payload size:
|
||||
*
|
||||
* The packet length returned by the NIC
|
||||
* (sendmp->m_pkthdr.len) can contain
|
||||
* padding, which we don't want to count
|
||||
* in to the payload size. Therefore, we
|
||||
* calculate the real payload size based
|
||||
* on the total ip length field (ext.iplen).
|
||||
*/
|
||||
ether_extract_headers(sendmp, &ext);
|
||||
hdrlen = sizeof(*ext.eh);
|
||||
#if NVLAN > 0
|
||||
if (ISSET(sendmp->m_flags, M_VLANTAG) ||
|
||||
ext.evh)
|
||||
hdrlen += ETHER_VLAN_ENCAP_LEN;
|
||||
#endif
|
||||
if (ext.ip4)
|
||||
hdrlen += ext.ip4hlen;
|
||||
if (ext.ip6)
|
||||
hdrlen += sizeof(*ext.ip6);
|
||||
paylen = ext.iplen;
|
||||
if (ext.ip4 || ext.ip6)
|
||||
paylen -= ext.iphlen;
|
||||
if (ext.tcp) {
|
||||
hdrlen += ext.tcphlen;
|
||||
paylen -= ext.tcphlen;
|
||||
tcpstat_inc(tcps_inhwlro);
|
||||
tcpstat_add(tcps_inpktlro, pkts);
|
||||
} else {
|
||||
|
@ -3293,8 +3289,6 @@ ixgbe_rxeof(struct rx_ring *rxr)
|
|||
* mark it as TSO, set a correct mss,
|
||||
* and recalculate the TCP checksum.
|
||||
*/
|
||||
paylen = sendmp->m_pkthdr.len > hdrlen ?
|
||||
sendmp->m_pkthdr.len - hdrlen : 0;
|
||||
if (ext.tcp && paylen >= pkts) {
|
||||
SET(sendmp->m_pkthdr.csum_flags,
|
||||
M_TCP_TSO);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_ixl.c,v 1.95 2024/01/07 21:01:45 bluhm Exp $ */
|
||||
/* $OpenBSD: if_ixl.c,v 1.97 2024/02/14 22:41:48 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013-2015, Intel Corporation
|
||||
|
@ -2826,28 +2826,27 @@ ixl_tx_setup_offload(struct mbuf *m0, struct ixl_tx_ring *txr,
|
|||
offload |= ISSET(m0->m_pkthdr.csum_flags, M_IPV4_CSUM_OUT) ?
|
||||
IXL_TX_DESC_CMD_IIPT_IPV4_CSUM :
|
||||
IXL_TX_DESC_CMD_IIPT_IPV4;
|
||||
|
||||
hlen = ext.ip4->ip_hl << 2;
|
||||
#ifdef INET6
|
||||
} else if (ext.ip6) {
|
||||
offload |= IXL_TX_DESC_CMD_IIPT_IPV6;
|
||||
|
||||
hlen = sizeof(*ext.ip6);
|
||||
#endif
|
||||
} else {
|
||||
panic("CSUM_OUT set for non-IP packet");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
hlen = ext.iphlen;
|
||||
|
||||
offload |= (ETHER_HDR_LEN >> 1) << IXL_TX_DESC_MACLEN_SHIFT;
|
||||
offload |= (hlen >> 2) << IXL_TX_DESC_IPLEN_SHIFT;
|
||||
|
||||
if (ext.tcp && ISSET(m0->m_pkthdr.csum_flags, M_TCP_CSUM_OUT)) {
|
||||
offload |= IXL_TX_DESC_CMD_L4T_EOFT_TCP;
|
||||
offload |= (uint64_t)ext.tcp->th_off << IXL_TX_DESC_L4LEN_SHIFT;
|
||||
offload |= (uint64_t)(ext.tcphlen >> 2)
|
||||
<< IXL_TX_DESC_L4LEN_SHIFT;
|
||||
} else if (ext.udp && ISSET(m0->m_pkthdr.csum_flags, M_UDP_CSUM_OUT)) {
|
||||
offload |= IXL_TX_DESC_CMD_L4T_EOFT_UDP;
|
||||
offload |= (sizeof(*ext.udp) >> 2) << IXL_TX_DESC_L4LEN_SHIFT;
|
||||
offload |= (uint64_t)(sizeof(*ext.udp) >> 2)
|
||||
<< IXL_TX_DESC_L4LEN_SHIFT;
|
||||
}
|
||||
|
||||
if (ISSET(m0->m_pkthdr.csum_flags, M_TCP_TSO)) {
|
||||
|
@ -2855,7 +2854,7 @@ ixl_tx_setup_offload(struct mbuf *m0, struct ixl_tx_ring *txr,
|
|||
struct ixl_tx_desc *ring, *txd;
|
||||
uint64_t cmd = 0, paylen, outlen;
|
||||
|
||||
hlen += ext.tcp->th_off << 2;
|
||||
hlen += ext.tcphlen;
|
||||
|
||||
outlen = m0->m_pkthdr.ph_mss;
|
||||
paylen = m0->m_pkthdr.len - ETHER_HDR_LEN - hlen;
|
||||
|
@ -3285,7 +3284,7 @@ ixl_rxeof(struct ixl_softc *sc, struct ixl_rx_ring *rxr)
|
|||
bus_dmamap_sync(sc->sc_dmat, map, 0, map->dm_mapsize,
|
||||
BUS_DMASYNC_POSTREAD);
|
||||
bus_dmamap_unload(sc->sc_dmat, map);
|
||||
|
||||
|
||||
m = rxm->rxm_m;
|
||||
rxm->rxm_m = NULL;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_vmx.c,v 1.80 2024/02/09 15:22:41 jan Exp $ */
|
||||
/* $OpenBSD: if_vmx.c,v 1.81 2024/02/15 13:24:45 jan Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Tsubai Masanari
|
||||
|
@ -400,10 +400,12 @@ vmxnet3_attach(struct device *parent, struct device *self, void *aux)
|
|||
ifp->if_watchdog = vmxnet3_watchdog;
|
||||
ifp->if_hardmtu = VMXNET3_MAX_MTU;
|
||||
ifp->if_capabilities = IFCAP_VLAN_MTU;
|
||||
#if 0
|
||||
if (sc->sc_ds->upt_features & UPT1_F_CSUM)
|
||||
|
||||
if (sc->sc_ds->upt_features & UPT1_F_CSUM) {
|
||||
ifp->if_capabilities |= IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4;
|
||||
#endif
|
||||
ifp->if_capabilities |= IFCAP_CSUM_TCPv6 | IFCAP_CSUM_UDPv6;
|
||||
}
|
||||
|
||||
#if NVLAN > 0
|
||||
if (sc->sc_ds->upt_features & UPT1_F_VLAN)
|
||||
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
|
||||
|
@ -1397,6 +1399,55 @@ vmx_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m)
|
|||
BUS_DMA_STREAMING | BUS_DMA_NOWAIT));
|
||||
}
|
||||
|
||||
void
|
||||
vmxnet3_tx_offload(struct vmxnet3_txdesc *sop, struct mbuf *m)
|
||||
{
|
||||
struct ether_extracted ext;
|
||||
uint32_t offset = 0;
|
||||
uint32_t hdrlen;
|
||||
|
||||
/*
|
||||
* VLAN Offload
|
||||
*/
|
||||
|
||||
#if NVLAN > 0
|
||||
if (ISSET(m->m_flags, M_VLANTAG)) {
|
||||
sop->tx_word3 |= htole32(VMXNET3_TX_VTAG_MODE);
|
||||
sop->tx_word3 |= htole32((m->m_pkthdr.ether_vtag &
|
||||
VMXNET3_TX_VLANTAG_M) << VMXNET3_TX_VLANTAG_S);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Checksum Offload
|
||||
*/
|
||||
|
||||
if (!ISSET(m->m_pkthdr.csum_flags, M_TCP_CSUM_OUT) &&
|
||||
!ISSET(m->m_pkthdr.csum_flags, M_UDP_CSUM_OUT))
|
||||
return;
|
||||
|
||||
ether_extract_headers(m, &ext);
|
||||
|
||||
hdrlen = sizeof(*ext.eh);
|
||||
if (ext.evh)
|
||||
hdrlen = sizeof(*ext.evh);
|
||||
|
||||
if (ext.ip4 || ext.ip6)
|
||||
hdrlen += ext.iphlen;
|
||||
|
||||
if (ext.tcp)
|
||||
offset = hdrlen + offsetof(struct tcphdr, th_sum);
|
||||
else if (ext.udp)
|
||||
offset = hdrlen + offsetof(struct udphdr, uh_sum);
|
||||
|
||||
hdrlen &= VMXNET3_TX_HLEN_M;
|
||||
offset &= VMXNET3_TX_OP_M;
|
||||
|
||||
sop->tx_word3 |= htole32(VMXNET3_OM_CSUM << VMXNET3_TX_OM_S);
|
||||
sop->tx_word3 |= htole32(hdrlen << VMXNET3_TX_HLEN_S);
|
||||
sop->tx_word2 |= htole32(offset << VMXNET3_TX_OP_S);
|
||||
}
|
||||
|
||||
void
|
||||
vmxnet3_start(struct ifqueue *ifq)
|
||||
{
|
||||
|
@ -1469,13 +1520,7 @@ vmxnet3_start(struct ifqueue *ifq)
|
|||
}
|
||||
txd->tx_word3 = htole32(VMXNET3_TX_EOP | VMXNET3_TX_COMPREQ);
|
||||
|
||||
#if NVLAN > 0
|
||||
if (ISSET(m->m_flags, M_VLANTAG)) {
|
||||
sop->tx_word3 |= htole32(VMXNET3_TX_VTAG_MODE);
|
||||
sop->tx_word3 |= htole32((m->m_pkthdr.ether_vtag &
|
||||
VMXNET3_TX_VLANTAG_M) << VMXNET3_TX_VLANTAG_S);
|
||||
}
|
||||
#endif
|
||||
vmxnet3_tx_offload(sop, m);
|
||||
|
||||
ring->prod = prod;
|
||||
/* Change the ownership by flipping the "generation" bit */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue