Re: [ovs-dev] [PATCH] datapath: meter: Fix setting meter id for new entries

2018-08-08 Thread Justin Pettit



> On Aug 7, 2018, at 10:19 PM, Gregory Rose  wrote:
> 
> 
> On 8/7/2018 8:31 PM, Justin Pettit wrote:
>> Thanks, Greg. I actually have this queued up with another patch that will 
>> disable meters entirely on broken kernels. I plan to send that out tomorrow.
>> 
>> --Justin
> 
> Oops - perhaps I was a bit hasty.  I was just trying to get caught up with 
> upstream.
> 
> Apologies if I interrupted your work flow.

No problem at all.  I appreciate you staying on top of this!  We'd already had 
a few patches slip through the cracks recently, so it's great to have you 
keeping them in sync.

--Justin


___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] datapath: meter: Fix setting meter id for new entries

2018-08-08 Thread Justin Pettit
That's fine.  I had just been holding off because I thought you'd wanted the 
probe to disable meters on kernels with a broken implementation.  Regardless, I 
did get that patch out earlier today:

https://mail.openvswitch.org/pipermail/ovs-dev/2018-August/350885.html

Thanks,

--Justin


> On Aug 8, 2018, at 8:12 AM, Ben Pfaff  wrote:
> 
> Justin, I already applied this as a straightforward backport.  Hope it
> doesn't disrupt your work.
> 
> On Tue, Aug 07, 2018 at 08:31:35PM -0700, Justin Pettit wrote:
>> Thanks, Greg. I actually have this queued up with another patch that will 
>> disable meters entirely on broken kernels. I plan to send that out tomorrow. 
>> 
>> --Justin
>> 
>> 
>>> On Aug 7, 2018, at 4:45 PM, Greg Rose  wrote:
>>> 
>>> From: Justin Pettit 
>>> 
>>> Upstream commit:
>>>   From: Justin Pettit 
>>>   Date: Sat, 28 Jul 2018 15:26:01 -0700
>>>   Subject: [PATCH] openvswitch: meter: Fix setting meter id for new entries
>>> 
>>>   The meter code would create an entry for each new meter.  However, it
>>>   would not set the meter id in the new entry, so every meter would appear
>>>   to have a meter id of zero.  This commit properly sets the meter id when
>>>   adding the entry.
>>> 
>>>   Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
>>>   Signed-off-by: Justin Pettit 
>>>   Cc: Andy Zhou 
>>>   Signed-off-by: David S. Miller 
>>> 
>>> Cc: Justin Pettit 
>>> Signed-off-by: Greg Rose 
>>> ---
>>> datapath/meter.c | 10 +-
>>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>> 
>>> diff --git a/datapath/meter.c b/datapath/meter.c
>>> index 1c2ed46..281d869 100644
>>> --- a/datapath/meter.c
>>> +++ b/datapath/meter.c
>>> @@ -221,6 +221,7 @@ static struct dp_meter *dp_meter_create(struct nlattr 
>>> **a)
>>>   if (!meter)
>>>   return ERR_PTR(-ENOMEM);
>>> 
>>> +meter->id = nla_get_u32(a[OVS_METER_ATTR_ID]);
>>>   meter->used = div_u64(ktime_get_ns(), 1000 * 1000);
>>>   meter->kbps = a[OVS_METER_ATTR_KBPS] ? 1 : 0;
>>>   meter->keep_stats = !a[OVS_METER_ATTR_CLEAR];
>>> @@ -290,6 +291,10 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, 
>>> struct genl_info *info)
>>>   u32 meter_id;
>>>   bool failed;
>>> 
>>> +if (!a[OVS_METER_ATTR_ID]) {
>>> +return -ENODEV;
>>> +}
>>> +
>>>   meter = dp_meter_create(a);
>>>   if (IS_ERR_OR_NULL(meter))
>>>   return PTR_ERR(meter);
>>> @@ -308,11 +313,6 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, 
>>> struct genl_info *info)
>>>   goto exit_unlock;
>>>   }
>>> 
>>> -if (!a[OVS_METER_ATTR_ID]) {
>>> -err = -ENODEV;
>>> -goto exit_unlock;
>>> -}
>>> -
>>>   meter_id = nla_get_u32(a[OVS_METER_ATTR_ID]);
>>> 
>>>   /* Cannot fail after this. */
>>> -- 
>>> 1.8.3.1
>>> 
>> 
>> ___
>> dev mailing list
>> d...@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] datapath: meter: Fix setting meter id for new entries

2018-08-08 Thread Ben Pfaff
Justin, I already applied this as a straightforward backport.  Hope it
doesn't disrupt your work.

On Tue, Aug 07, 2018 at 08:31:35PM -0700, Justin Pettit wrote:
> Thanks, Greg. I actually have this queued up with another patch that will 
> disable meters entirely on broken kernels. I plan to send that out tomorrow. 
> 
> --Justin
> 
> 
> > On Aug 7, 2018, at 4:45 PM, Greg Rose  wrote:
> > 
> > From: Justin Pettit 
> > 
> > Upstream commit:
> >From: Justin Pettit 
> >Date: Sat, 28 Jul 2018 15:26:01 -0700
> >Subject: [PATCH] openvswitch: meter: Fix setting meter id for new entries
> > 
> >The meter code would create an entry for each new meter.  However, it
> >would not set the meter id in the new entry, so every meter would appear
> >to have a meter id of zero.  This commit properly sets the meter id when
> >adding the entry.
> > 
> >Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
> >Signed-off-by: Justin Pettit 
> >Cc: Andy Zhou 
> >Signed-off-by: David S. Miller 
> > 
> > Cc: Justin Pettit 
> > Signed-off-by: Greg Rose 
> > ---
> > datapath/meter.c | 10 +-
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/datapath/meter.c b/datapath/meter.c
> > index 1c2ed46..281d869 100644
> > --- a/datapath/meter.c
> > +++ b/datapath/meter.c
> > @@ -221,6 +221,7 @@ static struct dp_meter *dp_meter_create(struct nlattr 
> > **a)
> >if (!meter)
> >return ERR_PTR(-ENOMEM);
> > 
> > +meter->id = nla_get_u32(a[OVS_METER_ATTR_ID]);
> >meter->used = div_u64(ktime_get_ns(), 1000 * 1000);
> >meter->kbps = a[OVS_METER_ATTR_KBPS] ? 1 : 0;
> >meter->keep_stats = !a[OVS_METER_ATTR_CLEAR];
> > @@ -290,6 +291,10 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, 
> > struct genl_info *info)
> >u32 meter_id;
> >bool failed;
> > 
> > +if (!a[OVS_METER_ATTR_ID]) {
> > +return -ENODEV;
> > +}
> > +
> >meter = dp_meter_create(a);
> >if (IS_ERR_OR_NULL(meter))
> >return PTR_ERR(meter);
> > @@ -308,11 +313,6 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, 
> > struct genl_info *info)
> >goto exit_unlock;
> >}
> > 
> > -if (!a[OVS_METER_ATTR_ID]) {
> > -err = -ENODEV;
> > -goto exit_unlock;
> > -}
> > -
> >meter_id = nla_get_u32(a[OVS_METER_ATTR_ID]);
> > 
> >/* Cannot fail after this. */
> > -- 
> > 1.8.3.1
> > 
> 
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] datapath: meter: Fix setting meter id for new entries

2018-08-07 Thread Gregory Rose


On 8/7/2018 8:31 PM, Justin Pettit wrote:

Thanks, Greg. I actually have this queued up with another patch that will 
disable meters entirely on broken kernels. I plan to send that out tomorrow.

--Justin


Oops - perhaps I was a bit hasty.  I was just trying to get caught up 
with upstream.


Apologies if I interrupted your work flow.

- Greg





On Aug 7, 2018, at 4:45 PM, Greg Rose  wrote:

From: Justin Pettit 

Upstream commit:
From: Justin Pettit 
Date: Sat, 28 Jul 2018 15:26:01 -0700
Subject: [PATCH] openvswitch: meter: Fix setting meter id for new entries

The meter code would create an entry for each new meter.  However, it
would not set the meter id in the new entry, so every meter would appear
to have a meter id of zero.  This commit properly sets the meter id when
adding the entry.

Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
Signed-off-by: Justin Pettit 
Cc: Andy Zhou 
Signed-off-by: David S. Miller 

Cc: Justin Pettit 
Signed-off-by: Greg Rose 
---
datapath/meter.c | 10 +-
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/datapath/meter.c b/datapath/meter.c
index 1c2ed46..281d869 100644
--- a/datapath/meter.c
+++ b/datapath/meter.c
@@ -221,6 +221,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)
if (!meter)
return ERR_PTR(-ENOMEM);

+meter->id = nla_get_u32(a[OVS_METER_ATTR_ID]);
meter->used = div_u64(ktime_get_ns(), 1000 * 1000);
meter->kbps = a[OVS_METER_ATTR_KBPS] ? 1 : 0;
meter->keep_stats = !a[OVS_METER_ATTR_CLEAR];
@@ -290,6 +291,10 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, struct 
genl_info *info)
u32 meter_id;
bool failed;

+if (!a[OVS_METER_ATTR_ID]) {
+return -ENODEV;
+}
+
meter = dp_meter_create(a);
if (IS_ERR_OR_NULL(meter))
return PTR_ERR(meter);
@@ -308,11 +313,6 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, struct 
genl_info *info)
goto exit_unlock;
}

-if (!a[OVS_METER_ATTR_ID]) {
-err = -ENODEV;
-goto exit_unlock;
-}
-
meter_id = nla_get_u32(a[OVS_METER_ATTR_ID]);

/* Cannot fail after this. */
--
1.8.3.1



___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] datapath: meter: Fix setting meter id for new entries

2018-08-07 Thread Justin Pettit
Thanks, Greg. I actually have this queued up with another patch that will 
disable meters entirely on broken kernels. I plan to send that out tomorrow. 

--Justin


> On Aug 7, 2018, at 4:45 PM, Greg Rose  wrote:
> 
> From: Justin Pettit 
> 
> Upstream commit:
>From: Justin Pettit 
>Date: Sat, 28 Jul 2018 15:26:01 -0700
>Subject: [PATCH] openvswitch: meter: Fix setting meter id for new entries
> 
>The meter code would create an entry for each new meter.  However, it
>would not set the meter id in the new entry, so every meter would appear
>to have a meter id of zero.  This commit properly sets the meter id when
>adding the entry.
> 
>Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
>Signed-off-by: Justin Pettit 
>Cc: Andy Zhou 
>Signed-off-by: David S. Miller 
> 
> Cc: Justin Pettit 
> Signed-off-by: Greg Rose 
> ---
> datapath/meter.c | 10 +-
> 1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/datapath/meter.c b/datapath/meter.c
> index 1c2ed46..281d869 100644
> --- a/datapath/meter.c
> +++ b/datapath/meter.c
> @@ -221,6 +221,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)
>if (!meter)
>return ERR_PTR(-ENOMEM);
> 
> +meter->id = nla_get_u32(a[OVS_METER_ATTR_ID]);
>meter->used = div_u64(ktime_get_ns(), 1000 * 1000);
>meter->kbps = a[OVS_METER_ATTR_KBPS] ? 1 : 0;
>meter->keep_stats = !a[OVS_METER_ATTR_CLEAR];
> @@ -290,6 +291,10 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, struct 
> genl_info *info)
>u32 meter_id;
>bool failed;
> 
> +if (!a[OVS_METER_ATTR_ID]) {
> +return -ENODEV;
> +}
> +
>meter = dp_meter_create(a);
>if (IS_ERR_OR_NULL(meter))
>return PTR_ERR(meter);
> @@ -308,11 +313,6 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, struct 
> genl_info *info)
>goto exit_unlock;
>}
> 
> -if (!a[OVS_METER_ATTR_ID]) {
> -err = -ENODEV;
> -goto exit_unlock;
> -}
> -
>meter_id = nla_get_u32(a[OVS_METER_ATTR_ID]);
> 
>/* Cannot fail after this. */
> -- 
> 1.8.3.1
> 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] datapath: meter: Fix setting meter id for new entries

2018-08-07 Thread Gregory Rose

On 8/7/2018 4:55 PM, Ben Pfaff wrote:

On Tue, Aug 07, 2018 at 04:45:26PM -0700, Greg Rose wrote:

From: Justin Pettit 

Upstream commit:
 From: Justin Pettit 
 Date: Sat, 28 Jul 2018 15:26:01 -0700
 Subject: [PATCH] openvswitch: meter: Fix setting meter id for new entries

 The meter code would create an entry for each new meter.  However, it
 would not set the meter id in the new entry, so every meter would appear
 to have a meter id of zero.  This commit properly sets the meter id when
 adding the entry.

 Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
 Signed-off-by: Justin Pettit 
 Cc: Andy Zhou 
 Signed-off-by: David S. Miller 

Cc: Justin Pettit 
Signed-off-by: Greg Rose 

Thanks, applied to master and branch-2.10.  If it needs backporting
further (maybe it does?), it didn't apply without conflicts, so maybe
posting a backported version would be a good idea.

Thanks,

Ben.


Justin may correct me but as I recall metering was added after 2.9. So I 
think master and 2.10 is fine.


Thanks Ben!

- Greg
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] datapath: meter: Fix setting meter id for new entries

2018-08-07 Thread Ben Pfaff
On Tue, Aug 07, 2018 at 04:45:26PM -0700, Greg Rose wrote:
> From: Justin Pettit 
> 
> Upstream commit:
> From: Justin Pettit 
> Date: Sat, 28 Jul 2018 15:26:01 -0700
> Subject: [PATCH] openvswitch: meter: Fix setting meter id for new entries
> 
> The meter code would create an entry for each new meter.  However, it
> would not set the meter id in the new entry, so every meter would appear
> to have a meter id of zero.  This commit properly sets the meter id when
> adding the entry.
> 
> Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
> Signed-off-by: Justin Pettit 
> Cc: Andy Zhou 
> Signed-off-by: David S. Miller 
> 
> Cc: Justin Pettit 
> Signed-off-by: Greg Rose 

Thanks, applied to master and branch-2.10.  If it needs backporting
further (maybe it does?), it didn't apply without conflicts, so maybe
posting a backported version would be a good idea.

Thanks,

Ben.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] datapath: meter: Fix setting meter id for new entries

2018-08-07 Thread Greg Rose
From: Justin Pettit 

Upstream commit:
From: Justin Pettit 
Date: Sat, 28 Jul 2018 15:26:01 -0700
Subject: [PATCH] openvswitch: meter: Fix setting meter id for new entries

The meter code would create an entry for each new meter.  However, it
would not set the meter id in the new entry, so every meter would appear
to have a meter id of zero.  This commit properly sets the meter id when
adding the entry.

Fixes: 96fbc13d7e77 ("openvswitch: Add meter infrastructure")
Signed-off-by: Justin Pettit 
Cc: Andy Zhou 
Signed-off-by: David S. Miller 

Cc: Justin Pettit 
Signed-off-by: Greg Rose 
---
 datapath/meter.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/datapath/meter.c b/datapath/meter.c
index 1c2ed46..281d869 100644
--- a/datapath/meter.c
+++ b/datapath/meter.c
@@ -221,6 +221,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)
if (!meter)
return ERR_PTR(-ENOMEM);
 
+   meter->id = nla_get_u32(a[OVS_METER_ATTR_ID]);
meter->used = div_u64(ktime_get_ns(), 1000 * 1000);
meter->kbps = a[OVS_METER_ATTR_KBPS] ? 1 : 0;
meter->keep_stats = !a[OVS_METER_ATTR_CLEAR];
@@ -290,6 +291,10 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, struct 
genl_info *info)
u32 meter_id;
bool failed;
 
+   if (!a[OVS_METER_ATTR_ID]) {
+   return -ENODEV;
+   }
+
meter = dp_meter_create(a);
if (IS_ERR_OR_NULL(meter))
return PTR_ERR(meter);
@@ -308,11 +313,6 @@ static int ovs_meter_cmd_set(struct sk_buff *skb, struct 
genl_info *info)
goto exit_unlock;
}
 
-   if (!a[OVS_METER_ATTR_ID]) {
-   err = -ENODEV;
-   goto exit_unlock;
-   }
-
meter_id = nla_get_u32(a[OVS_METER_ATTR_ID]);
 
/* Cannot fail after this. */
-- 
1.8.3.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev