Message ID | 20220816125009.508053-2-simon.horman@corigine.com |
---|---|
State | Superseded |
Headers | show |
Series | netdev-offload-dpdk: update rte_flow phases 1 and 2 | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | warning | apply and check: warning |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
References: <20220816125009.508053-2-simon.horman@corigine.com> Bleep bloop. Greetings Simon Horman, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. checkpatch: WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Simon Horman <simon.horman@corigine.com> ERROR: Inappropriate bracing around statement #68 FILE: lib/netdev-offload-dpdk.c:1891: if (type == RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP) \ Lines checked: 88, Warnings: 1, Errors: 1 Please check this out. If you feel there has been an error, please email aconole@redhat.com Thanks, 0-day Robot
On 8/16/2022 3:50 PM, Simon Horman wrote: > From: Chaoyong He <chaoyong.he@corigine.com> > > Add the support of offload of set IPv4 DSCP action. > > Signed-off-by: Chaoyong He <chaoyong.he@corigine.com> > Signed-off-by: Simon Horman <simon.horman@corigine.com> > --- > lib/netdev-offload-dpdk.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c > index cceefbc50751..732ce6021722 100644 > --- a/lib/netdev-offload-dpdk.c > +++ b/lib/netdev-offload-dpdk.c > @@ -770,6 +770,14 @@ dump_flow_action(struct ds *s, struct ds *s_extra, > IP_ARGS(set_ipv4->ipv4_addr)); > } > ds_put_cstr(s, "/ "); > + } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP) { > + const struct rte_flow_action_set_dscp *set_dscp = actions->conf; > + > + ds_put_cstr(s, "set_dscp "); > + if (set_dscp) { > + ds_put_format(s, "dscp_value %d ", set_dscp->dscp); > + } > + ds_put_cstr(s, "/ "); > } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_TTL) { > const struct rte_flow_action_set_ttl *set_ttl = actions->conf; > > @@ -1813,7 +1821,8 @@ add_output_action(struct netdev *netdev, > static int > add_set_flow_action__(struct flow_actions *actions, > const void *value, void *mask, > - const size_t size, const int attr) > + const size_t size, const int attr, > + bool dscp_flag) Instead of a special argument for dscp, we can have a generic bitmask argument, that if set will override the size argument. This way it will be easier to add more such fields in the future. > { > void *spec; > > @@ -1824,7 +1833,7 @@ add_set_flow_action__(struct flow_actions *actions, > if (is_all_zeros(mask, size)) { > return 0; > } > - if (!is_all_ones(mask, size)) { > + if (!dscp_flag && !is_all_ones(mask, size)) { if ((bitmask && (*(uint8_t) mask) == bitmask) || !is_all_ones(mask, size)) { > VLOG_DBG_RL(&rl, "Partial mask is not supported"); > return -1; > } > @@ -1849,6 +1858,8 @@ BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv4) == > MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_src)); > BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv4) == > MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_dst)); > +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_dscp) == > + MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_tos)); > BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) == > MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_ttl)); > BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == > @@ -1874,11 +1885,14 @@ parse_set_actions(struct flow_actions *actions, > { > const struct nlattr *sa; > unsigned int sleft; > + bool dscp_flag = false; > > #define add_set_flow_action(field, type) \ > + if (type == RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP) \ > + dscp_flag = true; \ bitmask = RTE_IPV4_HDR_DSCP_MASK else bitmask = 0 > if (add_set_flow_action__(actions, &key->field, \ > mask ? CONST_CAST(void *, &mask->field) : NULL, \ > - sizeof key->field, type)) { \ > + sizeof key->field, type, dscp_flag)) { \ > return -1; \ > } > > @@ -1900,6 +1914,7 @@ parse_set_actions(struct flow_actions *actions, > > add_set_flow_action(ipv4_src, RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC); > add_set_flow_action(ipv4_dst, RTE_FLOW_ACTION_TYPE_SET_IPV4_DST); > + add_set_flow_action(ipv4_tos, RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP); > add_set_flow_action(ipv4_ttl, RTE_FLOW_ACTION_TYPE_SET_TTL); > > if (mask && !is_all_zeros(mask, sizeof *mask)) {
diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index cceefbc50751..732ce6021722 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -770,6 +770,14 @@ dump_flow_action(struct ds *s, struct ds *s_extra, IP_ARGS(set_ipv4->ipv4_addr)); } ds_put_cstr(s, "/ "); + } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP) { + const struct rte_flow_action_set_dscp *set_dscp = actions->conf; + + ds_put_cstr(s, "set_dscp "); + if (set_dscp) { + ds_put_format(s, "dscp_value %d ", set_dscp->dscp); + } + ds_put_cstr(s, "/ "); } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_TTL) { const struct rte_flow_action_set_ttl *set_ttl = actions->conf; @@ -1813,7 +1821,8 @@ add_output_action(struct netdev *netdev, static int add_set_flow_action__(struct flow_actions *actions, const void *value, void *mask, - const size_t size, const int attr) + const size_t size, const int attr, + bool dscp_flag) { void *spec; @@ -1824,7 +1833,7 @@ add_set_flow_action__(struct flow_actions *actions, if (is_all_zeros(mask, size)) { return 0; } - if (!is_all_ones(mask, size)) { + if (!dscp_flag && !is_all_ones(mask, size)) { VLOG_DBG_RL(&rl, "Partial mask is not supported"); return -1; } @@ -1849,6 +1858,8 @@ BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv4) == MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_src)); BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv4) == MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_dst)); +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_dscp) == + MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_tos)); BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) == MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_ttl)); BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == @@ -1874,11 +1885,14 @@ parse_set_actions(struct flow_actions *actions, { const struct nlattr *sa; unsigned int sleft; + bool dscp_flag = false; #define add_set_flow_action(field, type) \ + if (type == RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP) \ + dscp_flag = true; \ if (add_set_flow_action__(actions, &key->field, \ mask ? CONST_CAST(void *, &mask->field) : NULL, \ - sizeof key->field, type)) { \ + sizeof key->field, type, dscp_flag)) { \ return -1; \ } @@ -1900,6 +1914,7 @@ parse_set_actions(struct flow_actions *actions, add_set_flow_action(ipv4_src, RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC); add_set_flow_action(ipv4_dst, RTE_FLOW_ACTION_TYPE_SET_IPV4_DST); + add_set_flow_action(ipv4_tos, RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP); add_set_flow_action(ipv4_ttl, RTE_FLOW_ACTION_TYPE_SET_TTL); if (mask && !is_all_zeros(mask, sizeof *mask)) {