mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 07:15:17 +00:00
netdev-linux: Remove tc_matchall_fill_police.
It is equivalent to tc_policer_init() so remove the duplicated function. Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Adrian Moreno <amorenoz@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
a86fea06fe
commit
13e183da31
@@ -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_del_qdisc(struct netdev *netdev);
|
||||||
static int tc_query_qdisc(const 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
|
void
|
||||||
tc_put_rtab(struct ofpbuf *msg, uint16_t type, const struct tc_ratespec *rate,
|
tc_put_rtab(struct ofpbuf *msg, uint16_t type, const struct tc_ratespec *rate,
|
||||||
@@ -2661,29 +2663,6 @@ exit:
|
|||||||
return error;
|
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
|
static void
|
||||||
nl_msg_act_police_start_nest(struct ofpbuf *request, uint32_t prio,
|
nl_msg_act_police_start_nest(struct ofpbuf *request, uint32_t prio,
|
||||||
size_t *offset, size_t *act_offset,
|
size_t *offset, size_t *act_offset,
|
||||||
@@ -2764,7 +2743,7 @@ tc_add_matchall_policer(struct netdev *netdev, uint32_t kbits_rate,
|
|||||||
tcmsg->tcm_info = tc_make_handle(prio, eth_type);
|
tcmsg->tcm_info = tc_make_handle(prio, eth_type);
|
||||||
tcmsg->tcm_handle = handle;
|
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");
|
nl_msg_put_string(&request, TCA_KIND, "matchall");
|
||||||
basic_offset = nl_msg_start_nested(&request, TCA_OPTIONS);
|
basic_offset = nl_msg_start_nested(&request, TCA_OPTIONS);
|
||||||
action_offset = nl_msg_start_nested(&request, TCA_MATCHALL_ACT);
|
action_offset = nl_msg_start_nested(&request, TCA_MATCHALL_ACT);
|
||||||
|
Reference in New Issue
Block a user