Re: [ovs-discuss] Is there any document about nicira externtion

2019-08-20 Thread kai xi fan
Many thanks. I will check that.
The "nxm_packet_in_2" packet_in format contains userdata field.  It could
be used to save arp or dhcp data corresponded to the host in the flow. Then
the controller do not need to constructor these caches.
It's used in ovn.

Ashish Varma  于2019年8月21日周三 上午12:46写道:

> I have attempted to write a document explaining the Nicira extension which
> is still a v1 patch for review.
>
> https://patchwork.ozlabs.org/patch/1145870/
>
> Nicira extensions were added in the early days of OVS during early
> OpenFlow versions and a lot of those extensions made it to standard
> OpenFlow specifications.
> packet_in message is supported in OpenFlow 1.3. Any specific reason to use
> nxm_packet_in_2?
>
> Below is an example of OpenFlow 1.0 Nicira Vendor message 'Flow Mod' with
> 'NXM' or Nicira Extensible Match fields generated using:
> ovs-ofctl add-flow br1 "table=10, priority=100, cookie=0x0102030405060708
> ip, sctp, sctp_dst=9, actions=drop"
>
> This is an example to show how NXM is encoded.
>
> OVS NXM fields are described at
> http://www.openvswitch.org/support/dist-docs/ovs-fields.7.txt
>
> 0x010x040x000x480x000x000x000x0a
> 0x000x000x230x200x000x000x000x0d
> 0x010x020x030x040x050x060x070x08
> 0x0a0x000x000x000x000x000x000x64
> 0xff0xff0xff0xff0xff0xff0x000x00
> 0x000x110x000x000x000x000x000x00
> 0x000x000x060x020x080x000x000x00
> 0x0c0x010x840x800x000x240x020x00
> 0x090x000x000x000x000x000x000x00
>
>
> // ofp_header with Version=1, Message Type=4 (Vendor)
> 0x010x040x000x480x000x000x000x0a
>
> // Vendor id = 0x2320 Subtype = 0x00 0x0d   (Where are these defined
> ??)
> 0x000x000x230x200x000x000x000x0d
>
> // Cookie
> 0x010x020x030x040x050x060x070x08
>
> // Command = 0x0a 0x00 (table-id=0x0a,command=add(0x00))  idle_time = 0
> hard_time = 0 priority = 100
> 0x0a0x000x000x000x000x000x000x64
>
> // buffer_id = 0x out_port = OFPP_NONE(0x) flags = 0
> 0xff0xff0xff0xff0xff0xff0x000x00
>
> // match_len = 0x11 padding= 0x
> 0x000x110x000x000x000x000x000x00
>
> // OFPXMC12_NXM_0 (nxm_vendor 0x)
> nxm_field+hm=0x06,nxm_field=0x03,hm=0 nxm_length=0x02 value=0x0800
> (ethernet)
> 0x000x000x060x020x080x00
>
> // OFPXMC12_NXM_0 (nxm_vendor 0x)
> nxm_field+hm=0x0c,nxm_field=0x06,hm=0 nxm_length=0x01 value=0x84 (sctp)
> 0x000x000x0c0x010x84
>
> // OFPXMC_OPENFLOW_BASIC (0x8000) nxm_field+hm=0x24,nxm_field=0x12,hm=0
> nxm_length=0x02 value=0x09 (sctp_dst_port)
> 0x800x000x240x020x000x09
>
> // padding 7 bytes of 0s
> 0x000x000x000x000x000x000x00
>
>
>
> Thanks,
> Ashish
>
> On Tue, Aug 20, 2019 at 3:45 AM kai xi fan  wrote:
>
>> Thanks.
>> I have read the following file.
>> https://github.com/openvswitch/ovs/blob/master/include/openflow/nicira
>> -ext.h
>> But it's too simple to understand. For example, nicira extension use
>> properties in "nxm packet_in_2" packet in format. But there is no such
>> openflow message format in detail.
>> I have to tcpdump the openflow packet to understand it.
>> May be there is a official document about this ?
>>
>> Numan Siddique  于2019年8月20日周二 下午3:37写道:
>>
>>>
>>>
>>> On Tue, Aug 20, 2019 at 7:35 AM kai xi fan  wrote:
>>>
 I am writing a controller to control ovs through openflow protocol.
 I found that  when I dump flows from ovs using ovs-ofctl. It shows me
 so many fields prefixed with "NXM".
 And we plan to use "nxm packet_in_2" format. It also needs nicira
 extensions.
 So if the controller wants to communicate with ovs using openflow 1.3,
 I have to deal with nicira extensions.
 But I could not found any document about its format and the
 corresponding openflow message format.
 Could any one help me ?

>>>
>>> I think you can find useful information here -
>>> https://github.com/openvswitch/ovs/blob/master/include/openflow/nicira-ext.h
>>>
>>> Thanks
>>> Numan
>>>
>>>
 thanks.
 ___
 discuss mailing list
 disc...@openvswitch.org
 https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

>>> ___
>> discuss mailing list
>> disc...@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>>
>
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] [OVN] Aging mechanism for MAC_Binding table

2019-08-20 Thread Han Zhou
On Tue, Aug 20, 2019 at 4:57 PM Ben Pfaff  wrote:
>
> Let me see if I'm following this correctly.  This is what currently
> happens:
>
> - HV1 needs a MAC address for an IP so it broadcasts an ARP request.
>
> - The port with the IP address, on HV2, causes the MAC_Binding to be
>   inserted.
>
> - Every ovn-controller inserts an OF flow for the binding.  HV1 and
>   perhaps other ovn-controllers use this flow to populate the MAC
>   address for subsequent packets destined to the IP address in question.
>
> This proposal augments that with:
>
> - After a while, the binding goes idle and isn't used.  The
>   ovn-controllers gradually notice this and delete their OF flows for
>   it.
>
> - HV3 eventually needs the binding again.  It broadcasts an ARP request.
>
> - The port with the IP address causes the MAC_Binding to be inserted.
>   This might still be on HV2 if the port hasn't moved, or it might be on
>   HV4 if it has.
>
> Is that what you mean?  It might work OK.
>
> Please do update the lifetime description in ovn-sb(5) under the
> MAC_Binding table regardless of what you implement.
>
> Thanks,
>
> Ben.
>
> On Tue, Aug 20, 2019 at 09:03:57AM +0200, Daniel Alvarez Sanchez wrote:
> > Hi folks,
> >
> > Reviving this thread as we're seeing this more and more problematic.
> > Combining the ideas mentioned up thread, Dumitru, Numan, Lucas and I
> > had some internal discussion where we came up with a possible approach
> > and we'd love to get feedback from you:
> >
> > - Local ovn-controller will always insert an OF rule per MAC_Binding
> > entry to match on src_ip + src_mac that will be sampled with a meter
> > to ovn-controller.
> > - When ovn-controller sees that one entry has not been hit "for a
> > while", it'll delete the OpenFlow rule in table 65 that fills the
> > eth.dst field with the MAC_Binding info.

I assume the rules in table 65 can be "extended" for this purpose, instead
of adding extra rules for this.

> > - This will result in further ARP requests from the instance(s) that
> > will refresh the MAC_Binding entries in the database.
> >
> > This could make troubleshooting a bit harder so at some point it'll be
> > great to have a mechanism in OVS where we could disable a flow instead
> > of deleting it. This way, one can tell that the flows in table 65 have
> > been disabled due to the aging mechanism in the local node.

Sorry that I didn't understand this. Why do you want the flow being
disabled instead of deleted? I think if we want to avoid stale entries, we
do want to delete them, so that the stale data doesn't occupy the space in
flow table, neither in SB DB. It may be ok to add debug log for deleting a
aged entry in ovn-controller, for trouble shooting purpose?

> >
> > Thoughts? Is there any performance consideration regarding the extra
> > flows and meters?

Are you proposing shared meters or one meter per mac-binding? If it is per
mac-binding, I would be worried about the scalability considering that we
may have >10k of mac-bindings. Or should I be worried? Maybe Justin and Ben
can comment on the meter scalability. If it is a concern, I would suggest
the feature be configurable (i.e. enable/disable), so that it can be
enabled in environments where aging is required but number of mac-bindings
are not very high.

> >
> > Thanks a lot!
> > Daniel
> >
> >
> > On Tue, Jul 9, 2019 at 7:19 AM Ben Pfaff  wrote:
> > >
> > > On Mon, Jul 08, 2019 at 06:19:23PM -0700, Han Zhou wrote:
> > > > On Thu, Jun 27, 2019 at 6:44 AM Ben Pfaff  wrote:
> > > > >
> > > > > On Tue, Jun 25, 2019 at 01:05:21PM +0200, Daniel Alvarez Sanchez
wrote:
> > > > > > Lately we've been trying to solve certain issues related to
stale
> > > > > > entries in the MAC_Binding table (e.g. [0]). On the other hand,
for
> > > > > > the OpenStack + Octavia (Load Balancing service) use case, we
see that
> > > > > > a reused VIP can be as well affected by stale entries in this
table
> > > > > > due to the fact that it's never bound to a VIF so
ovn-controller won't
> > > > > > claim it and send the GARPs to update the neighbors.
> > > > > >
> > > > > > I'm not sure if other scenarios may suffer from this issue but
seems
> > > > > > reasonable to have an aging mechanism (as we discussed at some
point
> > > > > > in the past) that makes unused/old entries to expire. After
talking to
> > > > > > Numan on IRC, since a new pinctrl thread has been introduced
recently
> > > > > > [1], it'd be nice to implement this aging mechanism there.
> > > > > > At the same time we'd be also reducing the amount of entries
for long
> > > > > > lived systems as it'd grow indefinitely.
> > > > > >
> > > > > > Any thoughts?
> > > > > >
> > > > > > Thanks!
> > > > > > Daniel
> > > > > >
> > > > > > PS. With regards to the 'unused' vs 'old' entries I think it
has to be
> > > > > > 'old' rather than 'unused' as I don't see a way to reset the
TTL of a
> > > > > > MAC_Binding entry when we see packets coming. The implication
is that
> > > > > > we'll be seeing AR

Re: [ovs-discuss] [OVN] Aging mechanism for MAC_Binding table

2019-08-20 Thread Ben Pfaff
Let me see if I'm following this correctly.  This is what currently
happens:

- HV1 needs a MAC address for an IP so it broadcasts an ARP request.

- The port with the IP address, on HV2, causes the MAC_Binding to be
  inserted.

- Every ovn-controller inserts an OF flow for the binding.  HV1 and
  perhaps other ovn-controllers use this flow to populate the MAC
  address for subsequent packets destined to the IP address in question.

This proposal augments that with:

- After a while, the binding goes idle and isn't used.  The
  ovn-controllers gradually notice this and delete their OF flows for
  it.

- HV3 eventually needs the binding again.  It broadcasts an ARP request.

- The port with the IP address causes the MAC_Binding to be inserted.
  This might still be on HV2 if the port hasn't moved, or it might be on
  HV4 if it has.

Is that what you mean?  It might work OK.

Please do update the lifetime description in ovn-sb(5) under the
MAC_Binding table regardless of what you implement.

Thanks,

Ben.

On Tue, Aug 20, 2019 at 09:03:57AM +0200, Daniel Alvarez Sanchez wrote:
> Hi folks,
> 
> Reviving this thread as we're seeing this more and more problematic.
> Combining the ideas mentioned up thread, Dumitru, Numan, Lucas and I
> had some internal discussion where we came up with a possible approach
> and we'd love to get feedback from you:
> 
> - Local ovn-controller will always insert an OF rule per MAC_Binding
> entry to match on src_ip + src_mac that will be sampled with a meter
> to ovn-controller.
> - When ovn-controller sees that one entry has not been hit "for a
> while", it'll delete the OpenFlow rule in table 65 that fills the
> eth.dst field with the MAC_Binding info.
> - This will result in further ARP requests from the instance(s) that
> will refresh the MAC_Binding entries in the database.
> 
> This could make troubleshooting a bit harder so at some point it'll be
> great to have a mechanism in OVS where we could disable a flow instead
> of deleting it. This way, one can tell that the flows in table 65 have
> been disabled due to the aging mechanism in the local node.
> 
> Thoughts? Is there any performance consideration regarding the extra
> flows and meters?
> 
> Thanks a lot!
> Daniel
> 
> 
> On Tue, Jul 9, 2019 at 7:19 AM Ben Pfaff  wrote:
> >
> > On Mon, Jul 08, 2019 at 06:19:23PM -0700, Han Zhou wrote:
> > > On Thu, Jun 27, 2019 at 6:44 AM Ben Pfaff  wrote:
> > > >
> > > > On Tue, Jun 25, 2019 at 01:05:21PM +0200, Daniel Alvarez Sanchez wrote:
> > > > > Lately we've been trying to solve certain issues related to stale
> > > > > entries in the MAC_Binding table (e.g. [0]). On the other hand, for
> > > > > the OpenStack + Octavia (Load Balancing service) use case, we see that
> > > > > a reused VIP can be as well affected by stale entries in this table
> > > > > due to the fact that it's never bound to a VIF so ovn-controller won't
> > > > > claim it and send the GARPs to update the neighbors.
> > > > >
> > > > > I'm not sure if other scenarios may suffer from this issue but seems
> > > > > reasonable to have an aging mechanism (as we discussed at some point
> > > > > in the past) that makes unused/old entries to expire. After talking to
> > > > > Numan on IRC, since a new pinctrl thread has been introduced recently
> > > > > [1], it'd be nice to implement this aging mechanism there.
> > > > > At the same time we'd be also reducing the amount of entries for long
> > > > > lived systems as it'd grow indefinitely.
> > > > >
> > > > > Any thoughts?
> > > > >
> > > > > Thanks!
> > > > > Daniel
> > > > >
> > > > > PS. With regards to the 'unused' vs 'old' entries I think it has to be
> > > > > 'old' rather than 'unused' as I don't see a way to reset the TTL of a
> > > > > MAC_Binding entry when we see packets coming. The implication is that
> > > > > we'll be seeing ARPs sent out more often when perhaps they're not
> > > > > needed. This also leads to the discussion of making the cache timeout
> > > > > configurable.
> > > >
> > > > I've always considered the MAC_Binding implementation incomplete because
> > > > of this issue and others.  ovn/TODO.rst says:
> > > >
> > > > * Dynamic IP to MAC binding enhancements.
> > > >
> > > >   OVN has basic support for establishing IP to MAC bindings
> > > dynamically, using
> > > >   ARP.
> > > >
> > > >   * Ratelimiting.
> > > >
> > > > From casual observation, Linux appears to generate at most one
> > > ARP per
> > > > second per destination.
> > > >
> > > > This might be supported by adding a new OVN logical action for
> > > > rate-limiting.
> > > >
> > > >   * Tracking queries
> > > >
> > > >  It's probably best to only record in the database responses to
> > > queries
> > > >  actually issued by an L3 logical router, so somehow they have 
> > > > to
> > > be
> > > >  tracked, probably by putting a tentative binding without a MAC
> > > address
> > > >  into the data

Re: [ovs-discuss] Is there any document about nicira externtion

2019-08-20 Thread Ashish Varma
I have attempted to write a document explaining the Nicira extension which
is still a v1 patch for review.

https://patchwork.ozlabs.org/patch/1145870/

Nicira extensions were added in the early days of OVS during early OpenFlow
versions and a lot of those extensions made it to standard OpenFlow
specifications.
packet_in message is supported in OpenFlow 1.3. Any specific reason to use
nxm_packet_in_2?

Below is an example of OpenFlow 1.0 Nicira Vendor message 'Flow Mod' with
'NXM' or Nicira Extensible Match fields generated using:
ovs-ofctl add-flow br1 "table=10, priority=100, cookie=0x0102030405060708
ip, sctp, sctp_dst=9, actions=drop"

This is an example to show how NXM is encoded.

OVS NXM fields are described at
http://www.openvswitch.org/support/dist-docs/ovs-fields.7.txt

0x010x040x000x480x000x000x000x0a
0x000x000x230x200x000x000x000x0d
0x010x020x030x040x050x060x070x08
0x0a0x000x000x000x000x000x000x64
0xff0xff0xff0xff0xff0xff0x000x00
0x000x110x000x000x000x000x000x00
0x000x000x060x020x080x000x000x00
0x0c0x010x840x800x000x240x020x00
0x090x000x000x000x000x000x000x00


// ofp_header with Version=1, Message Type=4 (Vendor)
0x010x040x000x480x000x000x000x0a

// Vendor id = 0x2320 Subtype = 0x00 0x0d   (Where are these defined ??)
0x000x000x230x200x000x000x000x0d

// Cookie
0x010x020x030x040x050x060x070x08

// Command = 0x0a 0x00 (table-id=0x0a,command=add(0x00))  idle_time = 0
hard_time = 0 priority = 100
0x0a0x000x000x000x000x000x000x64

// buffer_id = 0x out_port = OFPP_NONE(0x) flags = 0
0xff0xff0xff0xff0xff0xff0x000x00

// match_len = 0x11 padding= 0x
0x000x110x000x000x000x000x000x00

// OFPXMC12_NXM_0 (nxm_vendor 0x) nxm_field+hm=0x06,nxm_field=0x03,hm=0
nxm_length=0x02 value=0x0800 (ethernet)
0x000x000x060x020x080x00

// OFPXMC12_NXM_0 (nxm_vendor 0x) nxm_field+hm=0x0c,nxm_field=0x06,hm=0
nxm_length=0x01 value=0x84 (sctp)
0x000x000x0c0x010x84

// OFPXMC_OPENFLOW_BASIC (0x8000) nxm_field+hm=0x24,nxm_field=0x12,hm=0
nxm_length=0x02 value=0x09 (sctp_dst_port)
0x800x000x240x020x000x09

// padding 7 bytes of 0s
0x000x000x000x000x000x000x00



Thanks,
Ashish

On Tue, Aug 20, 2019 at 3:45 AM kai xi fan  wrote:

> Thanks.
> I have read the following file.
> https://github.com/openvswitch/ovs/blob/master/include/openflow/nicira
> -ext.h
> But it's too simple to understand. For example, nicira extension use
> properties in "nxm packet_in_2" packet in format. But there is no such
> openflow message format in detail.
> I have to tcpdump the openflow packet to understand it.
> May be there is a official document about this ?
>
> Numan Siddique  于2019年8月20日周二 下午3:37写道:
>
>>
>>
>> On Tue, Aug 20, 2019 at 7:35 AM kai xi fan  wrote:
>>
>>> I am writing a controller to control ovs through openflow protocol.
>>> I found that  when I dump flows from ovs using ovs-ofctl. It shows me
>>> so many fields prefixed with "NXM".
>>> And we plan to use "nxm packet_in_2" format. It also needs nicira
>>> extensions.
>>> So if the controller wants to communicate with ovs using openflow 1.3, I
>>> have to deal with nicira extensions.
>>> But I could not found any document about its format and the
>>> corresponding openflow message format.
>>> Could any one help me ?
>>>
>>
>> I think you can find useful information here -
>> https://github.com/openvswitch/ovs/blob/master/include/openflow/nicira-ext.h
>>
>> Thanks
>> Numan
>>
>>
>>> thanks.
>>> ___
>>> discuss mailing list
>>> disc...@openvswitch.org
>>> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>>>
>> ___
> discuss mailing list
> disc...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] Is there any document about nicira externtion

2019-08-20 Thread Ben Pfaff
The implementation in OVS is here:
https://github.com/openvswitch/ovs/blob/master/lib/ofp-packet.c
It uses the same kind of TLV properties used in several places in
OpenFlow.

On Tue, Aug 20, 2019 at 06:45:21PM +0800, kai xi fan wrote:
> Thanks.
> I have read the following file.
> https://github.com/openvswitch/ovs/blob/master/include/openflow/nicira-ext.h
> 
> But it's too simple to understand. For example, nicira extension use
> properties in "nxm packet_in_2" packet in format. But there is no such
> openflow message format in detail.
> I have to tcpdump the openflow packet to understand it.
> May be there is a official document about this ?
> 
> Numan Siddique  于2019年8月20日周二 下午3:37写道:
> 
> >
> >
> > On Tue, Aug 20, 2019 at 7:35 AM kai xi fan  wrote:
> >
> >> I am writing a controller to control ovs through openflow protocol.
> >> I found that  when I dump flows from ovs using ovs-ofctl. It shows me so
> >> many fields prefixed with "NXM".
> >> And we plan to use "nxm packet_in_2" format. It also needs nicira
> >> extensions.
> >> So if the controller wants to communicate with ovs using openflow 1.3, I
> >> have to deal with nicira extensions.
> >> But I could not found any document about its format and the corresponding
> >> openflow message format.
> >> Could any one help me ?
> >>
> >
> > I think you can find useful information here -
> > https://github.com/openvswitch/ovs/blob/master/include/openflow/nicira-ext.h
> >
> > Thanks
> > Numan
> >
> >
> >> thanks.
> >> ___
> >> discuss mailing list
> >> disc...@openvswitch.org
> >> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
> >>
> >

> ___
> discuss mailing list
> disc...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] Is there any document about nicira externtion

2019-08-20 Thread kai xi fan
Thanks.
I have read the following file.
https://github.com/openvswitch/ovs/blob/master/include/openflow/nicira-ext.h

But it's too simple to understand. For example, nicira extension use
properties in "nxm packet_in_2" packet in format. But there is no such
openflow message format in detail.
I have to tcpdump the openflow packet to understand it.
May be there is a official document about this ?

Numan Siddique  于2019年8月20日周二 下午3:37写道:

>
>
> On Tue, Aug 20, 2019 at 7:35 AM kai xi fan  wrote:
>
>> I am writing a controller to control ovs through openflow protocol.
>> I found that  when I dump flows from ovs using ovs-ofctl. It shows me so
>> many fields prefixed with "NXM".
>> And we plan to use "nxm packet_in_2" format. It also needs nicira
>> extensions.
>> So if the controller wants to communicate with ovs using openflow 1.3, I
>> have to deal with nicira extensions.
>> But I could not found any document about its format and the corresponding
>> openflow message format.
>> Could any one help me ?
>>
>
> I think you can find useful information here -
> https://github.com/openvswitch/ovs/blob/master/include/openflow/nicira-ext.h
>
> Thanks
> Numan
>
>
>> thanks.
>> ___
>> discuss mailing list
>> disc...@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>>
>
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] Is there any document about nicira externtion

2019-08-20 Thread Numan Siddique
On Tue, Aug 20, 2019 at 7:35 AM kai xi fan  wrote:

> I am writing a controller to control ovs through openflow protocol.
> I found that  when I dump flows from ovs using ovs-ofctl. It shows me so
> many fields prefixed with "NXM".
> And we plan to use "nxm packet_in_2" format. It also needs nicira
> extensions.
> So if the controller wants to communicate with ovs using openflow 1.3, I
> have to deal with nicira extensions.
> But I could not found any document about its format and the corresponding
> openflow message format.
> Could any one help me ?
>

I think you can find useful information here -
https://github.com/openvswitch/ovs/blob/master/include/openflow/nicira-ext.h

Thanks
Numan


> thanks.
> ___
> discuss mailing list
> disc...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>
___
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss


Re: [ovs-discuss] [OVN] Aging mechanism for MAC_Binding table

2019-08-20 Thread Daniel Alvarez Sanchez
Hi folks,

Reviving this thread as we're seeing this more and more problematic.
Combining the ideas mentioned up thread, Dumitru, Numan, Lucas and I
had some internal discussion where we came up with a possible approach
and we'd love to get feedback from you:

- Local ovn-controller will always insert an OF rule per MAC_Binding
entry to match on src_ip + src_mac that will be sampled with a meter
to ovn-controller.
- When ovn-controller sees that one entry has not been hit "for a
while", it'll delete the OpenFlow rule in table 65 that fills the
eth.dst field with the MAC_Binding info.
- This will result in further ARP requests from the instance(s) that
will refresh the MAC_Binding entries in the database.

This could make troubleshooting a bit harder so at some point it'll be
great to have a mechanism in OVS where we could disable a flow instead
of deleting it. This way, one can tell that the flows in table 65 have
been disabled due to the aging mechanism in the local node.

Thoughts? Is there any performance consideration regarding the extra
flows and meters?

Thanks a lot!
Daniel


On Tue, Jul 9, 2019 at 7:19 AM Ben Pfaff  wrote:
>
> On Mon, Jul 08, 2019 at 06:19:23PM -0700, Han Zhou wrote:
> > On Thu, Jun 27, 2019 at 6:44 AM Ben Pfaff  wrote:
> > >
> > > On Tue, Jun 25, 2019 at 01:05:21PM +0200, Daniel Alvarez Sanchez wrote:
> > > > Lately we've been trying to solve certain issues related to stale
> > > > entries in the MAC_Binding table (e.g. [0]). On the other hand, for
> > > > the OpenStack + Octavia (Load Balancing service) use case, we see that
> > > > a reused VIP can be as well affected by stale entries in this table
> > > > due to the fact that it's never bound to a VIF so ovn-controller won't
> > > > claim it and send the GARPs to update the neighbors.
> > > >
> > > > I'm not sure if other scenarios may suffer from this issue but seems
> > > > reasonable to have an aging mechanism (as we discussed at some point
> > > > in the past) that makes unused/old entries to expire. After talking to
> > > > Numan on IRC, since a new pinctrl thread has been introduced recently
> > > > [1], it'd be nice to implement this aging mechanism there.
> > > > At the same time we'd be also reducing the amount of entries for long
> > > > lived systems as it'd grow indefinitely.
> > > >
> > > > Any thoughts?
> > > >
> > > > Thanks!
> > > > Daniel
> > > >
> > > > PS. With regards to the 'unused' vs 'old' entries I think it has to be
> > > > 'old' rather than 'unused' as I don't see a way to reset the TTL of a
> > > > MAC_Binding entry when we see packets coming. The implication is that
> > > > we'll be seeing ARPs sent out more often when perhaps they're not
> > > > needed. This also leads to the discussion of making the cache timeout
> > > > configurable.
> > >
> > > I've always considered the MAC_Binding implementation incomplete because
> > > of this issue and others.  ovn/TODO.rst says:
> > >
> > > * Dynamic IP to MAC binding enhancements.
> > >
> > >   OVN has basic support for establishing IP to MAC bindings
> > dynamically, using
> > >   ARP.
> > >
> > >   * Ratelimiting.
> > >
> > > From casual observation, Linux appears to generate at most one
> > ARP per
> > > second per destination.
> > >
> > > This might be supported by adding a new OVN logical action for
> > > rate-limiting.
> > >
> > >   * Tracking queries
> > >
> > >  It's probably best to only record in the database responses to
> > queries
> > >  actually issued by an L3 logical router, so somehow they have to
> > be
> > >  tracked, probably by putting a tentative binding without a MAC
> > address
> > >  into the database.
> > >
> > >   * Renewal and expiration.
> > >
> > > Something needs to make sure that bindings remain valid and
> > expire those
> > > that become stale.
> > >
> > > One way to do this might be to add some support for time to the
> > database
> > > server itself.
> > >
> > >   * Table size limiting.
> > >
> > > The table of MAC bindings must not be allowed to grow
> > unreasonably large.
> > >
> > >   * MTU handling (fragmentation on output)
> > >
> > > So, what do we do about it?  First, I think that adding support for time
> > > to the database server is a terrible idea (even though I think I wrote
> > > the above originally).  Let's not do that.  The following is some
> > > "thinking out loud" on the subject.
> > >
> > > I think there's a challenge around which ovn-controller should take care
> > > of a given MAC_Binding.  We don't want every ovn-controller expiring
> > > every binding.  Ideally, we want exactly one ovn-controller expiring a
> > > binding.  One way would be to add an owner column (but it would be
> > > better if we don't need it).
> > >
> > > If we want to keep track of "unused" bindings, I can imagine a
> > > statistical mechanism to do that.  Any user of a binding occasionally
>