mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 23:35:27 +00:00
dpif-netlink: Offloading meter to tc police action
OVS meters are created in advance and openflow rules refer to them by their unique ID. New tc_police API is used to offload them. By calling the API, police actions are created and meters are mapped to them. These actions then can be used in tc filter rules by the index. Signed-off-by: Jianbo Liu <jianbol@nvidia.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Simon Horman <simon.horman@corigine.com>
This commit is contained in:
@@ -4163,11 +4163,18 @@ static int
|
||||
dpif_netlink_meter_set(struct dpif *dpif_, ofproto_meter_id meter_id,
|
||||
struct ofputil_meter_config *config)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (probe_broken_meters(dpif_)) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
return dpif_netlink_meter_set__(dpif_, meter_id, config);
|
||||
err = dpif_netlink_meter_set__(dpif_, meter_id, config);
|
||||
if (!err && netdev_is_flow_api_enabled()) {
|
||||
meter_offload_set(meter_id, config);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Retrieve statistics and/or delete meter 'meter_id'. Statistics are
|
||||
@@ -4258,16 +4265,30 @@ static int
|
||||
dpif_netlink_meter_get(const struct dpif *dpif, ofproto_meter_id meter_id,
|
||||
struct ofputil_meter_stats *stats, uint16_t max_bands)
|
||||
{
|
||||
return dpif_netlink_meter_get_stats(dpif, meter_id, stats, max_bands,
|
||||
OVS_METER_CMD_GET);
|
||||
int err;
|
||||
|
||||
err = dpif_netlink_meter_get_stats(dpif, meter_id, stats, max_bands,
|
||||
OVS_METER_CMD_GET);
|
||||
if (!err && netdev_is_flow_api_enabled()) {
|
||||
meter_offload_get(meter_id, stats);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
dpif_netlink_meter_del(struct dpif *dpif, ofproto_meter_id meter_id,
|
||||
struct ofputil_meter_stats *stats, uint16_t max_bands)
|
||||
{
|
||||
return dpif_netlink_meter_get_stats(dpif, meter_id, stats, max_bands,
|
||||
OVS_METER_CMD_DEL);
|
||||
int err;
|
||||
|
||||
err = dpif_netlink_meter_get_stats(dpif, meter_id, stats,
|
||||
max_bands, OVS_METER_CMD_DEL);
|
||||
if (!err && netdev_is_flow_api_enabled()) {
|
||||
meter_offload_del(meter_id, stats);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
Reference in New Issue
Block a user