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: rkdrm.c,v 1.20 2024/01/19 17:51:15 kettenis Exp $ */
|
||||
/* $OpenBSD: rkdrm.c,v 1.21 2024/02/15 09:48:03 jsg Exp $ */
|
||||
/* $NetBSD: rk_drm.c,v 1.3 2019/12/15 01:00:58 mrg Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
|
@ -528,7 +528,7 @@ rkdrm_fb_probe(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *
|
|||
info = drm_fb_helper_alloc_info(helper);
|
||||
if (IS_ERR(info)) {
|
||||
DRM_ERROR("Failed to allocate fb_info\n");
|
||||
return error;
|
||||
return PTR_ERR(info);
|
||||
}
|
||||
info->par = helper;
|
||||
return 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: oosiop.c,v 1.36 2022/04/16 19:19:59 naddy Exp $ */
|
||||
/* $OpenBSD: oosiop.c,v 1.37 2024/02/13 17:51:17 miod Exp $ */
|
||||
/* $NetBSD: oosiop.c,v 1.4 2003/10/29 17:45:55 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -726,8 +726,6 @@ oosiop_scsicmd(struct scsi_xfer *xs)
|
|||
|
||||
sc = xs->sc_link->bus->sb_adapter_softc;
|
||||
|
||||
s = splbio();
|
||||
|
||||
cb = xs->io;
|
||||
|
||||
cb->xs = xs;
|
||||
|
@ -747,7 +745,6 @@ oosiop_scsicmd(struct scsi_xfer *xs)
|
|||
if (err) {
|
||||
printf("%s: unable to load cmd DMA map: %d",
|
||||
sc->sc_dev.dv_xname, err);
|
||||
splx(s);
|
||||
xs->error = XS_DRIVER_STUFFUP;
|
||||
scsi_done(xs);
|
||||
return;
|
||||
|
@ -769,7 +766,6 @@ oosiop_scsicmd(struct scsi_xfer *xs)
|
|||
printf("%s: unable to load data DMA map: %d",
|
||||
sc->sc_dev.dv_xname, err);
|
||||
bus_dmamap_unload(sc->sc_dmat, cb->cmddma);
|
||||
splx(s);
|
||||
xs->error = XS_DRIVER_STUFFUP;
|
||||
scsi_done(xs);
|
||||
return;
|
||||
|
@ -787,6 +783,12 @@ oosiop_scsicmd(struct scsi_xfer *xs)
|
|||
*/
|
||||
timeout_set(&xs->stimeout, oosiop_timeout, cb);
|
||||
|
||||
oosiop_setup(sc, cb);
|
||||
|
||||
s = splbio();
|
||||
|
||||
TAILQ_INSERT_TAIL(&sc->sc_cbq, cb, chain);
|
||||
|
||||
if (xs->flags & SCSI_POLL)
|
||||
dopoll = 1;
|
||||
else {
|
||||
|
@ -795,16 +797,13 @@ oosiop_scsicmd(struct scsi_xfer *xs)
|
|||
timeout_add_msec(&xs->stimeout, xs->timeout);
|
||||
}
|
||||
|
||||
splx(s);
|
||||
|
||||
oosiop_setup(sc, cb);
|
||||
|
||||
TAILQ_INSERT_TAIL(&sc->sc_cbq, cb, chain);
|
||||
|
||||
if (!sc->sc_active) {
|
||||
/* Abort script to start selection */
|
||||
oosiop_write_1(sc, OOSIOP_ISTAT, OOSIOP_ISTAT_ABRT);
|
||||
}
|
||||
|
||||
splx(s);
|
||||
|
||||
if (dopoll)
|
||||
oosiop_poll(sc, cb);
|
||||
}
|
||||
|
|
121
sys/dev/ic/qwx.c
121
sys/dev/ic/qwx.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: qwx.c,v 1.36 2024/02/09 14:11:00 stsp Exp $ */
|
||||
/* $OpenBSD: qwx.c,v 1.40 2024/02/15 16:29:45 stsp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
|
||||
|
@ -592,6 +592,14 @@ next_scan:
|
|||
printf("%s: %s -> %s\n", ifp->if_xname,
|
||||
ieee80211_state_name[ic->ic_state],
|
||||
ieee80211_state_name[IEEE80211_S_SCAN]);
|
||||
#if 0
|
||||
if ((sc->sc_flags & QWX_FLAG_BGSCAN) == 0) {
|
||||
#endif
|
||||
ieee80211_set_link_state(ic, LINK_STATE_DOWN);
|
||||
ieee80211_node_cleanup(ic, ic->ic_bss);
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
ic->ic_state = IEEE80211_S_SCAN;
|
||||
refcnt_rele_wake(&sc->task_refs);
|
||||
splx(s);
|
||||
|
@ -7734,7 +7742,7 @@ qwx_qmi_mem_seg_send(struct qwx_softc *sc)
|
|||
sc->fwmem_ready = 0;
|
||||
|
||||
while (sc->sc_req_mem_ind == NULL) {
|
||||
ret = tsleep_nsec(&sc->qmi_resp, 0, "qwxfwmem",
|
||||
ret = tsleep_nsec(&sc->sc_req_mem_ind, 0, "qwxfwmem",
|
||||
SEC_TO_NSEC(10));
|
||||
if (ret) {
|
||||
printf("%s: fw memory request timeout\n",
|
||||
|
@ -14018,7 +14026,7 @@ qwx_dp_rxdma_buf_ring_free(struct qwx_softc *sc, struct dp_rxdma_ring *rx_ring)
|
|||
sizeof(rx_ring->rx_data[0]) * rx_ring->bufs_max);
|
||||
rx_ring->rx_data = NULL;
|
||||
rx_ring->bufs_max = 0;
|
||||
rx_ring->cur = 0;
|
||||
memset(rx_ring->freemap, 0xff, sizeof(rx_ring->freemap));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -14067,7 +14075,20 @@ qwx_hal_rx_buf_addr_info_get(void *desc, uint64_t *paddr, uint32_t *cookie,
|
|||
*rbm = FIELD_GET(BUFFER_ADDR_INFO1_RET_BUF_MGR, binfo->info1);
|
||||
}
|
||||
|
||||
/* Returns number of Rx buffers replenished */
|
||||
int
|
||||
qwx_next_free_rxbuf_idx(struct dp_rxdma_ring *rx_ring)
|
||||
{
|
||||
int i, idx;
|
||||
|
||||
for (i = 0; i < nitems(rx_ring->freemap); i++) {
|
||||
idx = ffs(rx_ring->freemap[i]);
|
||||
if (idx > 0)
|
||||
return ((idx - 1) + (i * 8));
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
qwx_dp_rxbufs_replenish(struct qwx_softc *sc, int mac_id,
|
||||
struct dp_rxdma_ring *rx_ring, int req_entries,
|
||||
|
@ -14078,7 +14099,7 @@ qwx_dp_rxbufs_replenish(struct qwx_softc *sc, int mac_id,
|
|||
struct mbuf *m;
|
||||
int num_free;
|
||||
int num_remain;
|
||||
int ret;
|
||||
int ret, idx;
|
||||
uint32_t cookie;
|
||||
uint64_t paddr;
|
||||
struct qwx_rx_data *rx_data;
|
||||
|
@ -14113,10 +14134,12 @@ qwx_dp_rxbufs_replenish(struct qwx_softc *sc, int mac_id,
|
|||
goto fail_free_mbuf;
|
||||
|
||||
m->m_len = m->m_pkthdr.len = size;
|
||||
rx_data = &rx_ring->rx_data[rx_ring->cur];
|
||||
if (rx_data->m != NULL)
|
||||
|
||||
idx = qwx_next_free_rxbuf_idx(rx_ring);
|
||||
if (idx == -1)
|
||||
goto fail_free_mbuf;
|
||||
|
||||
rx_data = &rx_ring->rx_data[idx];
|
||||
if (rx_data->map == NULL) {
|
||||
ret = bus_dmamap_create(sc->sc_dmat, size, 1,
|
||||
size, 0, BUS_DMA_NOWAIT, &rx_data->map);
|
||||
|
@ -14137,11 +14160,12 @@ qwx_dp_rxbufs_replenish(struct qwx_softc *sc, int mac_id,
|
|||
goto fail_dma_unmap;
|
||||
|
||||
rx_data->m = m;
|
||||
m = NULL;
|
||||
|
||||
cookie = FIELD_PREP(DP_RXDMA_BUF_COOKIE_PDEV_ID, mac_id) |
|
||||
FIELD_PREP(DP_RXDMA_BUF_COOKIE_BUF_ID, rx_ring->cur);
|
||||
FIELD_PREP(DP_RXDMA_BUF_COOKIE_BUF_ID, idx);
|
||||
|
||||
rx_ring->cur = (rx_ring->cur + 1) % rx_ring->bufs_max;
|
||||
clrbit(rx_ring->freemap, idx);
|
||||
num_remain--;
|
||||
|
||||
paddr = rx_data->map->dm_segs[0].ds_addr;
|
||||
|
@ -14183,7 +14207,7 @@ qwx_dp_rxdma_ring_buf_setup(struct qwx_softc *sc,
|
|||
return ENOMEM;
|
||||
|
||||
rx_ring->bufs_max = num_entries;
|
||||
rx_ring->cur = 0;
|
||||
memset(rx_ring->freemap, 0xff, sizeof(rx_ring->freemap));
|
||||
|
||||
return qwx_dp_rxbufs_replenish(sc, dp->mac_id, rx_ring, num_entries,
|
||||
sc->hw_params.hal_params->rx_buf_rbm);
|
||||
|
@ -15196,16 +15220,14 @@ qwx_dp_process_rx_err_buf(struct qwx_softc *sc, uint32_t *ring_desc,
|
|||
uint16_t msdu_len;
|
||||
uint32_t hal_rx_desc_sz = sc->hw_params.hal_desc_sz;
|
||||
|
||||
if (buf_id >= rx_ring->bufs_max)
|
||||
if (buf_id >= rx_ring->bufs_max || isset(rx_ring->freemap, buf_id))
|
||||
return;
|
||||
|
||||
rx_data = &rx_ring->rx_data[buf_id];
|
||||
if (rx_data->m == NULL)
|
||||
return;
|
||||
|
||||
bus_dmamap_unload(sc->sc_dmat, rx_data->map);
|
||||
m = rx_data->m;
|
||||
rx_data->m = NULL;
|
||||
setbit(rx_ring->freemap, buf_id);
|
||||
|
||||
if (drop) {
|
||||
m_freem(m);
|
||||
|
@ -15524,13 +15546,14 @@ qwx_dp_rx_process_wbm_err(struct qwx_softc *sc)
|
|||
continue;
|
||||
|
||||
rx_ring = &sc->pdev_dp.rx_refill_buf_ring;
|
||||
if (idx >= rx_ring->bufs_max)
|
||||
if (idx >= rx_ring->bufs_max || isset(rx_ring->freemap, idx))
|
||||
continue;
|
||||
rx_data = &rx_ring->rx_data[idx];
|
||||
|
||||
rx_data = &rx_ring->rx_data[idx];
|
||||
bus_dmamap_unload(sc->sc_dmat, rx_data->map);
|
||||
m = rx_data->m;
|
||||
rx_data->m = NULL;
|
||||
setbit(rx_ring->freemap, idx);
|
||||
|
||||
num_buffs_reaped[mac_id]++;
|
||||
total_num_buffs_reaped++;
|
||||
|
@ -16075,16 +16098,14 @@ try_again:
|
|||
continue;
|
||||
|
||||
rx_ring = &pdev_dp->rx_refill_buf_ring;
|
||||
if (idx >= rx_ring->bufs_max)
|
||||
if (idx >= rx_ring->bufs_max || isset(rx_ring->freemap, idx))
|
||||
continue;
|
||||
|
||||
rx_data = &rx_ring->rx_data[idx];
|
||||
if (rx_data->m == NULL)
|
||||
continue;
|
||||
|
||||
bus_dmamap_unload(sc->sc_dmat, rx_data->map);
|
||||
m = rx_data->m;
|
||||
rx_data->m = NULL;
|
||||
setbit(rx_ring->freemap, idx);
|
||||
|
||||
num_buffs_reaped[mac_id]++;
|
||||
|
||||
|
@ -16166,7 +16187,7 @@ qwx_dp_rx_alloc_mon_status_buf(struct qwx_softc *sc,
|
|||
struct mbuf *m;
|
||||
struct qwx_rx_data *rx_data;
|
||||
const size_t size = DP_RX_BUFFER_SIZE;
|
||||
int ret;
|
||||
int ret, idx;
|
||||
|
||||
m = m_gethdr(M_DONTWAIT, MT_DATA);
|
||||
if (m == NULL)
|
||||
|
@ -16180,7 +16201,11 @@ qwx_dp_rx_alloc_mon_status_buf(struct qwx_softc *sc,
|
|||
goto fail_free_mbuf;
|
||||
|
||||
m->m_len = m->m_pkthdr.len = size;
|
||||
rx_data = &rx_ring->rx_data[rx_ring->cur];
|
||||
idx = qwx_next_free_rxbuf_idx(rx_ring);
|
||||
if (idx == -1)
|
||||
goto fail_free_mbuf;
|
||||
|
||||
rx_data = &rx_ring->rx_data[idx];
|
||||
if (rx_data->m != NULL)
|
||||
goto fail_free_mbuf;
|
||||
|
||||
|
@ -16199,8 +16224,9 @@ qwx_dp_rx_alloc_mon_status_buf(struct qwx_softc *sc,
|
|||
goto fail_free_mbuf;
|
||||
}
|
||||
|
||||
*buf_idx = rx_ring->cur;
|
||||
*buf_idx = idx;
|
||||
rx_data->m = m;
|
||||
clrbit(rx_ring->freemap, idx);
|
||||
return m;
|
||||
|
||||
fail_free_mbuf:
|
||||
|
@ -16250,25 +16276,20 @@ qwx_dp_rx_reap_mon_status_ring(struct qwx_softc *sc, int mac_id,
|
|||
&cookie, &rbm);
|
||||
if (paddr) {
|
||||
buf_idx = FIELD_GET(DP_RXDMA_BUF_COOKIE_BUF_ID, cookie);
|
||||
|
||||
rx_data = &rx_ring->rx_data[buf_idx];
|
||||
if (rx_data->m == NULL) {
|
||||
printf("%s: rx monitor status with invalid "
|
||||
"buf_idx %d\n", __func__, buf_idx);
|
||||
if (buf_idx >= rx_ring->bufs_max ||
|
||||
isset(rx_ring->freemap, buf_idx)) {
|
||||
pmon->buf_state = DP_MON_STATUS_REPLINISH;
|
||||
goto move_next;
|
||||
}
|
||||
|
||||
rx_data = &rx_ring->rx_data[buf_idx];
|
||||
|
||||
bus_dmamap_sync(sc->sc_dmat, rx_data->map, 0,
|
||||
rx_data->m->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
|
||||
|
||||
tlv = mtod(rx_data->m, struct hal_tlv_hdr *);
|
||||
if (FIELD_GET(HAL_TLV_HDR_TAG, tlv->tl) !=
|
||||
HAL_RX_STATUS_BUFFER_DONE) {
|
||||
printf("%s: mon status DONE not set %lx, "
|
||||
"buf_idx %d\n", __func__,
|
||||
FIELD_GET(HAL_TLV_HDR_TAG, tlv->tl),
|
||||
buf_idx);
|
||||
HAL_RX_STATUS_BUFFER_DONE) {
|
||||
/* If done status is missing, hold onto status
|
||||
* ring until status is done for this status
|
||||
* ring buffer.
|
||||
|
@ -16283,6 +16304,7 @@ qwx_dp_rx_reap_mon_status_ring(struct qwx_softc *sc, int mac_id,
|
|||
bus_dmamap_unload(sc->sc_dmat, rx_data->map);
|
||||
m = rx_data->m;
|
||||
rx_data->m = NULL;
|
||||
setbit(rx_ring->freemap, buf_idx);
|
||||
#if 0
|
||||
if (ab->hw_params.full_monitor_mode) {
|
||||
ath11k_dp_rx_mon_update_status_buf_state(pmon, tlv);
|
||||
|
@ -16304,7 +16326,6 @@ move_next:
|
|||
break;
|
||||
}
|
||||
rx_data = &rx_ring->rx_data[buf_idx];
|
||||
KASSERT(rx_data->m == NULL);
|
||||
|
||||
cookie = FIELD_PREP(DP_RXDMA_BUF_COOKIE_PDEV_ID, mac_id) |
|
||||
FIELD_PREP(DP_RXDMA_BUF_COOKIE_BUF_ID, buf_idx);
|
||||
|
@ -16491,7 +16512,8 @@ qwx_dp_process_rxdma_err(struct qwx_softc *sc, int mac_id)
|
|||
for (i = 0; i < num_msdus; i++) {
|
||||
idx = FIELD_GET(DP_RXDMA_BUF_COOKIE_BUF_ID,
|
||||
msdu_cookies[i]);
|
||||
if (idx >= rx_ring->bufs_max)
|
||||
if (idx >= rx_ring->bufs_max ||
|
||||
isset(rx_ring->freemap, idx))
|
||||
continue;
|
||||
|
||||
rx_data = &rx_ring->rx_data[idx];
|
||||
|
@ -16499,6 +16521,7 @@ qwx_dp_process_rxdma_err(struct qwx_softc *sc, int mac_id)
|
|||
bus_dmamap_unload(sc->sc_dmat, rx_data->map);
|
||||
m_freem(rx_data->m);
|
||||
rx_data->m = NULL;
|
||||
setbit(rx_ring->freemap, idx);
|
||||
|
||||
num_buf_freed++;
|
||||
}
|
||||
|
@ -16868,15 +16891,18 @@ qwx_dp_service_srng(struct qwx_softc *sc, int grp_id)
|
|||
for (j = 0; j < sc->hw_params.num_rxmda_per_pdev; j++) {
|
||||
int id = i * sc->hw_params.num_rxmda_per_pdev + j;
|
||||
|
||||
if ((sc->hw_params.ring_mask->rxdma2host[grp_id] &
|
||||
(1 << (id))) == 0)
|
||||
continue;
|
||||
if (sc->hw_params.ring_mask->rxdma2host[grp_id] &
|
||||
(1 << (id))) {
|
||||
if (qwx_dp_process_rxdma_err(sc, id))
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
if (qwx_dp_process_rxdma_err(sc, id))
|
||||
ret = 1;
|
||||
|
||||
qwx_dp_rxbufs_replenish(sc, id, &dp->rx_refill_buf_ring,
|
||||
0, sc->hw_params.hal_params->rx_buf_rbm);
|
||||
if (sc->hw_params.ring_mask->host2rxdma[grp_id] &
|
||||
(1 << id)) {
|
||||
qwx_dp_rxbufs_replenish(sc, id,
|
||||
&dp->rx_refill_buf_ring, 0,
|
||||
sc->hw_params.hal_params->rx_buf_rbm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21517,6 +21543,7 @@ int
|
|||
qwx_mac_op_start(struct qwx_pdev *pdev)
|
||||
{
|
||||
struct qwx_softc *sc = pdev->sc;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
int ret;
|
||||
|
||||
ret = qwx_wmi_pdev_set_param(sc, WMI_PDEV_PARAM_PMF_QOS, 1,
|
||||
|
@ -21536,7 +21563,7 @@ qwx_mac_op_start(struct qwx_pdev *pdev)
|
|||
}
|
||||
|
||||
if (isset(sc->wmi.svc_map, WMI_TLV_SERVICE_SPOOF_MAC_SUPPORT)) {
|
||||
ret = qwx_wmi_scan_prob_req_oui(sc, sc->mac_addr,
|
||||
ret = qwx_wmi_scan_prob_req_oui(sc, ic->ic_myaddr,
|
||||
pdev->pdev_id);
|
||||
if (ret) {
|
||||
printf("%s: failed to set prob req oui for "
|
||||
|
@ -22050,17 +22077,17 @@ qwx_mac_op_add_interface(struct qwx_pdev *pdev)
|
|||
goto err;
|
||||
}
|
||||
|
||||
ret = qwx_wmi_vdev_create(sc, sc->mac_addr, &vdev_param);
|
||||
ret = qwx_wmi_vdev_create(sc, ic->ic_myaddr, &vdev_param);
|
||||
if (ret) {
|
||||
printf("%s: failed to create WMI vdev %d %s: %d\n",
|
||||
sc->sc_dev.dv_xname, arvif->vdev_id,
|
||||
ether_sprintf(sc->mac_addr), ret);
|
||||
ether_sprintf(ic->ic_myaddr), ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
sc->num_created_vdevs++;
|
||||
DNPRINTF(QWX_D_MAC, "%s: vdev %s created, vdev_id %d\n", __func__,
|
||||
ether_sprintf(sc->mac_addr), arvif->vdev_id);
|
||||
ether_sprintf(ic->ic_myaddr), arvif->vdev_id);
|
||||
sc->allocated_vdev_map |= 1U << arvif->vdev_id;
|
||||
sc->free_vdev_map &= ~(1U << arvif->vdev_id);
|
||||
#ifdef notyet
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: qwxvar.h,v 1.18 2024/02/09 14:09:19 stsp Exp $ */
|
||||
/* $OpenBSD: qwxvar.h,v 1.19 2024/02/15 11:57:38 stsp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018-2019 The Linux Foundation.
|
||||
|
@ -1435,8 +1435,8 @@ struct dp_rxdma_ring {
|
|||
#else
|
||||
struct qwx_rx_data *rx_data;
|
||||
#endif
|
||||
int cur;
|
||||
int bufs_max;
|
||||
uint8_t freemap[howmany(DP_RXDMA_BUF_RING_SIZE, 8)];
|
||||
};
|
||||
|
||||
enum hal_rx_mon_status {
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: if_vio.c,v 1.30 2024/02/13 13:58:19 bluhm Exp $ */
|
||||
/* $OpenBSD: if_vio.c,v 1.31 2024/02/14 22:41:48 bluhm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg.
|
||||
|
@ -764,12 +764,8 @@ again:
|
|||
else
|
||||
hdr->csum_offset = offsetof(struct udphdr, uh_sum);
|
||||
|
||||
if (ext.ip4)
|
||||
hdr->csum_start += ext.ip4hlen;
|
||||
#ifdef INET6
|
||||
else if (ext.ip6)
|
||||
hdr->csum_start += sizeof(*ext.ip6);
|
||||
#endif
|
||||
if (ext.ip4 || ext.ip6)
|
||||
hdr->csum_start += ext.iphlen;
|
||||
hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue