From 635ee237b0ffaeaa656517043030e94b55276f5a Mon Sep 17 00:00:00 2001 From: yamt Date: Thu, 19 Feb 2004 14:21:40 +0000 Subject: [PATCH] support h/w assisted vlan tag insertion. --- sys/dev/ic/i82557.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/i82557.c b/sys/dev/ic/i82557.c index cc7c196d986c..7e7261234888 100644 --- a/sys/dev/ic/i82557.c +++ b/sys/dev/ic/i82557.c @@ -1,4 +1,4 @@ -/* $NetBSD: i82557.c,v 1.80 2004/02/19 13:34:51 yamt Exp $ */ +/* $NetBSD: i82557.c,v 1.81 2004/02/19 14:21:40 yamt Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.80 2004/02/19 13:34:51 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.81 2004/02/19 14:21:40 yamt Exp $"); #include "bpfilter.h" #include "rnd.h" @@ -404,6 +404,7 @@ fxp_attach(struct fxp_softc *sc) */ ifp->if_capabilities = /*IFCAP_CSUM_IPv4 |*/ IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4; + sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_HWTAGGING; } /* @@ -1016,6 +1017,21 @@ fxp_start(struct ifnet *ifp) ipcb->ipcb_ip_schedule |= FXP_IPCB_TCPUDP_CHECKSUM_ENABLE; } + + /* + * request VLAN tag insertion if needed. + */ + if (sc->sc_ethercom.ec_nvlans != 0) { + struct m_tag *vtag; + + vtag = m_tag_find(m0, PACKET_TAG_VLAN, NULL); + if (vtag) { + ipcb->ipcb_vlan_id = + htobe16(*(u_int *)(vtag + 1)); + ipcb->ipcb_ip_activation_high |= + FXP_IPCB_INSERTVLAN_ENABLE; + } + } } else { KASSERT((csum_flags & (M_CSUM_IPv4 | M_CSUM_TCPv4 | M_CSUM_UDPv4)) == 0);