Date: Mon, 21 Jun 2010 14:25:44 +0000 (UTC) From: Juli Mallett <jmallett@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r209396 - user/jmallett/octeon/sys/mips/cavium/octe Message-ID: <201006211425.o5LEPiER048315@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <net/if.h> #include <net/if_media.h> #include <net/if_types.h> +#include <net/if_vlan_var.h> #ifdef INET #include <netinet/in.h> @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006211425.o5LEPiER048315>