Yeah, it's not totally obvious how it all fits together.  Glad you got it 
working.

-- Murphy

On Dec 9, 2013, at 1:56 AM, Sameer Katti <[email protected]> wrote:

> Thanks Murphy,
> 
> Finally got it to work. I set the ToS bits in my packet generation code as 4. 
> And set a match for nw_tos=4 on the switch. This was a little confusing.
> 
> 
> On Sun, Dec 8, 2013 at 11:54 PM, Murphy McCauley <[email protected]> 
> wrote:
> The issue you're having is described on page 24 of the OpenFlow spec as well 
> as on the ovs-ofctl man page, but without some context, it may not entirely 
> make sense.  Specifically, the spec says:
> The nw_tos field is the 6 upper bits of the ToS field to set, in the 
> original bit positions (shifted to the left by 2).
> 
> To understand this better: nw_tos is actually not really to do with the TOS 
> field (which is long retired), but with the DiffServ field which superseded 
> it.  The bottom two bits of this field were originally unused, and later 
> became the ECN bits.  The top six bits are the DiffServ Code Point (DSCP), 
> which is what nw_tos actually matches (right; it should actually probably be 
> called nw_dscp).
> 
> So the value you give to OpenFlow for nw_tos is actually a six bit field -- 
> the top six bits of eight.  One might imagine that the values of this field 
> would therefore be 0 through 63, and would be shifted up two bits when 
> written to the packet.  However, as the spec says, these are "in the original 
> bit positions".  Thus, the smallest value legal for this field is 4 (followed 
> by 8 and then 12, etc.).
> 
> TLDR: You can't set the bottom two bits.  You want one of the following, 
> though it's hard to say which for sure: 1) to shift what you think the value 
> should be to the left by two, or 2) to set the ECN bits and not the "TOS" 
> (DSCP) bits.
> 
> -- Murphy
> 
> On Dec 8, 2013, at 11:12 PM, Sameer Katti <[email protected]> wrote:
> 
> > Hi All,
> >
> > I am trying to set a flow that matches based on the nw_tos field of the 
> > match object. But when I dump the flows on the switch it has nw_tos field 
> > set as 0.
> > I am using OpenvSwitch 1.10 on Mininet 2.0
> > The code snippet I am using is:-
> >
> > msg = of.ofp_flow_mod()
> > #msg.match.dl_dst = packet.dst
> > msg.match.dl_type = ethernet.IP_TYPE
> > msg.match.nw_tos =  1;
> >
> > Even after installing a flow with such a match the nw_tos is still set to 
> > zero.
> >
> > *** s1 
> > ------------------------------------------------------------------------
> > NXST_FLOW reply (xid=0x4):
> >  cookie=0x0, duration=13.677s, table=0, n_packets=1, n_bytes=98, 
> > idle_age=12, ip,dl_dst=d2:35:53:03:83:bc,nw_tos=0 actions=output:1
> >  cookie=0x0, duration=6.652s, table=0, n_packets=3, n_bytes=294, 
> > idle_age=3, ip,dl_dst=da:79:78:e1:7c:4f,nw_tos=0 actions=output:2
> >
> >
> > How should I set the nw_tos field in ofp_match object?
> > --
> > -Sameer
> 
> 
> 
> 
> -- 
> -Sameer

Reply via email to