linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* issues with SO_PRIORITY and IP_TOS
@ 2003-10-30 19:59 Chris Friesen
  0 siblings, 0 replies; only message in thread
From: Chris Friesen @ 2003-10-30 19:59 UTC (permalink / raw)
  To: netdev, linux-kernel


I've been doing some experimenting with both of the options mentioned in 
the subject line, and it seems that there is some strangeness in the 
current handling.

First, setting IP_TOS sets the whole 8 bits of the tos field in the 
packet header.  However, the code then uses the 4 bits defined as the 
tos field to generate the packet priority value.  This is bad for two 
reasons.  Firstly, if we're using the old bit fields it should be the 
precedence bits that are used for the skb priority rather than the tos 
field.  Secondly, the whole precedence/tos thing has been obsoleted by 
the 6-bit DSCP field, of which the first 3 bits are supposed to be 
backwards compatible with the old precedence field.  Shouldn't we 
properly handle that?

Secondly, for vlan priority tagging there are only 3 bits available. 
This means that practically speaking anyone using vlan priorities needs 
to limit themselves to priorities 0-7.

Currently, for me to send a packet with IP precedence bits set to a 
nonzero value *and* vlan priority set to the same value, I have to do 
the following:

int opt = PRIORITY << 5;
setsockopt(mysocks[i], SOL_IP, IP_TOS, &opt, sizeof(opt));
opt = PRIORITY;
setsockopt(mysocks[i], SOL_SOCKET, SO_PRIORITY, &opt, sizeof(opt));

The first call sets the IP precedence bits, and also incorrectly sets 
the socket priority.  The second call sets the proper socket priority so 
that the vlan egress mapping works properly.

This is kind of ugly.  I propose adding a new IP socket option, IP_DSCP, 
which would let you set the 6-bit DSCP value (which is then shifted by 
two bits in the kernel to generate the 8-bit value for the header 
field).  The high-order 3 bits would then be automatically used to set 
the socket priority to make a vlan egress mapping simple.

Does this make any sense?

Chris


-- 
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-10-30 19:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-30 19:59 issues with SO_PRIORITY and IP_TOS Chris Friesen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).