From owner-svn-src-user@FreeBSD.ORG Mon Jun 21 14:25:45 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21E2F1065670; Mon, 21 Jun 2010 14:25:45 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 115AE8FC1F; Mon, 21 Jun 2010 14:25:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5LEPilJ048319; Mon, 21 Jun 2010 14:25:44 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5LEPiER048315; Mon, 21 Jun 2010 14:25:44 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006211425.o5LEPiER048315@svn.freebsd.org> From: Juli Mallett Date: Mon, 21 Jun 2010 14:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209396 - user/jmallett/octeon/sys/mips/cavium/octe X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 14:25:45 -0000 Author: jmallett Date: Mon Jun 21 14:25:44 2010 New Revision: 209396 URL: http://svn.freebsd.org/changeset/base/209396 Log: o) Support TCP and UDP checksum offload. XXX We also check IP on input but don't insert IP on output, so it would sure be nice to have a way to signal support for RXCSUM != TXCSUM. o) Note support for VLAN MTUs as well as hardware VLAN tagging. o) Attempt to use hardware VLAN tagging on receive; I haven't yet gotten this to work and there isn't an obvious way to insert tags on transmit that I've found yet, either. o) Remove a stale comment about MII. Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c user/jmallett/octeon/sys/mips/cavium/octe/octe.c Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Mon Jun 21 13:59:49 2010 (r209395) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c Mon Jun 21 14:25:44 2010 (r209396) @@ -326,6 +326,11 @@ void cvm_oct_tasklet_rx(void *context, i m->m_pkthdr.csum_data = 0xffff; } + if (work->word2.s.vlan_valid) { + m->m_pkthdr.ether_vtag = work->word2.s.vlan_id; + m->m_flags |= M_VLANTAG; + } + if (priv->intercept_cb) { callback_result = priv->intercept_cb(ifp, work, m); Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c Mon Jun 21 13:59:49 2010 (r209395) +++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c Mon Jun 21 14:25:44 2010 (r209396) @@ -291,15 +291,11 @@ dont_put_mbuf_in_hw: #endif /* REUSE_MBUFS_WITHOUT_FREE */ /* Check if we can use the hardware checksumming */ -#if 0 - if (USE_HW_TCPUDP_CHECKSUM && (m->protocol == htons(ETH_P_IP)) && - (ip_hdr(m)->version == 4) && (ip_hdr(m)->ihl == 5) && - ((ip_hdr(m)->frag_off == 0) || (ip_hdr(m)->frag_off == 1<<14)) && - ((ip_hdr(m)->protocol == IP_PROTOCOL_TCP) || (ip_hdr(m)->protocol == IP_PROTOCOL_UDP))) { + if (USE_HW_TCPUDP_CHECKSUM && + (m->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) != 0) { /* Use hardware checksum calc */ - pko_command.s.ipoffp1 = sizeof(struct ethhdr) + 1; + pko_command.s.ipoffp1 = ETHER_HDR_LEN + 1; } -#endif if (USE_ASYNC_IOBDMA) { /* Get the number of mbufs in use by the hardware */ Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/octe/octe.c Mon Jun 21 13:59:49 2010 (r209395) +++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c Mon Jun 21 14:25:44 2010 (r209396) @@ -32,10 +32,6 @@ * XXX This file should be moved to if_octe.c * XXX The driver may have sufficient locking but we need locking to protect * the interfaces presented here, right? - * XXX There is a common MII bus on Octeon, we get the identifier of our PHY - * in priv->phy_id; right now we attach all the PHYs to each interface, - * which is clearly wrong. Need to either modify miibus or probe and - * attach the specific PHY for each interface without an miibus in between. */ #include "opt_inet.h" @@ -59,6 +55,7 @@ #include #include #include +#include #ifdef INET #include @@ -186,6 +183,11 @@ octe_attach(device_t dev) ether_ifattach(ifp, priv->mac); + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); + ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | IFCAP_HWCSUM; + ifp->if_capenable = ifp->if_capabilities; + ifp->if_hwassist = CSUM_TCP | CSUM_UDP; + OCTE_TX_LOCK(priv); IFQ_SET_MAXLEN(&ifp->if_snd, MAX_OUT_QUEUE_DEPTH); ifp->if_snd.ifq_drv_maxlen = MAX_OUT_QUEUE_DEPTH;