mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
ct-dpif: Handle default zone limit the same way as other limits.
Internally handle default CT zone limit as other limits that can be passed via the list with special value -1. Currently, the -1 is treated by both datapaths as default, add static asserts to make sure that this remains the case in the future. This allows us to easily delete the default zone limit. Signed-off-by: Ales Musil <amusil@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
6b17235885
commit
4b9eb061b1
@@ -9450,17 +9450,10 @@ dpif_netdev_ct_get_sweep_interval(struct dpif *dpif, uint32_t *ms)
|
||||
|
||||
static int
|
||||
dpif_netdev_ct_set_limits(struct dpif *dpif,
|
||||
const uint32_t *default_limits,
|
||||
const struct ovs_list *zone_limits)
|
||||
{
|
||||
int err = 0;
|
||||
struct dp_netdev *dp = get_dp_netdev(dpif);
|
||||
if (default_limits) {
|
||||
err = zone_limit_update(dp->conntrack, DEFAULT_ZONE, *default_limits);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
struct ct_dpif_zone_limit *zone_limit;
|
||||
LIST_FOR_EACH (zone_limit, node, zone_limits) {
|
||||
@@ -9475,20 +9468,12 @@ dpif_netdev_ct_set_limits(struct dpif *dpif,
|
||||
|
||||
static int
|
||||
dpif_netdev_ct_get_limits(struct dpif *dpif,
|
||||
uint32_t *default_limit,
|
||||
const struct ovs_list *zone_limits_request,
|
||||
struct ovs_list *zone_limits_reply)
|
||||
{
|
||||
struct dp_netdev *dp = get_dp_netdev(dpif);
|
||||
struct conntrack_zone_limit czl;
|
||||
|
||||
czl = zone_limit_get(dp->conntrack, DEFAULT_ZONE);
|
||||
if (czl.zone == DEFAULT_ZONE) {
|
||||
*default_limit = czl.limit;
|
||||
} else {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (!ovs_list_is_empty(zone_limits_request)) {
|
||||
struct ct_dpif_zone_limit *zone_limit;
|
||||
LIST_FOR_EACH (zone_limit, node, zone_limits_request) {
|
||||
@@ -9502,6 +9487,12 @@ dpif_netdev_ct_get_limits(struct dpif *dpif,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
czl = zone_limit_get(dp->conntrack, DEFAULT_ZONE);
|
||||
if (czl.zone == DEFAULT_ZONE) {
|
||||
ct_dpif_push_zone_limit(zone_limits_reply, DEFAULT_ZONE,
|
||||
czl.limit, 0);
|
||||
}
|
||||
|
||||
for (int z = MIN_ZONE; z <= MAX_ZONE; z++) {
|
||||
czl = zone_limit_get(dp->conntrack, z);
|
||||
if (czl.zone == z) {
|
||||
|
Reference in New Issue
Block a user