em(4) VLAN + PROMISC still doesn't work with latest CVS version
Robert Watson
rwatson at freebsd.org
Wed Dec 8 03:54:21 PST 2004
On Wed, 8 Dec 2004, Iasen Kostov wrote:
> #:> ident if_em.c
> if_em.c:
> $FreeBSD: src/sys/dev/em/if_em.c,v 1.44.2.4 2004/11/23 22:28:40
> rwatson Exp $
>
> I've deleted the whole dir and cvsuped. Does 1.54 differs much from
> 1.44.2.4 ?
Very odd. I have 1.44.2.4 checked out here, and if_em.diff applied
without a hitch. Here's a version of the patch generated using cvs diff
against the older revision. It should be basically identical to the
version I sent you before, though. Diffing the two diffs generates only
line number differences.
If this doesn't work, drop me a copy of your if_em.c and I'll apply the
change manually.
Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org Principal Research Scientist, McAfee Research
Index: if_em.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/em/if_em.c,v
retrieving revision 1.44.2.4
diff -u -r1.44.2.4 if_em.c
--- if_em.c 23 Nov 2004 22:28:40 -0000 1.44.2.4
+++ if_em.c 8 Dec 2004 11:01:19 -0000
@@ -1220,36 +1220,6 @@
}
}
- /*
- * Map the packet for DMA.
- */
- if (bus_dmamap_create(adapter->txtag, BUS_DMA_NOWAIT, &q.map)) {
- adapter->no_tx_map_avail++;
- return (ENOMEM);
- }
- error = bus_dmamap_load_mbuf(adapter->txtag, q.map,
- m_head, em_tx_cb, &q, BUS_DMA_NOWAIT);
- if (error != 0) {
- adapter->no_tx_dma_setup++;
- bus_dmamap_destroy(adapter->txtag, q.map);
- return (error);
- }
- KASSERT(q.nsegs != 0, ("em_encap: empty packet"));
-
- if (q.nsegs > adapter->num_tx_desc_avail) {
- adapter->no_tx_desc_avail2++;
- bus_dmamap_destroy(adapter->txtag, q.map);
- return (ENOBUFS);
- }
-
-
- if (ifp->if_hwassist > 0) {
- em_transmit_checksum_setup(adapter, m_head,
- &txd_upper, &txd_lower);
- } else
- txd_upper = txd_lower = 0;
-
-
/* Find out if we are in vlan mode */
#if __FreeBSD_version < 500000
if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
@@ -1273,20 +1243,17 @@
m_head = m_pullup(m_head, sizeof(eh));
if (m_head == NULL) {
*m_headp = NULL;
- bus_dmamap_destroy(adapter->txtag, q.map);
return (ENOBUFS);
}
eh = *mtod(m_head, struct ether_header *);
M_PREPEND(m_head, sizeof(*evl), M_DONTWAIT);
if (m_head == NULL) {
*m_headp = NULL;
- bus_dmamap_destroy(adapter->txtag, q.map);
return (ENOBUFS);
}
m_head = m_pullup(m_head, sizeof(*evl));
if (m_head == NULL) {
*m_headp = NULL;
- bus_dmamap_destroy(adapter->txtag, q.map);
return (ENOBUFS);
}
evl = mtod(m_head, struct ether_vlan_header *);
@@ -1299,6 +1266,36 @@
*m_headp = m_head;
}
+ /*
+ * Map the packet for DMA.
+ */
+ if (bus_dmamap_create(adapter->txtag, BUS_DMA_NOWAIT, &q.map)) {
+ adapter->no_tx_map_avail++;
+ return (ENOMEM);
+ }
+ error = bus_dmamap_load_mbuf(adapter->txtag, q.map,
+ m_head, em_tx_cb, &q, BUS_DMA_NOWAIT);
+ if (error != 0) {
+ adapter->no_tx_dma_setup++;
+ bus_dmamap_destroy(adapter->txtag, q.map);
+ return (error);
+ }
+ KASSERT(q.nsegs != 0, ("em_encap: empty packet"));
+
+ if (q.nsegs > adapter->num_tx_desc_avail) {
+ adapter->no_tx_desc_avail2++;
+ bus_dmamap_destroy(adapter->txtag, q.map);
+ return (ENOBUFS);
+ }
+
+
+ if (ifp->if_hwassist > 0) {
+ em_transmit_checksum_setup(adapter, m_head,
+ &txd_upper, &txd_lower);
+ } else
+ txd_upper = txd_lower = 0;
+
+
i = adapter->next_avail_tx_desc;
if (adapter->pcix_82544) {
txd_saved = i;
More information about the freebsd-net
mailing list