From owner-svn-src-head@FreeBSD.ORG Tue Feb 24 21:31:14 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 657BB262; Tue, 24 Feb 2015 21:31:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37261BB7; Tue, 24 Feb 2015 21:31:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1OLVDYb046976; Tue, 24 Feb 2015 21:31:13 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1OLVDsE046975; Tue, 24 Feb 2015 21:31:13 GMT (envelope-from np@FreeBSD.org) Message-Id: <201502242131.t1OLVDsE046975@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 24 Feb 2015 21:31:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279251 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2015 21:31:14 -0000 Author: np Date: Tue Feb 24 21:31:13 2015 New Revision: 279251 URL: https://svnweb.freebsd.org/changeset/base/279251 Log: cxgbe(4): allow tx hardware checksumming on the netmap interface. It is disabled by default but users can set IFCAP_TXCSUM on the netmap ifnet (ifconfig ncxl0 txcsum) to override netmap and force the hardware to calculate and insert proper IP and L4 checksums in outbound frames. MFC after: 2 weeks Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Tue Feb 24 21:16:57 2015 (r279250) +++ head/sys/dev/cxgbe/t4_netmap.c Tue Feb 24 21:31:13 2015 (r279251) @@ -681,7 +681,7 @@ int lazy_tx_credit_flush = 1; */ static void cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_txq, - struct netmap_kring *kring, int npkt, int npkt_remaining) + struct netmap_kring *kring, int npkt, int npkt_remaining, int txcsum) { struct netmap_ring *ring = kring->ring; struct netmap_slot *slot; @@ -717,10 +717,12 @@ cxgbe_nm_tx(struct adapter *sc, struct s * checksum offloading, TCP segmentation offloading, * encryption, VLAN encapsulation/decapsulation, etc." * - * XXXNM: it makes sense to enable checksum offload. + * So the ncxl interfaces have tx hardware checksumming + * disabled by default. But you can override netmap by + * enabling IFCAP_TXCSUM on the interface manully. */ - cpl->ctrl1 = htobe64(F_TXPKT_IPCSUM_DIS | - F_TXPKT_L4CSUM_DIS); + cpl->ctrl1 = txcsum ? 0 : + htobe64(F_TXPKT_IPCSUM_DIS | F_TXPKT_L4CSUM_DIS); usgl = (void *)(cpl + 1); usgl->cmd_nsge = htobe32(V_ULPTX_CMD(ULP_TX_SC_DSGL) | @@ -833,7 +835,7 @@ cxgbe_netmap_txsync(struct netmap_kring struct sge_nm_txq *nm_txq = &sc->sge.nm_txq[pi->first_nm_txq + kring->ring_id]; const u_int head = kring->rhead; u_int reclaimed = 0; - int n, d, npkt_remaining, ndesc_remaining; + int n, d, npkt_remaining, ndesc_remaining, txcsum; /* * Tx was at kring->nr_hwcur last time around and now we need to advance @@ -844,6 +846,7 @@ cxgbe_netmap_txsync(struct netmap_kring npkt_remaining = head >= kring->nr_hwcur ? head - kring->nr_hwcur : kring->nkr_num_slots - kring->nr_hwcur + head; + txcsum = ifp->if_capenable & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6); while (npkt_remaining) { reclaimed += reclaim_nm_tx_desc(nm_txq); ndesc_remaining = contiguous_ndesc_available(nm_txq); @@ -867,7 +870,7 @@ cxgbe_netmap_txsync(struct netmap_kring /* Send n packets and update nm_txq->pidx and kring->nr_hwcur */ npkt_remaining -= n; - cxgbe_nm_tx(sc, nm_txq, kring, n, npkt_remaining); + cxgbe_nm_tx(sc, nm_txq, kring, n, npkt_remaining, txcsum); } MPASS(npkt_remaining == 0); MPASS(kring->nr_hwcur == head);