Discussion:
re(4) vlan issue
(too old to reply)
Chris Brookes
2008-03-12 13:59:04 UTC
Permalink
I'm having an issue with re(4) and vlans. My system is a Athlon X2
BE-2350 and a GIGABYTE GA-MA69VM-S2 mobo. I am running a kernel under
amd64 compiled from
http://ftp.netbsd.org/pub/NetBSD-daily/HEAD/200803080000Z/source/sets/syssrc.tgz.

re0 at pci2 dev 15 function 0: RealTek 8169SC/8110SC Single-chip
Gigabit Ethernet (rev. 0x10)
re0: interrupting at ioapic0 pin 23, event channel 13
re0: Ethernet address 00:1a:4d:ff:e4:72
re0: using 256 tx descriptors
rgephy0 at re0 phy 7: RTL8169S/8110S/8211 1000BASE-T media interface, rev. 2

When the interface was brought up with a regular IP it worked without
issue. When I brought up re0 without an IP and instead configured a
vlan interface with the other end connected to a 801.1q trunk port on
my switch, things started to go awry.

I could source traffic from the box and get as far as installing
packages over the network seemingly without problems, but strangely
inbound traffic wasn't working properly. An inbound telnet on port 22
to the box would produce the SSH banner, but any subsequent traffic
would vanish. Looking at a trace in wireshark it showed a successful
tcp connection setup (obviously since I saw the banner) but after the
banner there'd be a couple of retransmissions and then nothing. I
plugged in an old 3c905 and using the ex driver every thing's fine on
the system.

I discovered PR 32643 which seemed pretty similar and so I went ahead
and commented out the VLAN hardware tagging code for the re driver.
Sure enough with that commented out, my issue goes away. My maximum
MTU is reduced to 1496, but other than that everything works well.

I discovered PR 37959 which is probably related though the PR lacks
enough detail to be sure.

I note there is a user on FreeBSD with an re(4) on amd64 who is also
experiencing some problems.

http://lists.freebsd.org/pipermail/freebsd-current/2008-February/083584.html

I don't know whether that's related but the thread is interesting reading.

Regards

Chris

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Izumi Tsutsui
2008-03-14 15:44:33 UTC
Permalink
Post by Chris Brookes
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 |=

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Chris Brookes
2008-03-14 22:06:35 UTC
Permalink
Post by Izumi Tsutsui
Umm, a comment derived from FreeBSD in sys/dev/ic/rtl8169.c
seems incorrect.
How about this patch?
I just got a chance to apply it. So far that seems to have fixed it. I
can SSH in and scp files in and out without a problem. I will report
back in a few days whem I've had chance to test it properly. Thanks
for the assistance, greatly appreciated.

chris

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Chris Brookes
2008-03-17 14:25:52 UTC
Permalink
Post by Chris Brookes
I just got a chance to apply it. So far that seems to have fixed it. I
can SSH in and scp files in and out without a problem. I will report
back in a few days whem I've had chance to test it properly. >
Well 2 days of testing and everything seems to be working fine.

Thanks again!

Chris

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Izumi Tsutsui
2008-03-18 14:07:44 UTC
Permalink
Post by Chris Brookes
Post by Chris Brookes
I just got a chance to apply it. So far that seems to have fixed it. I
can SSH in and scp files in and out without a problem. I will report
back in a few days whem I've had chance to test it properly. >
Well 2 days of testing and everything seems to be working fine.
Thanks, I've commited the fix, and I'll send a pullup request
for netbsd-4 later.
---
Izumi Tsutsui

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...