[ovs-dev] [PATCH v8 5/5] datapath: add layer 3 support to ovs_packet_cmd_execute()

Lori Jakab lojakab at cisco.com
Mon Nov 17 21:50:28 UTC 2014


On 11/17/14 8:03 PM, Jesse Gross wrote:
> On Mon, Nov 17, 2014 at 9:24 AM, Lorand Jakab <lojakab at cisco.com> wrote:
>> diff --git a/datapath/flow.c b/datapath/flow.c
>> index b01f7bd..3caa364 100644
>> --- a/datapath/flow.c
>> +++ b/datapath/flow.c
>> @@ -462,7 +462,6 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
>>          /* Link layer. */
>>          if (key->phy.is_layer3) {
>>                  key->eth.tci = 0;
>> -               key->eth.type = skb->protocol;
> Does this need to be set in the case where packets aren't coming from userspace?

Good catch.  I added this to the other two functions calling key_extract().

>
>> diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
>> index 54510c8..8ca3469 100644
>> --- a/datapath/flow_netlink.c
>> +++ b/datapath/flow_netlink.c
>> @@ -692,6 +692,18 @@ static int metadata_from_nlattrs(struct sw_flow_match *match,  u64 *attrs,
>>                  else
>>                          SW_FLOW_KEY_PUT(match, phy.is_layer3, true, is_mask);
>>          }
>> +       /* Layer 3 packets from user space have the EtherType as metadata */
>> +       if (*attrs & (1ULL << OVS_KEY_ATTR_ETHERTYPE)) {
> Is this correct? I thought that EtherType wasn't serialized in this
> case - in other places we extract this from the IP/IPv6 attribute
> directly.

For "ovs_flow" Netlink messages we can do that, but not for "ovs_packet" 
messages, which only have packet metadata, not the full flow key.  
Packet metadata didn't include EtherType until now, but I unless we use 
the nibble from the IP version, we need to add it for layer 3 packets only.




More information about the dev mailing list