tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: re(4) vlan issue



cbrookes%gmail.com@localhost wrote:

> I'm having an issue with re(4) and vlans.

Umm, a comment derived from FreeBSD in sys/dev/ic/rtl8169.c
seems incorrect.

How about this patch?
---
Izumi Tsutsui


--- rtl8169.c.orig      2008-03-15 00:29:38.000000000 +0900
+++ rtl8169.c   2008-03-15 00:29:44.000000000 +0900
@@ -1458,7 +1458,7 @@
        struct re_txq           *txq;
        struct re_desc          *d;
        struct m_tag            *mtag;
-       uint32_t                cmdstat, re_flags;
+       uint32_t                cmdstat, re_flags, vlanctl;
        int                     ofree, idx, error, nsegs, seg;
        int                     startdesc, curdesc, lastdesc;
        bool                    pad;
@@ -1554,6 +1554,16 @@
                    BUS_DMASYNC_PREWRITE);
 
                /*
+                * Set up hardware VLAN tagging. Note: vlan tag info must
+                * appear in all descriptors of a multi-descriptor
+                * transmission attempt.
+                */
+               vlanctl = 0;
+               if ((mtag = VLAN_OUTPUT_TAG(&sc->ethercom, m)) != NULL)
+                       vlanctl = bswap16(VLAN_TAG_VALUE(mtag)) |
+                           RE_TDESC_VLANCTL_TAG;
+
+               /*
                 * Map the segment array into descriptors.
                 * Note that we set the start-of-frame and
                 * end-of-frame markers for either TX or RX,
@@ -1583,7 +1593,7 @@
                        }
 #endif
 
-                       d->re_vlanctl = 0;
+                       d->re_vlanctl = htole32(vlanctl);
                        re_set_bufaddr(d, map->dm_segs[seg].ds_addr);
                        cmdstat = re_flags | map->dm_segs[seg].ds_len;
                        if (seg == 0)
@@ -1604,7 +1614,7 @@
                        bus_addr_t paddaddr;
 
                        d = &sc->re_ldata.re_tx_list[curdesc];
-                       d->re_vlanctl = 0;
+                       d->re_vlanctl = htole32(vlanctl);
                        paddaddr = RE_TXPADDADDR(sc);
                        re_set_bufaddr(d, paddaddr);
                        cmdstat = re_flags |
@@ -1620,17 +1630,6 @@
                }
                KASSERT(lastdesc != -1);
 
-               /*
-                * Set up hardware VLAN tagging. Note: vlan tag info must
-                * appear in the first descriptor of a multi-descriptor
-                * transmission attempt.
-                */
-               if ((mtag = VLAN_OUTPUT_TAG(&sc->ethercom, m)) != NULL) {
-                       sc->re_ldata.re_tx_list[startdesc].re_vlanctl =
-                           htole32(bswap16(VLAN_TAG_VALUE(mtag)) |
-                           RE_TDESC_VLANCTL_TAG);
-               }
-
                /* Transfer ownership of packet to the chip. */
 
                sc->re_ldata.re_tx_list[startdesc].re_cmdstat |=


Home | Main Index | Thread Index | Old Index