It is equivalent to tc_policer_init() so remove the duplicated function.

Reviewed-by: Simon Horman <simon.hor...@corigine.com>
Signed-off-by: Adrian Moreno <amore...@redhat.com>
---
 lib/netdev-linux.c | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index dff9d627f..1f6c76e95 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -510,6 +510,8 @@ static int tc_delete_class(const struct netdev *, unsigned 
int handle);
 
 static int tc_del_qdisc(struct netdev *netdev);
 static int tc_query_qdisc(const struct netdev *netdev);
+static void tc_policer_init(struct tc_police *tc_police, uint64_t kbits_rate,
+                            uint64_t kbits_burst);
 
 void
 tc_put_rtab(struct ofpbuf *msg, uint16_t type, const struct tc_ratespec *rate,
@@ -2627,29 +2629,6 @@ exit:
     return error;
 }
 
-static struct tc_police
-tc_matchall_fill_police(uint32_t kbits_rate, uint32_t kbits_burst)
-{
-    unsigned int bsize = MIN(UINT32_MAX / 1024, kbits_burst) * 1024 / 8;
-    unsigned int bps = ((uint64_t) kbits_rate * 1000) / 8;
-    struct tc_police police;
-    struct tc_ratespec rate;
-    int mtu = 65535;
-
-    memset(&rate, 0, sizeof rate);
-    rate.rate = bps;
-    rate.cell_log = tc_calc_cell_log(mtu);
-    rate.mpu = ETH_TOTAL_MIN;
-
-    memset(&police, 0, sizeof police);
-    police.burst = tc_bytes_to_ticks(bps, bsize);
-    police.action = TC_POLICE_SHOT;
-    police.rate = rate;
-    police.mtu = mtu;
-
-    return police;
-}
-
 static void
 nl_msg_act_police_start_nest(struct ofpbuf *request, uint32_t prio,
                              size_t *offset, size_t *act_offset,
@@ -2730,7 +2709,7 @@ tc_add_matchall_policer(struct netdev *netdev, uint32_t 
kbits_rate,
     tcmsg->tcm_info = tc_make_handle(prio, eth_type);
     tcmsg->tcm_handle = handle;
 
-    pol_act = tc_matchall_fill_police(kbits_rate, kbits_burst);
+    tc_policer_init(&pol_act, kbits_rate, kbits_burst);
     nl_msg_put_string(&request, TCA_KIND, "matchall");
     basic_offset = nl_msg_start_nested(&request, TCA_OPTIONS);
     action_offset = nl_msg_start_nested(&request, TCA_MATCHALL_ACT);
-- 
2.40.1

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

Reply via email to