[ovs-dev] dpif-netdev: Use portable error code for zero rate meter band

Message ID 1506627575-2875-1-git-send-email-azhou@ovn.org
State New
Headers show
Series
  • [ovs-dev] dpif-netdev: Use portable error code for zero rate meter band
Related show

Commit Message

Andy Zhou Sept. 28, 2017, 7:39 p.m.
'EBADRQC' is only defined on the Linux platform. Without this fix,
The travis MacOS build fails. Switching to using EDOM which is more
portable.

Fixes: 2029ce9ac3a601 (dpif-netdev: Fix a zero-rate bug for meter)
CC: Ali Volkan ATLI <volkan.atli@argela.com.tr>
Signed-off-by: Andy Zhou <azhou@ovn.org>
---
 lib/dpif-netdev.c      | 2 +-
 ofproto/ofproto-dpif.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Joe Stringer Sept. 29, 2017, 2:31 a.m. | #1
On 28 September 2017 at 12:39, Andy Zhou <azhou@ovn.org> wrote:
> 'EBADRQC' is only defined on the Linux platform. Without this fix,
> The travis MacOS build fails. Switching to using EDOM which is more
> portable.
>
> Fixes: 2029ce9ac3a601 (dpif-netdev: Fix a zero-rate bug for meter)
> CC: Ali Volkan ATLI <volkan.atli@argela.com.tr>
> Signed-off-by: Andy Zhou <azhou@ovn.org>

LGTM.

Acked-by: Joe Stringer <joe@ovn.org>
Andy Zhou Sept. 29, 2017, 7:46 p.m. | #2
On Thu, Sep 28, 2017 at 7:31 PM, Joe Stringer <joe@ovn.org> wrote:
> On 28 September 2017 at 12:39, Andy Zhou <azhou@ovn.org> wrote:
>> 'EBADRQC' is only defined on the Linux platform. Without this fix,
>> The travis MacOS build fails. Switching to using EDOM which is more
>> portable.
>>
>> Fixes: 2029ce9ac3a601 (dpif-netdev: Fix a zero-rate bug for meter)
>> CC: Ali Volkan ATLI <volkan.atli@argela.com.tr>
>> Signed-off-by: Andy Zhou <azhou@ovn.org>
>
> LGTM.
>
> Acked-by: Joe Stringer <joe@ovn.org>

Thanks for the review!  Pushed to master and branch 2.8.

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 0fce94e0e409..d5eb8305c8a2 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4285,7 +4285,7 @@  dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id *meter_id,
     /* Validate rates */
     for (i = 0; i < config->n_bands; i++) {
         if (config->bands[i].rate == 0) {
-            return EBADRQC; /* rate must be non-zero */
+            return EDOM; /* rate must be non-zero */
         }
     }
 
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index d99dc9d88788..43d670a15c3f 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5695,7 +5695,7 @@  meter_set(struct ofproto *ofproto_, ofproto_meter_id *meter_id,
         return OFPERR_OFPMMFC_OUT_OF_BANDS;
     case ENODEV: /* Unsupported band type */
         return OFPERR_OFPMMFC_BAD_BAND;
-    case EBADRQC: /* Rate must be non-zero */
+    case EDOM: /* Rate must be non-zero */
         return OFPERR_OFPMMFC_BAD_RATE;
     default:
         return OFPERR_OFPMMFC_UNKNOWN;