e1000: Some fixes for em(4) TSO setup

Always set TXD_CMD_IP for 82544
Otherwise set TXD_CMD_IP for IPv4, not IPv6

Reviewed by:	markj (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30072
This commit is contained in:
Kevin Bowling 2023-07-20 18:51:02 -07:00
parent 92053e4f8a
commit 201c4b7c29

View file

@ -141,8 +141,10 @@ em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, uint32_t *txd_upper,
if_softc_ctx_t scctx = sc->shared;
struct em_tx_queue *que = &sc->tx_queues[pi->ipi_qsidx];
struct tx_ring *txr = &que->txr;
struct e1000_hw *hw = &sc->hw;
struct e1000_context_desc *TXD;
int cur, hdr_len;
uint32_t cmd_type_len;
hdr_len = pi->ipi_ehdrlen + pi->ipi_ip_hlen + pi->ipi_tcp_hlen;
*txd_lower = (E1000_TXD_CMD_DEXT | /* Extended descr type */
@ -183,12 +185,23 @@ em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi, uint32_t *txd_upper,
TXD->tcp_seg_setup.fields.mss = htole16(pi->ipi_tso_segsz);
TXD->tcp_seg_setup.fields.hdr_len = hdr_len;
TXD->cmd_and_length = htole32(sc->txd_cmd |
E1000_TXD_CMD_DEXT | /* Extended descr */
E1000_TXD_CMD_TSE | /* TSE context */
E1000_TXD_CMD_IP | /* Do IP csum */
E1000_TXD_CMD_TCP | /* Do TCP checksum */
(pi->ipi_len - hdr_len)); /* Total len */
/*
* 8254x SDM4.0 page 45, and PCIe GbE SDM2.5 page 63
* - Set up basic TUCMDs
* - Enable IP bit on 82544
* - For others IP bit on indicates IPv4, while off indicates IPv6
*/
cmd_type_len = sc->txd_cmd |
E1000_TXD_CMD_DEXT | /* Extended descr */
E1000_TXD_CMD_TSE | /* TSE context */
E1000_TXD_CMD_TCP; /* Do TCP checksum */
if (hw->mac.type == e1000_82544)
cmd_type_len |= E1000_TXD_CMD_IP;
else if (pi->ipi_etype == ETHERTYPE_IP)
cmd_type_len |= E1000_TXD_CMD_IP;
TXD->cmd_and_length = htole32(cmd_type_len |
(pi->ipi_len - hdr_len)); /* Total len */
txr->tx_tso = true;
if (++cur == scctx->isc_ntxd[0]) {