Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys VLAN ID uses pkthdr instead of mtag now. Contributed by ...
details: https://anonhg.NetBSD.org/src/rev/ce46fac97b2c
branches: trunk
changeset: 356435:ce46fac97b2c
user: knakahara <knakahara%NetBSD.org@localhost>
date: Tue Sep 26 07:42:05 2017 +0000
description:
VLAN ID uses pkthdr instead of mtag now. Contributed by s-yamaguchi@IIJ.
I just commit by proxy. Reviewed by joerg@n.o and christos@n.o, thanks.
See http://mail-index.netbsd.org/tech-net/2017/09/26/msg006459.html
XXX need pullup to -8 branch
diffstat:
sys/arch/powerpc/booke/dev/pq3etsec.c | 20 ++++++++-------
sys/arch/x86/pci/if_vmx.c | 17 ++++--------
sys/dev/ic/i82557.c | 23 ++++-------------
sys/dev/ic/rtl8169.c | 14 ++++------
sys/dev/pci/cxgb/cxgb_sge.c | 13 ++++-----
sys/dev/pci/if_age.c | 14 +++-------
sys/dev/pci/if_alc.c | 11 +++-----
sys/dev/pci/if_ale.c | 13 +++------
sys/dev/pci/if_bge.c | 18 +++++++-------
sys/dev/pci/if_bnx.c | 14 +++-------
sys/dev/pci/if_jme.c | 12 +++-----
sys/dev/pci/if_nfe.c | 9 +++---
sys/dev/pci/if_sip.c | 12 +++-----
sys/dev/pci/if_stge.c | 16 +++++++-----
sys/dev/pci/if_ti.c | 20 ++++++---------
sys/dev/pci/if_txp.c | 12 +++-----
sys/dev/pci/if_vge.c | 13 +++------
sys/dev/pci/if_wm.c | 23 +++++++-----------
sys/dev/pci/ixgbe/ix_txrx.c | 23 +++++------------
sys/net/agr/if_agrether_hash.c | 9 +++---
sys/net/if_ether.h | 44 +++++++++++++++-------------------
sys/net/if_ethersubr.c | 6 ++--
sys/net/if_vlan.c | 42 +++++++-------------------------
sys/net80211/ieee80211_input.c | 16 +++---------
sys/net80211/ieee80211_output.c | 9 +++---
sys/sys/mbuf.h | 17 +++++++++---
26 files changed, 176 insertions(+), 264 deletions(-)
diffs (truncated from 1433 to 300 lines):
diff -r 7e538bf63be6 -r ce46fac97b2c sys/arch/powerpc/booke/dev/pq3etsec.c
--- a/sys/arch/powerpc/booke/dev/pq3etsec.c Tue Sep 26 04:34:59 2017 +0000
+++ b/sys/arch/powerpc/booke/dev/pq3etsec.c Tue Sep 26 07:42:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pq3etsec.c,v 1.29 2016/12/15 09:28:04 ozaki-r Exp $ */
+/* $NetBSD: pq3etsec.c,v 1.30 2017/09/26 07:42:05 knakahara Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.29 2016/12/15 09:28:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.30 2017/09/26 07:42:05 knakahara Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -1512,8 +1512,7 @@
const struct rxfcb *fcb)
{
if (fcb->rxfcb_flags & RXFCB_VLN) {
- VLAN_INPUT_TAG(&sc->sc_if, m, fcb->rxfcb_vlctl,
- m_freem(m); return false);
+ vlan_set_tag(m, fcb->rxfcb_vlctl);
}
if ((fcb->rxfcb_flags & RXFCB_IP) == 0
|| (fcb->rxfcb_flags & (RXFCB_CIP|RXFCB_CTU)) == 0)
@@ -1991,14 +1990,18 @@
{
struct mbuf *m = *mp;
u_int csum_flags = m->m_pkthdr.csum_flags;
- struct m_tag *vtag = VLAN_OUTPUT_TAG(&sc->sc_ec, m);
+ bool have_vtag;
+ uint16_t vtag;
KASSERT(m->m_flags & M_PKTHDR);
+ have_vtag = vlan_has_tag(m);
+ vtag = vlan_get_tag(m);
+
/*
* Let see if we are doing any offload first.
*/
- if (csum_flags == 0 && vtag == 0) {
+ if (csum_flags == 0 && !have_vtag) {
m->m_flags &= ~M_HASFCB;
return;
}
@@ -2012,7 +2015,7 @@
| ((csum_flags & M_CSUM_CIP) ? TXFCB_CIP : 0)
| ((csum_flags & M_CSUM_CTU) ? TXFCB_CTU : 0);
}
- if (vtag) {
+ if (have_vtag) {
flags |= TXFCB_VLN;
}
if (flags == 0) {
@@ -2028,7 +2031,7 @@
fcb.txfcb_l4os = M_CSUM_DATA_IPv6_HL(m->m_pkthdr.csum_data);
fcb.txfcb_l3os = ETHER_HDR_LEN;
fcb.txfcb_phcs = 0;
- fcb.txfcb_vlctl = vtag ? VLAN_TAG_VALUE(vtag) & 0xffff : 0;
+ fcb.txfcb_vlctl = have_vtag ? vtag : 0;
#if 0
printf("%s: csum_flags=%#x: txfcb flags=%#x lsos=%u l4os=%u phcs=%u vlctl=%#x\n",
@@ -2063,7 +2066,6 @@
panic("%s: impossible M_CSUM flags %#x",
device_xname(sc->sc_dev), csum_flags);
#endif
- } else if (vtag) {
}
m->m_flags &= ~M_HASFCB;
diff -r 7e538bf63be6 -r ce46fac97b2c sys/arch/x86/pci/if_vmx.c
--- a/sys/arch/x86/pci/if_vmx.c Tue Sep 26 04:34:59 2017 +0000
+++ b/sys/arch/x86/pci/if_vmx.c Tue Sep 26 07:42:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vmx.c,v 1.19 2017/02/20 09:02:01 knakahara Exp $ */
+/* $NetBSD: if_vmx.c,v 1.20 2017/09/26 07:42:05 knakahara Exp $ */
/* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */
/*
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19 2017/02/20 09:02:01 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.20 2017/09/26 07:42:05 knakahara Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -1979,12 +1979,8 @@
if (!rxcd->no_csum)
vmxnet3_rx_csum(rxcd, m);
- if (rxcd->vlan) {
- VLAN_INPUT_TAG(ifp, m, rxcd->vtag,
- rxq->vxrxq_stats.vmrxs_ierrors++;
- m_freem(m);
- return);
- }
+ if (rxcd->vlan)
+ vlan_set_tag(m, rxcd->vtag);
rxq->vxrxq_stats.vmrxs_ipackets++;
rxq->vxrxq_stats.vmrxs_ibytes += m->m_pkthdr.len;
@@ -2638,7 +2634,6 @@
struct mbuf *m;
bus_dmamap_t dmap;
bus_dma_segment_t *segs;
- struct m_tag *mtag;
int i, gen, start, csum_start, nsegs, error;
sc = txq->vxtxq_sc;
@@ -2701,9 +2696,9 @@
txd->eop = 1;
txd->compreq = 1;
- if ((mtag = VLAN_OUTPUT_TAG(&sc->vmx_ethercom, m)) != NULL) {
+ if (vlan_has_tag(m)) {
sop->vtag_mode = 1;
- sop->vtag = VLAN_TAG_VALUE(mtag);
+ sop->vtag = vlan_get_tag(m);
}
if (m->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6)) {
diff -r 7e538bf63be6 -r ce46fac97b2c sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c Tue Sep 26 04:34:59 2017 +0000
+++ b/sys/dev/ic/i82557.c Tue Sep 26 07:42:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557.c,v 1.147 2017/02/20 07:43:29 ozaki-r Exp $ */
+/* $NetBSD: i82557.c,v 1.148 2017/09/26 07:42:06 knakahara Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.147 2017/02/20 07:43:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.148 2017/09/26 07:42:06 knakahara Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -944,7 +944,6 @@
KASSERT((csum_flags & (M_CSUM_TCPv6 | M_CSUM_UDPv6)) == 0);
if (sc->sc_flags & FXPF_EXT_RFA) {
- struct m_tag *vtag;
struct fxp_ipcb *ipcb;
/*
* Deal with TCP/IP checksum offload. Note that
@@ -979,10 +978,8 @@
/*
* request VLAN tag insertion if needed.
*/
- vtag = VLAN_OUTPUT_TAG(&sc->sc_ethercom, m0);
- if (vtag) {
- ipcb->ipcb_vlan_id =
- htobe16(*(u_int *)(vtag + 1));
+ if (vlan_has_tag(m0)) {
+ ipcb->ipcb_vlan_id = htobe16(vlan_get_tag(m0));
ipcb->ipcb_ip_activation_high |=
FXP_IPCB_INSERTVLAN_ENABLE;
}
@@ -1403,16 +1400,8 @@
* check VLAN tag stripping.
*/
if ((sc->sc_flags & FXPF_EXT_RFA) != 0 &&
- (rfa->rfa_status & htole16(FXP_RFA_STATUS_VLAN)) != 0) {
- struct m_tag *vtag;
-
- vtag = m_tag_get(PACKET_TAG_VLAN, sizeof(u_int),
- M_NOWAIT);
- if (vtag == NULL)
- goto dropit;
- *(u_int *)(vtag + 1) = be16toh(rfa->vlan_id);
- m_tag_prepend(m, vtag);
- }
+ (rfa->rfa_status & htole16(FXP_RFA_STATUS_VLAN)) != 0)
+ vlan_set_tag(m, be16toh(rfa->vlan_id));
/* Do checksum checking. */
if ((ifp->if_csum_flags_rx & (M_CSUM_TCPv4|M_CSUM_UDPv4)) != 0)
diff -r 7e538bf63be6 -r ce46fac97b2c sys/dev/ic/rtl8169.c
--- a/sys/dev/ic/rtl8169.c Tue Sep 26 04:34:59 2017 +0000
+++ b/sys/dev/ic/rtl8169.c Tue Sep 26 07:42:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtl8169.c,v 1.151 2017/05/16 06:16:35 snj Exp $ */
+/* $NetBSD: rtl8169.c,v 1.152 2017/09/26 07:42:06 knakahara Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.151 2017/05/16 06:16:35 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.152 2017/09/26 07:42:06 knakahara Exp $");
/* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
/*
@@ -1345,9 +1345,8 @@
}
if (rxvlan & RE_RDESC_VLANCTL_TAG) {
- VLAN_INPUT_TAG(ifp, m,
- bswap16(rxvlan & RE_RDESC_VLANCTL_DATA),
- continue);
+ vlan_set_tag(m,
+ bswap16(rxvlan & RE_RDESC_VLANCTL_DATA));
}
if_percpuq_enqueue(ifp->if_percpuq, m);
}
@@ -1515,7 +1514,6 @@
bus_dmamap_t map;
struct re_txq *txq;
struct re_desc *d;
- struct m_tag *mtag;
uint32_t cmdstat, re_flags, vlanctl;
int ofree, idx, error, nsegs, seg;
int startdesc, curdesc, lastdesc;
@@ -1640,8 +1638,8 @@
* appear in all descriptors of a multi-descriptor
* transmission attempt.
*/
- if ((mtag = VLAN_OUTPUT_TAG(&sc->ethercom, m)) != NULL)
- vlanctl |= bswap16(VLAN_TAG_VALUE(mtag)) |
+ if (vlan_has_tag(m))
+ vlanctl |= bswap16(vlan_get_tag(m)) |
RE_TDESC_VLANCTL_TAG;
/*
diff -r 7e538bf63be6 -r ce46fac97b2c sys/dev/pci/cxgb/cxgb_sge.c
--- a/sys/dev/pci/cxgb/cxgb_sge.c Tue Sep 26 04:34:59 2017 +0000
+++ b/sys/dev/pci/cxgb/cxgb_sge.c Tue Sep 26 07:42:05 2017 +0000
@@ -28,7 +28,7 @@
***************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cxgb_sge.c,v 1.4 2016/06/10 13:27:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxgb_sge.c,v 1.5 2017/09/26 07:42:06 knakahara Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1198,8 +1198,8 @@
* XXX need to add VLAN support for 6.x
*/
#ifdef VLAN_SUPPORTED
- if (m0->m_flags & M_VLANTAG)
- cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(m0->m_pkthdr.ether_vtag);
+ if (vlan_has_tag(m0))
+ cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(vlan_get_tag(m0));
if (m0->m_pkthdr.csum_flags & (CSUM_TSO))
tso_info = V_LSO_MSS(m0->m_pkthdr.tso_segsz);
#endif
@@ -1222,7 +1222,7 @@
}
#ifdef VLAN_SUPPORTED
- if (__predict_false(m0->m_flags & M_VLANTAG)) {
+ if (vlan_has_tag(m0)) {
eth_type = CPL_ETH_II_VLAN;
ip = (struct ip *)(pkthdr + ETHER_HDR_LEN +
ETHER_VLAN_ENCAP_LEN);
@@ -2163,9 +2163,8 @@
* XXX need to add VLAN support for 6.x
*/
#ifdef VLAN_SUPPORTED
- if (__predict_false(cpl->vlan_valid)) {
- m->m_pkthdr.ether_vtag = ntohs(cpl->vlan);
- m->m_flags |= M_VLANTAG;
+ if (cpl->vlan_valid) {
+ vlan_set_tag(ntohs(cpl->vlan));
}
#endif
diff -r 7e538bf63be6 -r ce46fac97b2c sys/dev/pci/if_age.c
--- a/sys/dev/pci/if_age.c Tue Sep 26 04:34:59 2017 +0000
+++ b/sys/dev/pci/if_age.c Tue Sep 26 07:42:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_age.c,v 1.50 2016/12/15 09:28:05 ozaki-r Exp $ */
+/* $NetBSD: if_age.c,v 1.51 2017/09/26 07:42:06 knakahara Exp $ */
/* $OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $ */
/*-
@@ -31,7 +31,7 @@
/* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.50 2016/12/15 09:28:05 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.51 2017/09/26 07:42:06 knakahara Exp $");
#include "vlan.h"
@@ -1190,9 +1190,6 @@
bus_dmamap_t map;
uint32_t cflags, poff, vtag;
Home |
Main Index |
Thread Index |
Old Index