From nobody Thu Jul 27 22:59:04 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RBmRT2H2Vz4pl4R for ; Thu, 27 Jul 2023 22:59:17 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RBmRT0ZyDz3qnk for ; Thu, 27 Jul 2023 22:59:17 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-686efb9ee0cso1495458b3a.3 for ; Thu, 27 Jul 2023 15:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; t=1690498756; x=1691103556; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ldb/QnSI+bSoSbMdYncSNjCSTHJnMvuqY5H9h5s2JW0=; b=Bv13tWenEI4uOVHRPDNAsqDonD+0ZNTvb3HjBdiv3YeZqeR6Q3dk+O6mQIHmu+hGRm f2CnxI5ijyYKWY3OAajYxfOc0c93zY38hUer6O4aMI/6Jt6A19pas/5lTZM+zJk9s4ye 6pFDqckZYOBzAfvgBTc9HHfQutmJupu8JD/HQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690498756; x=1691103556; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ldb/QnSI+bSoSbMdYncSNjCSTHJnMvuqY5H9h5s2JW0=; b=LoNxK9aPa2zyG/0yAizStSNVDcHnHc+Rdhn26UuBPBkTN/5pKULgrNCpjfcFVHr4Xd 4U7aYewixvQHS+26B0ti9RO5vD5nzHBpNre8CeVNr65+bcd8+u5VxzcnNk6LmFRkIhj+ H9b/ioxJ3cs5qEurqP1W66fxM1JRayWnRP7CnkckVP0+Z1r/8rEnY13BjQifSfcw8EAH nKpk7RNnuqah81qF0rzoscgoppClxxu4vVz6uiap6HX4Re4uKsLAbwrabqsgadObqAfX jlpzsgg/EaXo3fS5qcM1ZW9XWhO2b2UZtUj9/R8va7ajkADAUcUOtHE5HlpqT68Oly6T ujDA== X-Gm-Message-State: ABy/qLYzvjinxIMY/ueXH069O6cqukTVco22PrS/U2CUjFMja/P8TAYK VjYswV/OVkT27VIzeS/CzvUdIwFo/y05Z5qlUWKYPg== X-Google-Smtp-Source: APBJJlHGLpfBUna1YBZIqOQQpEr9PxtvfJubn7RpJkY8CqHD+aj8tBURle1OuDxxd2/aymhjAY7iaW9c6sJiaISqk50= X-Received: by 2002:a17:902:a703:b0:1b8:53b5:8518 with SMTP id w3-20020a170902a70300b001b853b58518mr547493plq.63.1690498755599; Thu, 27 Jul 2023 15:59:15 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202307272258.36RMwPnG052295@gitrepo.freebsd.org> In-Reply-To: <202307272258.36RMwPnG052295@gitrepo.freebsd.org> From: Kevin Bowling Date: Thu, 27 Jul 2023 15:59:04 -0700 Message-ID: Subject: Re: git: cbcab907f8ad - main - e1000: Corrections for lem(4)/em(4) txcsum offload To: Kevin Bowling Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4RBmRT0ZyDz3qnk X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated MFC after: 1 week On Thu, Jul 27, 2023 at 3:58=E2=80=AFPM Kevin Bowling wrote: > > The branch main has been updated by kbowling: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dcbcab907f8ad1a4ac38dbc574c= 747ac2901faa54 > > commit cbcab907f8ad1a4ac38dbc574c747ac2901faa54 > Author: Kevin Bowling > AuthorDate: 2023-07-27 22:50:32 +0000 > Commit: Kevin Bowling > CommitDate: 2023-07-27 22:58:05 +0000 > > e1000: Corrections for lem(4)/em(4) txcsum offload > > Explicitly set ipcss/ipcse/ipcso for IPv6 per intel SDM as indicated = in > inline comments. > > Fix and consolidate 82543/82547 hwcsum exemption. > > While here rearrange and expand some commentary. > --- > sys/dev/e1000/em_txrx.c | 37 +++++++++++++++++++++++-------------- > sys/dev/e1000/if_em.c | 11 ++++------- > 2 files changed, 27 insertions(+), 21 deletions(-) > > diff --git a/sys/dev/e1000/em_txrx.c b/sys/dev/e1000/em_txrx.c > index 8b1d2817490f..0e433f388ac5 100644 > --- a/sys/dev/e1000/em_txrx.c > +++ b/sys/dev/e1000/em_txrx.c > @@ -186,7 +186,7 @@ em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi= , uint32_t *txd_upper, > TXD->tcp_seg_setup.fields.hdr_len =3D hdr_len; > > /* > - * 8254x SDM4.0 page 45, and PCIe GbE SDM2.5 page 63 > + * "PCI/PCI-X SDM 4.0" page 45, and "PCIe GbE SDM 2.5" page 63 > * - Set up basic TUCMDs > * - Enable IP bit on 82544 > * - For others IP bit on indicates IPv4, while off indicates IPv= 6 > @@ -212,10 +212,6 @@ em_tso_setup(struct e1000_softc *sc, if_pkt_info_t p= i, uint32_t *txd_upper, > return (cur); > } > > -#define TSO_WORKAROUND 4 > -#define DONT_FORCE_CTX 1 > - > - > /********************************************************************* > * The offload context is protocol specific (TCP/UDP) and thus > * only needs to be set when the protocol changes. The occasion > @@ -232,6 +228,7 @@ em_tso_setup(struct e1000_softc *sc, if_pkt_info_t pi= , uint32_t *txd_upper, > * in turn greatly slow down performance to send small sized > * frames. > **********************************************************************/ > +#define DONT_FORCE_CTX 1 > > static int > em_transmit_checksum_setup(struct e1000_softc *sc, if_pkt_info_t pi, > @@ -271,20 +268,30 @@ em_transmit_checksum_setup(struct e1000_softc *sc, = if_pkt_info_t pi, > } > > TXD =3D (struct e1000_context_desc *)&txr->tx_base[cur]; > + /* > + * ipcss - Start offset for header checksum calculation. > + * ipcse - End offset for header checksum calculation. > + * ipcso - Offset of place to put the checksum. > + * > + * We set ipcsX values regardless of IP version to work around HW= issues > + * and ipcse must be 0 for IPv6 per "PCIe GbE SDM 2.5" page 61. > + * IXSM controls whether it's inserted. > + */ > + TXD->lower_setup.ip_fields.ipcss =3D pi->ipi_ehdrlen; > + TXD->lower_setup.ip_fields.ipcso =3D pi->ipi_ehdrlen + > + offsetof(struct ip, ip_sum); > if (csum_flags & CSUM_IP) { > *txd_upper |=3D E1000_TXD_POPTS_IXSM << 8; > - /* > - * Start offset for header checksum calculation. > - * End offset for header checksum calculation. > - * Offset of place to put the checksum. > - */ > - TXD->lower_setup.ip_fields.ipcss =3D pi->ipi_ehdrlen; > TXD->lower_setup.ip_fields.ipcse =3D htole16(hdr_len); > - TXD->lower_setup.ip_fields.ipcso =3D pi->ipi_ehdrlen + > - offsetof(struct ip, ip_sum); > cmd |=3D E1000_TXD_CMD_IP; > - } > + } else if (csum_flags & (CSUM_IP6_TCP | CSUM_IP6_UDP)) > + TXD->lower_setup.ip_fields.ipcse =3D htole16(0); > > + /* > + * tucss - Start offset for payload checksum calculation. > + * tucse - End offset for payload checksum calculation. > + * tucso - Offset of place to put the checksum. > + */ > if (csum_flags & (CSUM_TCP | CSUM_UDP | CSUM_IP6_TCP | CSUM_IP6_U= DP)) { > uint8_t tucso; > > @@ -320,6 +327,8 @@ em_transmit_checksum_setup(struct e1000_softc *sc, if= _pkt_info_t pi, > return (cur); > } > > +#define TSO_WORKAROUND 4 /* TSO sentinel descriptor */ > + > static int > em_isc_txd_encap(void *arg, if_pkt_info_t pi) > { > diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c > index 0da1f0a2dc67..32d8c3282e33 100644 > --- a/sys/dev/e1000/if_em.c > +++ b/sys/dev/e1000/if_em.c > @@ -948,15 +948,13 @@ em_if_attach_pre(if_ctx_t ctx) > scctx->isc_tx_csum_flags =3D CSUM_TCP | CSUM_UDP | CSUM_I= P_TSO | > CSUM_IP6_TCP | CSUM_IP6_UDP; > > - /* 8254x SDM4.0 page 33 - FDX requirement on these chips = */ > - if (hw->mac.type =3D=3D e1000_82547 || hw->mac.type =3D= =3D e1000_82547_rev_2) > + /* "PCI/PCI-X SDM 4.0" page 33 (b) - FDX requirement on t= hese chips */ > + if (hw->mac.type < e1000_82543 || hw->mac.type =3D=3D e10= 00_82547 || > + hw->mac.type =3D=3D e1000_82547_rev_2) > scctx->isc_capenable &=3D ~(IFCAP_HWCSUM|IFCAP_VL= AN_HWCSUM); > - > - if (hw->mac.type < e1000_82543) > - scctx->isc_capabilities &=3D ~(IFCAP_HWCSUM|IFCAP= _VLAN_HWCSUM); > /* 82541ER doesn't do HW tagging */ > if (hw->device_id =3D=3D E1000_DEV_ID_82541ER || hw->devi= ce_id =3D=3D E1000_DEV_ID_82541ER_LOM) > - scctx->isc_capabilities &=3D ~IFCAP_VLAN_HWTAGGIN= G; > + scctx->isc_capenable &=3D ~IFCAP_VLAN_HWTAGGING; > /* INTx only */ > scctx->isc_msix_bar =3D 0; > } > @@ -1352,7 +1350,6 @@ em_if_init(if_ctx_t ctx) > E1000_RAR_ENTRIES - 1); > } > > - > /* Initialize the hardware */ > em_reset(ctx); > em_if_update_admin_status(ctx); >