aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2006-01-13 11:51:11 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2006-01-13 11:51:11 +0000
commit320551f33b90d7372e8b7c56739dc2cc0c466208 (patch)
treea8ea4140725c28f7641d2dfedeeef9484301e9ec /sys
parent2c6192958c8961773ff001f7f4885bc171658054 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/bge/if_bge.c7
-rw-r--r--sys/dev/em/if_em.c4
-rw-r--r--sys/dev/ixgb/if_ixgb.c3
-rw-r--r--sys/dev/nge/if_nge.c4
-rw-r--r--sys/dev/re/if_re.c7
-rw-r--r--sys/dev/txp/if_txp.c5
-rw-r--r--sys/dev/vge/if_vge.c7
-rw-r--r--sys/net/if_vlan.c2
-rw-r--r--sys/net/if_vlan_var.h20
-rw-r--r--sys/net80211/ieee80211_input.c5
-rw-r--r--sys/pci/if_ti.c7
11 files changed, 45 insertions, 26 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index 91f74218721e..a7a7432b369a 100644
--- a/sys/dev/bge/if_bge.c
+++ b/sys/dev/bge/if_bge.c
@@ -2861,8 +2861,11 @@ bge_rxeof(sc)
* If we received a packet with a vlan tag,
* attach that information to the packet.
*/
- if (have_tag)
- VLAN_INPUT_TAG(ifp, m, vlan_tag, continue);
+ if (have_tag) {
+ VLAN_INPUT_TAG(ifp, m, vlan_tag);
+ if (m == NULL)
+ continue;
+ }
BGE_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c
index 96056657e235..690f9dc3f5b1 100644
--- a/sys/dev/em/if_em.c
+++ b/sys/dev/em/if_em.c
@@ -3017,9 +3017,7 @@ em_process_receive_interrupts(struct adapter * adapter, int count)
if (current_desc->status & E1000_RXD_STAT_VP)
VLAN_INPUT_TAG(ifp, adapter->fmp,
(le16toh(current_desc->special) &
- E1000_RXD_SPC_VLAN_MASK),
- adapter->fmp = NULL);
-
+ E1000_RXD_SPC_VLAN_MASK));
m = adapter->fmp;
adapter->fmp = NULL;
adapter->lmp = NULL;
diff --git a/sys/dev/ixgb/if_ixgb.c b/sys/dev/ixgb/if_ixgb.c
index 4c79d0179327..789eab1a551f 100644
--- a/sys/dev/ixgb/if_ixgb.c
+++ b/sys/dev/ixgb/if_ixgb.c
@@ -2152,8 +2152,7 @@ ixgb_process_receive_interrupts(struct adapter * adapter, int count)
adapter->fmp);
if (current_desc->status & IXGB_RX_DESC_STATUS_VP)
VLAN_INPUT_TAG(ifp, adapter->fmp,
- current_desc->special,
- adapter->fmp = NULL);
+ current_desc->special);
if (adapter->fmp != NULL) {
IXGB_UNLOCK(adapter);
diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c
index 94a1af17b52d..de06db0bd17d 100644
--- a/sys/dev/nge/if_nge.c
+++ b/sys/dev/nge/if_nge.c
@@ -1229,7 +1229,9 @@ nge_rxeof(sc)
*/
if (extsts & NGE_RXEXTSTS_VLANPKT) {
VLAN_INPUT_TAG(ifp, m,
- ntohs(extsts & NGE_RXEXTSTS_VTCI), continue);
+ ntohs(extsts & NGE_RXEXTSTS_VTCI));
+ if (m == NULL)
+ continue;
}
NGE_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c
index e9710e78aa20..1a933524149e 100644
--- a/sys/dev/re/if_re.c
+++ b/sys/dev/re/if_re.c
@@ -1670,9 +1670,12 @@ re_rxeof(sc)
}
}
- if (rxvlan & RL_RDESC_VLANCTL_TAG)
+ if (rxvlan & RL_RDESC_VLANCTL_TAG) {
VLAN_INPUT_TAG(ifp, m,
- ntohs((rxvlan & RL_RDESC_VLANCTL_DATA)), continue);
+ ntohs((rxvlan & RL_RDESC_VLANCTL_DATA)));
+ if (m == NULL)
+ continue;
+ }
RL_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
RL_LOCK(sc);
diff --git a/sys/dev/txp/if_txp.c b/sys/dev/txp/if_txp.c
index 6a8e41eda386..1f65ff294e3d 100644
--- a/sys/dev/txp/if_txp.c
+++ b/sys/dev/txp/if_txp.c
@@ -766,8 +766,9 @@ txp_rx_reclaim(sc, r)
}
if (rxd->rx_stat & RX_STAT_VLAN) {
- VLAN_INPUT_TAG(ifp,
- m, htons(rxd->rx_vlan >> 16), goto next);
+ VLAN_INPUT_TAG(ifp, m, htons(rxd->rx_vlan >> 16));
+ if (m == NULL)
+ goto next;
}
TXP_UNLOCK(sc);
diff --git a/sys/dev/vge/if_vge.c b/sys/dev/vge/if_vge.c
index 3ed3081094ed..b4bb12a0d2f1 100644
--- a/sys/dev/vge/if_vge.c
+++ b/sys/dev/vge/if_vge.c
@@ -1490,9 +1490,12 @@ vge_rxeof(sc)
}
}
- if (rxstat & VGE_RDSTS_VTAG)
+ if (rxstat & VGE_RDSTS_VTAG) {
VLAN_INPUT_TAG(ifp, m,
- ntohs((rxctl & VGE_RDCTL_VLANID)), continue);
+ ntohs((rxctl & VGE_RDCTL_VLANID)));
+ if (m == NULL)
+ continue;
+ }
VGE_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index ecf7f8b7a5cf..17a0baf0ec3f 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -509,7 +509,7 @@ vlan_start(struct ifnet *ifp)
m_freem(m);
continue;
}
- *(u_int*)(mtag + 1) = ifv->ifv_tag;
+ VLAN_TAG_VALUE(mtag) = ifv->ifv_tag;
m_tag_prepend(m, mtag);
m->m_flags |= M_VLANTAG;
} else {
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
index 11cbf7b20fcf..b1fecf6cd883 100644
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -96,24 +96,30 @@ struct vlanreq {
#define MTAG_VLAN 1035328035
#define MTAG_VLAN_TAG 0 /* tag of VLAN interface */
-#define VLAN_INPUT_TAG(_ifp, _m, _t, _errcase) do { \
+/*
+ * This macro must expand to a lvalue so that it can be used
+ * to set a tag with a simple assignment.
+ */
+#define VLAN_TAG_VALUE(_mt) (*(u_int *)((_mt) + 1))
+
+#define VLAN_INPUT_TAG(_ifp, _m, _t) do { \
struct m_tag *mtag; \
mtag = m_tag_alloc(MTAG_VLAN, MTAG_VLAN_TAG, \
sizeof (u_int), M_NOWAIT); \
- if (mtag == NULL) { \
+ if (mtag != NULL) { \
+ VLAN_TAG_VALUE(mtag) = (_t); \
+ m_tag_prepend((_m), mtag); \
+ (_m)->m_flags |= M_VLANTAG; \
+ } else { \
(_ifp)->if_ierrors++; \
m_freem(_m); \
- _errcase; \
+ _m = NULL; \
} \
- *(u_int *)(mtag+1) = (_t); \
- m_tag_prepend((_m), mtag); \
- (_m)->m_flags |= M_VLANTAG; \
} while (0)
#define VLAN_OUTPUT_TAG(_ifp, _m) \
((_m)->m_flags & M_VLANTAG ? \
m_tag_locate((_m), MTAG_VLAN, MTAG_VLAN_TAG, NULL) : NULL)
-#define VLAN_TAG_VALUE(_mt) (*(u_int *)((_mt)+1))
#endif /* _KERNEL */
#endif /* _NET_IF_VLAN_VAR_H_ */
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 80a64d701bdd..5e3b2f726305 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -710,8 +710,9 @@ ieee80211_deliver_data(struct ieee80211com *ic,
if (m != NULL) {
if (ni->ni_vlan != 0) {
/* attach vlan tag */
- /* XXX goto err? */
- VLAN_INPUT_TAG(ifp, m, ni->ni_vlan, goto out);
+ VLAN_INPUT_TAG(ifp, m, ni->ni_vlan);
+ if (m == NULL)
+ goto out; /* XXX goto err? */
}
(*ifp->if_input)(ifp, m);
}
diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c
index a6126df1834e..0cdd3a94ada9 100644
--- a/sys/pci/if_ti.c
+++ b/sys/pci/if_ti.c
@@ -2532,8 +2532,11 @@ ti_rxeof(sc)
* If we received a packet with a vlan tag,
* tag it before passing the packet upward.
*/
- if (have_tag)
- VLAN_INPUT_TAG(ifp, m, vlan_tag, continue);
+ if (have_tag) {
+ VLAN_INPUT_TAG(ifp, m, vlan_tag);
+ if (m == NULL)
+ continue;
+ }
TI_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
TI_LOCK(sc);