Netdev List
 help / color / mirror / Atom feed
* query: ethtool --show-nfc mask interpretation
@ 2014-07-04 16:13 Govindarajulu Varadarajan
  2014-07-07  1:36 ` Ben Hutchings
  0 siblings, 1 reply; 2+ messages in thread
From: Govindarajulu Varadarajan @ 2014-07-04 16:13 UTC (permalink / raw)
  To: ben, davem; +Cc: netdev

I was working on ethtool --show-nfc implementation for enic.

While displaying, ethtool displays the 1's compliment of
ethtool_rx_flow_spec->m_u.tcp_ip4_spec.psrc

I could not understand how to interpret the mask output

For eg.
[root@a163 linux-next]# ethtool -n enp9s0
8 RX rings available
Total 2 rules

Filter: 0
         Rule Type: TCP over IPv4
         Src IP addr: 10.65.79.1 mask: 255.255.0.0
         Dest IP addr: 10.106.186.163 mask: 255.255.255.255
         TOS: 0x0 mask: 0x0
         Src port: 51331 mask: 0xff
         Dest port: 22 mask: 0xffff
         Action: Direct to queue 4


The mask for src port is 0x00ff. Does that mean 8 bits in lsb should match and
the other 8 bits in msb should be ignored? Or is it the other way?

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: query: ethtool --show-nfc mask interpretation
  2014-07-04 16:13 query: ethtool --show-nfc mask interpretation Govindarajulu Varadarajan
@ 2014-07-07  1:36 ` Ben Hutchings
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2014-07-07  1:36 UTC (permalink / raw)
  To: Govindarajulu Varadarajan; +Cc: davem, netdev

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

On Fri, 2014-07-04 at 21:43 +0530, Govindarajulu Varadarajan wrote:
> I was working on ethtool --show-nfc implementation for enic.
> 
> While displaying, ethtool displays the 1's compliment of
> ethtool_rx_flow_spec->m_u.tcp_ip4_spec.psrc

The code in ethtool was originally written to work with the n-tuple
ethtool operations (which no longer exist) in which the mask fields
specify bits to be ignored in the packet.  For NFC rule operations, the
semantics are the opposite: the mask fields specify bits to be matched
in the packet.  So ethtool inverts the mask fields as necessary.

> I could not understand how to interpret the mask output
> 
> For eg.
> [root@a163 linux-next]# ethtool -n enp9s0
> 8 RX rings available
> Total 2 rules
> 
> Filter: 0
>          Rule Type: TCP over IPv4
>          Src IP addr: 10.65.79.1 mask: 255.255.0.0
>          Dest IP addr: 10.106.186.163 mask: 255.255.255.255
>          TOS: 0x0 mask: 0x0
>          Src port: 51331 mask: 0xff
>          Dest port: 22 mask: 0xffff
>          Action: Direct to queue 4
> 
> 
> The mask for src port is 0x00ff. Does that mean 8 bits in lsb should match and
> the other 8 bits in msb should be ignored? Or is it the other way?

It means the 8 least significant bits are ignored.

Ben.

-- 
Ben Hutchings
Quantity is no substitute for quality, but it's the only one we've got.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-07  1:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-04 16:13 query: ethtool --show-nfc mask interpretation Govindarajulu Varadarajan
2014-07-07  1:36 ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox