Re: Problem with VLANs

2007-08-03 Thread Stuart Henderson
On 2007/08/03 15:27, Hugo van Niekerk wrote:
[...]

pcn(4) can be persuaded to send frames large enough to hold vlan tags
and a 1500-byte packet with the diff below, but on the vmware I just
tried, I can't get it to receive frames that size. Then again, neither
does em(4) with Ethernet0.virtualDev = e1000, or vic(4) with
Ethernet0.virtualDev = vmxnet, so it's likely to be a problem
with the NIC on the vmware I just tried it on (nfe on a junk
windows box).

If anyone wants to try their luck with a real pcn (rare beast that
it is ..) or a better vmware installation here's the diff (against
-current) to test.

A test is only successful if you can send *and receive* large
packets over a vlan interface over the wire (e.g. ping -s1472
some.other.host.on.the.vlan).

Features table for the AMD chip says 'software vlan support' and there's
nothing specific to enable large frame reception mentioned in the data
sheet that I could find, but there could be some reason (other than
they didn't think of it) why it seems not to be done in other OS.

Index: if_pcn.c
===
RCS file: /cvs/src/sys/dev/pci/if_pcn.c,v
retrieving revision 1.15
diff -u -p -r1.15 if_pcn.c
--- if_pcn.c9 Nov 2006 14:25:23 -   1.15
+++ if_pcn.c3 Aug 2007 10:40:49 -
@@ -805,6 +805,8 @@ pcn_attach(struct device *parent, struct
IFQ_SET_MAXLEN(ifp-if_snd, PCN_NTXDESC -1);
IFQ_SET_READY(ifp-if_snd);
 
+   ifp-if_capabilities = IFCAP_VLAN_MTU;
+
/* Attach the interface. */
if_attach(ifp);
ether_ifattach(ifp);
@@ -1128,7 +1130,8 @@ pcn_ioctl(struct ifnet *ifp, u_long cmd,
break;
 
case SIOCSIFMTU:
-   if (ifr-ifr_mtu  ETHERMTU || ifr-ifr_mtu  ETHERMIN)
+   if (ifr-ifr_mtu  ETHERMTU + ETHER_VLAN_ENCAP_LEN || 
+   ifr-ifr_mtu  ETHERMIN)
error = EINVAL;
else if (ifp-if_mtu != ifr-ifr_mtu)
ifp-if_mtu = ifr-ifr_mtu;



Re: Problem with VLANs

2007-08-03 Thread Chris Cappuccio
Stuart Henderson [EMAIL PROTECTED] wrote:
  
   case SIOCSIFMTU:
 - if (ifr-ifr_mtu  ETHERMTU || ifr-ifr_mtu  ETHERMIN)
 + if (ifr-ifr_mtu  ETHERMTU + ETHER_VLAN_ENCAP_LEN || 
 + ifr-ifr_mtu  ETHERMIN)
   error = EINVAL;
   else if (ifp-if_mtu != ifr-ifr_mtu)
   ifp-if_mtu = ifr-ifr_mtu;

This isn't the idea.  The MTU is not supposed to be set to 1504, it stays
at 1500 and if_vlan sees IFCAP_VLAN_MTU and knows that the chip actually
supports MTU + EVL_ENCAPLEN.  With this change, then on several chips, if the
user expected to set 1504 and then use if_vlan on top of that (say, to pass
packets that are alreay tagged by another device) then it would fail.



Re: Problem with VLANs

2007-08-03 Thread Stuart Henderson
On 2007/08/03 16:18, Chris Cappuccio wrote:
 Stuart Henderson [EMAIL PROTECTED] wrote:
   
  case SIOCSIFMTU:
  -   if (ifr-ifr_mtu  ETHERMTU || ifr-ifr_mtu  ETHERMIN)
  +   if (ifr-ifr_mtu  ETHERMTU + ETHER_VLAN_ENCAP_LEN || 
  +   ifr-ifr_mtu  ETHERMIN)
  error = EINVAL;
  else if (ifp-if_mtu != ifr-ifr_mtu)
  ifp-if_mtu = ifr-ifr_mtu;
 
 This isn't the idea.  The MTU is not supposed to be set to 1504, it stays
 at 1500 and if_vlan sees IFCAP_VLAN_MTU and knows that the chip actually
 supports MTU + EVL_ENCAPLEN.

damn, yes you're right. Scrub this bit of the diff then.

 With this change, then on several chips, if the
 user expected to set 1504 and then use if_vlan on top of that (say, to pass
 packets that are alreay tagged by another device) then it would fail.

btw, you can stack tags (e.g. vlanYYY vlandev vlanXXX), at least on some
nics.



Re: Problem with VLANs

2007-08-02 Thread Tim Donahue
Redirected as this is a misc@ question not a tech@ question.

On Thu, 2007-08-02 at 11:48 +0930, Hugo van Niekerk wrote:
 Hey Everybody
 
 Im running OpenBSD 3.9. At startup during vlan initialization I get  
 an error that the vlan initiated with a nonstandard mtu of 1946  
 (parent pcn1). Of course I understand that a vlan header has to be  
 sent and that provision has to be made for this. Ive done a lot of  
 searching on the web around this and everything is pointing to the  
 fact that the network driver does not support / has not been set for  
 a larger mtu. This is where I get stuck. There is a component  
 SIOCIFMTU that reports that the mtu value I use is incorrect for a  
 specific interface when I try to increase the mtu from the command  
 line using ifconfig. This component, according to my research sets  
 the mtu value automatically at startup based on the information that  
 is fed to it by the network card driver. Anything above what is set  
 at startup would be invalid. Can anybody please give me some advise  
 as to where I can more resources that I can research to resolve this  
 problem or point me in the right direction. I would really  
 appreciated this! Also, I've been looking for a guide or good book /  
 resource around configuring vlans on OpenBSD, I thought maybe I made  
 a mistake in the hostname.if and pf.conf files. Again any assistance  
 here will be greatly appreciated.
 
 regards
 
 Hugo
 

If your interface is initializing with a MTU of 1496 then the card that
you are using is not capable of supporting a MTU over 1500 which is
required by the 802.1q spec to do VLAN tagging.  A full size ethernet
frame with the 802.1q encapsulation is actually 1504 bytes.  

This is not a configuration issue, unless you have specified a smaller
packet size.  There is no configuration needed, if the card is capable
of doing vlan trunking with the full packet size, it will otherwise it
will automatically decrease the MTU to allow for the 4 byte header that
will be added. 

Unfortunately not all the ethernet cards/drivers are able to support
this over-sized packet.  To check which drivers are capable of
supporting it you can grep for IFCAP_VLAN_MTU in
the /usr/src/sys/dev/pci/if_driver.c files.  I personally have had the
best luck with the fxp, sis, and em drivers when I am doing vlan
trunking.

Tim Donahue



Re: Problem with VLANs

2007-08-02 Thread Stuart Henderson
On 2007/08/02 10:54, Tim Donahue wrote:
 Redirected as this is a misc@ question not a tech@ question.
 
 On Thu, 2007-08-02 at 11:48 +0930, Hugo van Niekerk wrote:
  Im running OpenBSD 3.9. At startup during vlan initialization I get  

Unfortunately lacking a dmesg...

  an error that the vlan initiated with a nonstandard mtu of 1946  
  (parent pcn1). Of course I understand that a vlan header has to be  

If this is a real machine, swapping the card is probably the best
idea. If it's vmware, you may be able to change settings and use
Intel emulation and em(4) or vmxnet and vic(4) (with newer OpenBSD).

 Unfortunately not all the ethernet cards/drivers are able to support
 this over-sized packet.  To check which drivers are capable of
 supporting it you can grep for IFCAP_VLAN_MTU in
 the /usr/src/sys/dev/pci/if_driver.c files.  I personally have had the
 best luck with the fxp, sis, and em drivers when I am doing vlan
 trunking.

sk and bge work fine too. I think re and dc as well, but I'm
not actively using them (re - machine's blown up, dc - my znyx
card is too long to fit into anything I have handy). xl works
sometimes but is not a great choice.