Merge branch 'nfp-flower-a-few-small-conntrack-offload-fixes'
Louis Peens says: ==================== nfp: flower: a few small conntrack offload fixes This small series addresses two bugs in the nfp conntrack offloading code. The first patch is a check to prevent offloading for a case which is currently not supported by the nfp. The second patch fixes up parsing of layer4 mangling code so it can be correctly offloaded. Since the masks are an inverse mask and we are shifting it so it can be packed together with the destination we effectively need to 'clear' the lower bits of the mask by setting it to 0xFFFF. ==================== Link: https://lore.kernel.org/r/20240124151909.31603-1-louis.peens@corigine.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
d833683d43
@ -1424,10 +1424,30 @@ static void nfp_nft_ct_translate_mangle_action(struct flow_action_entry *mangle_
|
||||
mangle_action->mangle.mask = (__force u32)cpu_to_be32(mangle_action->mangle.mask);
|
||||
return;
|
||||
|
||||
/* Both struct tcphdr and struct udphdr start with
|
||||
* __be16 source;
|
||||
* __be16 dest;
|
||||
* so we can use the same code for both.
|
||||
*/
|
||||
case FLOW_ACT_MANGLE_HDR_TYPE_TCP:
|
||||
case FLOW_ACT_MANGLE_HDR_TYPE_UDP:
|
||||
mangle_action->mangle.val = (__force u16)cpu_to_be16(mangle_action->mangle.val);
|
||||
mangle_action->mangle.mask = (__force u16)cpu_to_be16(mangle_action->mangle.mask);
|
||||
if (mangle_action->mangle.offset == offsetof(struct tcphdr, source)) {
|
||||
mangle_action->mangle.val =
|
||||
(__force u32)cpu_to_be32(mangle_action->mangle.val << 16);
|
||||
/* The mask of mangle action is inverse mask,
|
||||
* so clear the dest tp port with 0xFFFF to
|
||||
* instead of rotate-left operation.
|
||||
*/
|
||||
mangle_action->mangle.mask =
|
||||
(__force u32)cpu_to_be32(mangle_action->mangle.mask << 16 | 0xFFFF);
|
||||
}
|
||||
if (mangle_action->mangle.offset == offsetof(struct tcphdr, dest)) {
|
||||
mangle_action->mangle.offset = 0;
|
||||
mangle_action->mangle.val =
|
||||
(__force u32)cpu_to_be32(mangle_action->mangle.val);
|
||||
mangle_action->mangle.mask =
|
||||
(__force u32)cpu_to_be32(mangle_action->mangle.mask);
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -1864,10 +1884,30 @@ int nfp_fl_ct_handle_post_ct(struct nfp_flower_priv *priv,
|
||||
{
|
||||
struct flow_rule *rule = flow_cls_offload_flow_rule(flow);
|
||||
struct nfp_fl_ct_flow_entry *ct_entry;
|
||||
struct flow_action_entry *ct_goto;
|
||||
struct nfp_fl_ct_zone_entry *zt;
|
||||
struct flow_action_entry *act;
|
||||
bool wildcarded = false;
|
||||
struct flow_match_ct ct;
|
||||
struct flow_action_entry *ct_goto;
|
||||
int i;
|
||||
|
||||
flow_action_for_each(i, act, &rule->action) {
|
||||
switch (act->id) {
|
||||
case FLOW_ACTION_REDIRECT:
|
||||
case FLOW_ACTION_REDIRECT_INGRESS:
|
||||
case FLOW_ACTION_MIRRED:
|
||||
case FLOW_ACTION_MIRRED_INGRESS:
|
||||
if (act->dev->rtnl_link_ops &&
|
||||
!strcmp(act->dev->rtnl_link_ops->kind, "openvswitch")) {
|
||||
NL_SET_ERR_MSG_MOD(extack,
|
||||
"unsupported offload: out port is openvswitch internal port");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
flow_rule_match_ct(rule, &ct);
|
||||
if (!ct.mask->ct_zone) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user