support h/w assisted vlan tag insertion.

This commit is contained in:
yamt 2004-02-19 14:21:40 +00:00
parent 9324f158e1
commit 635ee237b0
1 changed files with 18 additions and 2 deletions

View File

@ -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 <sys/cdefs.h>
__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);