Commit 2b688ea5 authored by Maor Gottlieb's avatar Maor Gottlieb Committed by Saeed Mahameed

net/mlx5: Add flow steering actions to fs_cmd shim layer

Add flow steering actions: modify header and packet reformat
to the fs_cmd shim layer. This allows each namespace to define
possibly different functionality for alloc/dealloc action commands.
Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent a06ebb8d
...@@ -322,11 +322,11 @@ void mlx5_ib_destroy_flow_action_raw(struct mlx5_ib_flow_action *maction) ...@@ -322,11 +322,11 @@ void mlx5_ib_destroy_flow_action_raw(struct mlx5_ib_flow_action *maction)
switch (maction->flow_action_raw.sub_type) { switch (maction->flow_action_raw.sub_type) {
case MLX5_IB_FLOW_ACTION_MODIFY_HEADER: case MLX5_IB_FLOW_ACTION_MODIFY_HEADER:
mlx5_modify_header_dealloc(maction->flow_action_raw.dev->mdev, mlx5_modify_header_dealloc(maction->flow_action_raw.dev->mdev,
maction->flow_action_raw.action_id); maction->flow_action_raw.modify_hdr);
break; break;
case MLX5_IB_FLOW_ACTION_PACKET_REFORMAT: case MLX5_IB_FLOW_ACTION_PACKET_REFORMAT:
mlx5_packet_reformat_dealloc(maction->flow_action_raw.dev->mdev, mlx5_packet_reformat_dealloc(maction->flow_action_raw.dev->mdev,
maction->flow_action_raw.action_id); maction->flow_action_raw.pkt_reformat);
break; break;
case MLX5_IB_FLOW_ACTION_DECAP: case MLX5_IB_FLOW_ACTION_DECAP:
break; break;
...@@ -352,10 +352,11 @@ mlx5_ib_create_modify_header(struct mlx5_ib_dev *dev, ...@@ -352,10 +352,11 @@ mlx5_ib_create_modify_header(struct mlx5_ib_dev *dev,
if (!maction) if (!maction)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
ret = mlx5_modify_header_alloc(dev->mdev, namespace, num_actions, in, maction->flow_action_raw.modify_hdr =
&maction->flow_action_raw.action_id); mlx5_modify_header_alloc(dev->mdev, namespace, num_actions, in);
if (ret) { if (IS_ERR(maction->flow_action_raw.modify_hdr)) {
ret = PTR_ERR(maction->flow_action_raw.modify_hdr);
kfree(maction); kfree(maction);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
...@@ -479,11 +480,13 @@ static int mlx5_ib_flow_action_create_packet_reformat_ctx( ...@@ -479,11 +480,13 @@ static int mlx5_ib_flow_action_create_packet_reformat_ctx(
if (ret) if (ret)
return ret; return ret;
ret = mlx5_packet_reformat_alloc(dev->mdev, prm_prt, len, maction->flow_action_raw.pkt_reformat =
in, namespace, mlx5_packet_reformat_alloc(dev->mdev, prm_prt, len,
&maction->flow_action_raw.action_id); in, namespace);
if (ret) if (IS_ERR(maction->flow_action_raw.pkt_reformat)) {
ret = PTR_ERR(maction->flow_action_raw.pkt_reformat);
return ret; return ret;
}
maction->flow_action_raw.sub_type = maction->flow_action_raw.sub_type =
MLX5_IB_FLOW_ACTION_PACKET_REFORMAT; MLX5_IB_FLOW_ACTION_PACKET_REFORMAT;
......
...@@ -2658,7 +2658,8 @@ int parse_flow_flow_action(struct mlx5_ib_flow_action *maction, ...@@ -2658,7 +2658,8 @@ int parse_flow_flow_action(struct mlx5_ib_flow_action *maction,
if (action->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) if (action->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
return -EINVAL; return -EINVAL;
action->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; action->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
action->modify_id = maction->flow_action_raw.action_id; action->modify_hdr =
maction->flow_action_raw.modify_hdr;
return 0; return 0;
} }
if (maction->flow_action_raw.sub_type == if (maction->flow_action_raw.sub_type ==
...@@ -2675,8 +2676,8 @@ int parse_flow_flow_action(struct mlx5_ib_flow_action *maction, ...@@ -2675,8 +2676,8 @@ int parse_flow_flow_action(struct mlx5_ib_flow_action *maction,
return -EINVAL; return -EINVAL;
action->action |= action->action |=
MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
action->reformat_id = action->pkt_reformat =
maction->flow_action_raw.action_id; maction->flow_action_raw.pkt_reformat;
return 0; return 0;
} }
/* fall through */ /* fall through */
......
...@@ -868,7 +868,10 @@ struct mlx5_ib_flow_action { ...@@ -868,7 +868,10 @@ struct mlx5_ib_flow_action {
struct { struct {
struct mlx5_ib_dev *dev; struct mlx5_ib_dev *dev;
u32 sub_type; u32 sub_type;
u32 action_id; union {
struct mlx5_modify_hdr *modify_hdr;
struct mlx5_pkt_reformat *pkt_reformat;
};
} flow_action_raw; } flow_action_raw;
}; };
}; };
......
...@@ -291,14 +291,14 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, ...@@ -291,14 +291,14 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
*/ */
goto out; goto out;
} }
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev,
err = mlx5_packet_reformat_alloc(priv->mdev, e->reformat_type,
e->reformat_type, ipv4_encap_size, encap_header,
ipv4_encap_size, encap_header, MLX5_FLOW_NAMESPACE_FDB);
MLX5_FLOW_NAMESPACE_FDB, if (IS_ERR(e->pkt_reformat)) {
&e->encap_id); err = PTR_ERR(e->pkt_reformat);
if (err)
goto destroy_neigh_entry; goto destroy_neigh_entry;
}
e->flags |= MLX5_ENCAP_ENTRY_VALID; e->flags |= MLX5_ENCAP_ENTRY_VALID;
mlx5e_rep_queue_neigh_stats_work(netdev_priv(out_dev)); mlx5e_rep_queue_neigh_stats_work(netdev_priv(out_dev));
...@@ -407,13 +407,14 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, ...@@ -407,13 +407,14 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
goto out; goto out;
} }
err = mlx5_packet_reformat_alloc(priv->mdev, e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev,
e->reformat_type, e->reformat_type,
ipv6_encap_size, encap_header, ipv6_encap_size, encap_header,
MLX5_FLOW_NAMESPACE_FDB, MLX5_FLOW_NAMESPACE_FDB);
&e->encap_id); if (IS_ERR(e->pkt_reformat)) {
if (err) err = PTR_ERR(e->pkt_reformat);
goto destroy_neigh_entry; goto destroy_neigh_entry;
}
e->flags |= MLX5_ENCAP_ENTRY_VALID; e->flags |= MLX5_ENCAP_ENTRY_VALID;
mlx5e_rep_queue_neigh_stats_work(netdev_priv(out_dev)); mlx5e_rep_queue_neigh_stats_work(netdev_priv(out_dev));
......
...@@ -161,7 +161,7 @@ struct mlx5e_encap_entry { ...@@ -161,7 +161,7 @@ struct mlx5e_encap_entry {
*/ */
struct hlist_node encap_hlist; struct hlist_node encap_hlist;
struct list_head flows; struct list_head flows;
u32 encap_id; struct mlx5_pkt_reformat *pkt_reformat;
const struct ip_tunnel_info *tun_info; const struct ip_tunnel_info *tun_info;
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
struct mlx5_nic_flow_attr { struct mlx5_nic_flow_attr {
u32 action; u32 action;
u32 flow_tag; u32 flow_tag;
u32 mod_hdr_id; struct mlx5_modify_hdr *modify_hdr;
u32 hairpin_tirn; u32 hairpin_tirn;
u8 match_level; u8 match_level;
struct mlx5_flow_table *hairpin_ft; struct mlx5_flow_table *hairpin_ft;
...@@ -201,7 +201,7 @@ struct mlx5e_mod_hdr_entry { ...@@ -201,7 +201,7 @@ struct mlx5e_mod_hdr_entry {
struct mod_hdr_key key; struct mod_hdr_key key;
u32 mod_hdr_id; struct mlx5_modify_hdr *modify_hdr;
refcount_t refcnt; refcount_t refcnt;
struct completion res_ready; struct completion res_ready;
...@@ -334,7 +334,7 @@ static void mlx5e_mod_hdr_put(struct mlx5e_priv *priv, ...@@ -334,7 +334,7 @@ static void mlx5e_mod_hdr_put(struct mlx5e_priv *priv,
WARN_ON(!list_empty(&mh->flows)); WARN_ON(!list_empty(&mh->flows));
if (mh->compl_result > 0) if (mh->compl_result > 0)
mlx5_modify_header_dealloc(priv->mdev, mh->mod_hdr_id); mlx5_modify_header_dealloc(priv->mdev, mh->modify_hdr);
kfree(mh); kfree(mh);
} }
...@@ -395,11 +395,11 @@ static int mlx5e_attach_mod_hdr(struct mlx5e_priv *priv, ...@@ -395,11 +395,11 @@ static int mlx5e_attach_mod_hdr(struct mlx5e_priv *priv,
hash_add(tbl->hlist, &mh->mod_hdr_hlist, hash_key); hash_add(tbl->hlist, &mh->mod_hdr_hlist, hash_key);
mutex_unlock(&tbl->lock); mutex_unlock(&tbl->lock);
err = mlx5_modify_header_alloc(priv->mdev, namespace, mh->modify_hdr = mlx5_modify_header_alloc(priv->mdev, namespace,
mh->key.num_actions, mh->key.num_actions,
mh->key.actions, mh->key.actions);
&mh->mod_hdr_id); if (IS_ERR(mh->modify_hdr)) {
if (err) { err = PTR_ERR(mh->modify_hdr);
mh->compl_result = err; mh->compl_result = err;
goto alloc_header_err; goto alloc_header_err;
} }
...@@ -412,9 +412,9 @@ static int mlx5e_attach_mod_hdr(struct mlx5e_priv *priv, ...@@ -412,9 +412,9 @@ static int mlx5e_attach_mod_hdr(struct mlx5e_priv *priv,
list_add(&flow->mod_hdr, &mh->flows); list_add(&flow->mod_hdr, &mh->flows);
spin_unlock(&mh->flows_lock); spin_unlock(&mh->flows_lock);
if (mlx5e_is_eswitch_flow(flow)) if (mlx5e_is_eswitch_flow(flow))
flow->esw_attr->mod_hdr_id = mh->mod_hdr_id; flow->esw_attr->modify_hdr = mh->modify_hdr;
else else
flow->nic_attr->mod_hdr_id = mh->mod_hdr_id; flow->nic_attr->modify_hdr = mh->modify_hdr;
return 0; return 0;
...@@ -906,7 +906,6 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv, ...@@ -906,7 +906,6 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
struct mlx5_flow_destination dest[2] = {}; struct mlx5_flow_destination dest[2] = {};
struct mlx5_flow_act flow_act = { struct mlx5_flow_act flow_act = {
.action = attr->action, .action = attr->action,
.reformat_id = 0,
.flags = FLOW_ACT_NO_APPEND, .flags = FLOW_ACT_NO_APPEND,
}; };
struct mlx5_fc *counter = NULL; struct mlx5_fc *counter = NULL;
...@@ -947,7 +946,7 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv, ...@@ -947,7 +946,7 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) { if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
err = mlx5e_attach_mod_hdr(priv, flow, parse_attr); err = mlx5e_attach_mod_hdr(priv, flow, parse_attr);
flow_act.modify_id = attr->mod_hdr_id; flow_act.modify_hdr = attr->modify_hdr;
kfree(parse_attr->mod_hdr_actions); kfree(parse_attr->mod_hdr_actions);
if (err) if (err)
return err; return err;
...@@ -1304,14 +1303,13 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, ...@@ -1304,14 +1303,13 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow; struct mlx5e_tc_flow *flow;
int err; int err;
err = mlx5_packet_reformat_alloc(priv->mdev, e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev,
e->reformat_type, e->reformat_type,
e->encap_size, e->encap_header, e->encap_size, e->encap_header,
MLX5_FLOW_NAMESPACE_FDB, MLX5_FLOW_NAMESPACE_FDB);
&e->encap_id); if (IS_ERR(e->pkt_reformat)) {
if (err) { mlx5_core_warn(priv->mdev, "Failed to offload cached encapsulation header, %lu\n",
mlx5_core_warn(priv->mdev, "Failed to offload cached encapsulation header, %d\n", PTR_ERR(e->pkt_reformat));
err);
return; return;
} }
e->flags |= MLX5_ENCAP_ENTRY_VALID; e->flags |= MLX5_ENCAP_ENTRY_VALID;
...@@ -1326,7 +1324,7 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, ...@@ -1326,7 +1324,7 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
esw_attr = flow->esw_attr; esw_attr = flow->esw_attr;
spec = &esw_attr->parse_attr->spec; spec = &esw_attr->parse_attr->spec;
esw_attr->dests[flow->tmp_efi_index].encap_id = e->encap_id; esw_attr->dests[flow->tmp_efi_index].pkt_reformat = e->pkt_reformat;
esw_attr->dests[flow->tmp_efi_index].flags |= MLX5_ESW_DEST_ENCAP_VALID; esw_attr->dests[flow->tmp_efi_index].flags |= MLX5_ESW_DEST_ENCAP_VALID;
/* Flow can be associated with multiple encap entries. /* Flow can be associated with multiple encap entries.
* Before offloading the flow verify that all of them have * Before offloading the flow verify that all of them have
...@@ -1395,7 +1393,7 @@ void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv, ...@@ -1395,7 +1393,7 @@ void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv,
/* we know that the encap is valid */ /* we know that the encap is valid */
e->flags &= ~MLX5_ENCAP_ENTRY_VALID; e->flags &= ~MLX5_ENCAP_ENTRY_VALID;
mlx5_packet_reformat_dealloc(priv->mdev, e->encap_id); mlx5_packet_reformat_dealloc(priv->mdev, e->pkt_reformat);
} }
static struct mlx5_fc *mlx5e_tc_get_counter(struct mlx5e_tc_flow *flow) static struct mlx5_fc *mlx5e_tc_get_counter(struct mlx5e_tc_flow *flow)
...@@ -1561,7 +1559,7 @@ static void mlx5e_encap_dealloc(struct mlx5e_priv *priv, struct mlx5e_encap_entr ...@@ -1561,7 +1559,7 @@ static void mlx5e_encap_dealloc(struct mlx5e_priv *priv, struct mlx5e_encap_entr
mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e); mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e);
if (e->flags & MLX5_ENCAP_ENTRY_VALID) if (e->flags & MLX5_ENCAP_ENTRY_VALID)
mlx5_packet_reformat_dealloc(priv->mdev, e->encap_id); mlx5_packet_reformat_dealloc(priv->mdev, e->pkt_reformat);
} }
kfree(e->encap_header); kfree(e->encap_header);
...@@ -3048,7 +3046,7 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, ...@@ -3048,7 +3046,7 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
flow->encaps[out_index].index = out_index; flow->encaps[out_index].index = out_index;
*encap_dev = e->out_dev; *encap_dev = e->out_dev;
if (e->flags & MLX5_ENCAP_ENTRY_VALID) { if (e->flags & MLX5_ENCAP_ENTRY_VALID) {
attr->dests[out_index].encap_id = e->encap_id; attr->dests[out_index].pkt_reformat = e->pkt_reformat;
attr->dests[out_index].flags |= MLX5_ESW_DEST_ENCAP_VALID; attr->dests[out_index].flags |= MLX5_ESW_DEST_ENCAP_VALID;
*encap_valid = true; *encap_valid = true;
} else { } else {
......
...@@ -69,7 +69,7 @@ struct vport_ingress { ...@@ -69,7 +69,7 @@ struct vport_ingress {
struct mlx5_flow_group *allow_spoofchk_only_grp; struct mlx5_flow_group *allow_spoofchk_only_grp;
struct mlx5_flow_group *allow_untagged_only_grp; struct mlx5_flow_group *allow_untagged_only_grp;
struct mlx5_flow_group *drop_grp; struct mlx5_flow_group *drop_grp;
int modify_metadata_id; struct mlx5_modify_hdr *modify_metadata;
struct mlx5_flow_handle *modify_metadata_rule; struct mlx5_flow_handle *modify_metadata_rule;
struct mlx5_flow_handle *allow_rule; struct mlx5_flow_handle *allow_rule;
struct mlx5_flow_handle *drop_rule; struct mlx5_flow_handle *drop_rule;
...@@ -385,11 +385,11 @@ struct mlx5_esw_flow_attr { ...@@ -385,11 +385,11 @@ struct mlx5_esw_flow_attr {
struct { struct {
u32 flags; u32 flags;
struct mlx5_eswitch_rep *rep; struct mlx5_eswitch_rep *rep;
struct mlx5_pkt_reformat *pkt_reformat;
struct mlx5_core_dev *mdev; struct mlx5_core_dev *mdev;
u32 encap_id;
struct mlx5_termtbl_handle *termtbl; struct mlx5_termtbl_handle *termtbl;
} dests[MLX5_MAX_FLOW_FWD_VPORTS]; } dests[MLX5_MAX_FLOW_FWD_VPORTS];
u32 mod_hdr_id; struct mlx5_modify_hdr *modify_hdr;
u8 inner_match_level; u8 inner_match_level;
u8 outer_match_level; u8 outer_match_level;
struct mlx5_fc *counter; struct mlx5_fc *counter;
......
...@@ -190,10 +190,10 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, ...@@ -190,10 +190,10 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
MLX5_FLOW_DEST_VPORT_VHCA_ID; MLX5_FLOW_DEST_VPORT_VHCA_ID;
if (attr->dests[j].flags & MLX5_ESW_DEST_ENCAP) { if (attr->dests[j].flags & MLX5_ESW_DEST_ENCAP) {
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
flow_act.reformat_id = attr->dests[j].encap_id; flow_act.pkt_reformat = attr->dests[j].pkt_reformat;
dest[i].vport.flags |= MLX5_FLOW_DEST_VPORT_REFORMAT_ID; dest[i].vport.flags |= MLX5_FLOW_DEST_VPORT_REFORMAT_ID;
dest[i].vport.reformat_id = dest[i].vport.pkt_reformat =
attr->dests[j].encap_id; attr->dests[j].pkt_reformat;
} }
i++; i++;
} }
...@@ -213,7 +213,7 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, ...@@ -213,7 +213,7 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
spec->match_criteria_enable |= MLX5_MATCH_INNER_HEADERS; spec->match_criteria_enable |= MLX5_MATCH_INNER_HEADERS;
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
flow_act.modify_id = attr->mod_hdr_id; flow_act.modify_hdr = attr->modify_hdr;
fdb = esw_get_prio_table(esw, attr->chain, attr->prio, !!split); fdb = esw_get_prio_table(esw, attr->chain, attr->prio, !!split);
if (IS_ERR(fdb)) { if (IS_ERR(fdb)) {
...@@ -276,7 +276,7 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw, ...@@ -276,7 +276,7 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
dest[i].vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID; dest[i].vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID;
if (attr->dests[i].flags & MLX5_ESW_DEST_ENCAP) { if (attr->dests[i].flags & MLX5_ESW_DEST_ENCAP) {
dest[i].vport.flags |= MLX5_FLOW_DEST_VPORT_REFORMAT_ID; dest[i].vport.flags |= MLX5_FLOW_DEST_VPORT_REFORMAT_ID;
dest[i].vport.reformat_id = attr->dests[i].encap_id; dest[i].vport.pkt_reformat = attr->dests[i].pkt_reformat;
} }
} }
dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
...@@ -1734,7 +1734,7 @@ static int esw_vport_ingress_prio_tag_config(struct mlx5_eswitch *esw, ...@@ -1734,7 +1734,7 @@ static int esw_vport_ingress_prio_tag_config(struct mlx5_eswitch *esw,
if (vport->ingress.modify_metadata_rule) { if (vport->ingress.modify_metadata_rule) {
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
flow_act.modify_id = vport->ingress.modify_metadata_id; flow_act.modify_hdr = vport->ingress.modify_metadata;
} }
vport->ingress.allow_rule = vport->ingress.allow_rule =
...@@ -1770,9 +1770,11 @@ static int esw_vport_add_ingress_acl_modify_metadata(struct mlx5_eswitch *esw, ...@@ -1770,9 +1770,11 @@ static int esw_vport_add_ingress_acl_modify_metadata(struct mlx5_eswitch *esw,
MLX5_SET(set_action_in, action, data, MLX5_SET(set_action_in, action, data,
mlx5_eswitch_get_vport_metadata_for_match(esw, vport->vport)); mlx5_eswitch_get_vport_metadata_for_match(esw, vport->vport));
err = mlx5_modify_header_alloc(esw->dev, MLX5_FLOW_NAMESPACE_ESW_INGRESS, vport->ingress.modify_metadata =
1, action, &vport->ingress.modify_metadata_id); mlx5_modify_header_alloc(esw->dev, MLX5_FLOW_NAMESPACE_ESW_INGRESS,
if (err) { 1, action);
if (IS_ERR(vport->ingress.modify_metadata)) {
err = PTR_ERR(vport->ingress.modify_metadata);
esw_warn(esw->dev, esw_warn(esw->dev,
"failed to alloc modify header for vport %d ingress acl (%d)\n", "failed to alloc modify header for vport %d ingress acl (%d)\n",
vport->vport, err); vport->vport, err);
...@@ -1780,7 +1782,7 @@ static int esw_vport_add_ingress_acl_modify_metadata(struct mlx5_eswitch *esw, ...@@ -1780,7 +1782,7 @@ static int esw_vport_add_ingress_acl_modify_metadata(struct mlx5_eswitch *esw,
} }
flow_act.action = MLX5_FLOW_CONTEXT_ACTION_MOD_HDR | MLX5_FLOW_CONTEXT_ACTION_ALLOW; flow_act.action = MLX5_FLOW_CONTEXT_ACTION_MOD_HDR | MLX5_FLOW_CONTEXT_ACTION_ALLOW;
flow_act.modify_id = vport->ingress.modify_metadata_id; flow_act.modify_hdr = vport->ingress.modify_metadata;
vport->ingress.modify_metadata_rule = mlx5_add_flow_rules(vport->ingress.acl, vport->ingress.modify_metadata_rule = mlx5_add_flow_rules(vport->ingress.acl,
&spec, &flow_act, NULL, 0); &spec, &flow_act, NULL, 0);
if (IS_ERR(vport->ingress.modify_metadata_rule)) { if (IS_ERR(vport->ingress.modify_metadata_rule)) {
...@@ -1794,7 +1796,7 @@ static int esw_vport_add_ingress_acl_modify_metadata(struct mlx5_eswitch *esw, ...@@ -1794,7 +1796,7 @@ static int esw_vport_add_ingress_acl_modify_metadata(struct mlx5_eswitch *esw,
out: out:
if (err) if (err)
mlx5_modify_header_dealloc(esw->dev, vport->ingress.modify_metadata_id); mlx5_modify_header_dealloc(esw->dev, vport->ingress.modify_metadata);
return err; return err;
} }
...@@ -1803,7 +1805,7 @@ void esw_vport_del_ingress_acl_modify_metadata(struct mlx5_eswitch *esw, ...@@ -1803,7 +1805,7 @@ void esw_vport_del_ingress_acl_modify_metadata(struct mlx5_eswitch *esw,
{ {
if (vport->ingress.modify_metadata_rule) { if (vport->ingress.modify_metadata_rule) {
mlx5_del_flow_rules(vport->ingress.modify_metadata_rule); mlx5_del_flow_rules(vport->ingress.modify_metadata_rule);
mlx5_modify_header_dealloc(esw->dev, vport->ingress.modify_metadata_id); mlx5_modify_header_dealloc(esw->dev, vport->ingress.modify_metadata);
vport->ingress.modify_metadata_rule = NULL; vport->ingress.modify_metadata_rule = NULL;
} }
......
...@@ -107,6 +107,34 @@ static int mlx5_cmd_stub_delete_fte(struct mlx5_flow_root_namespace *ns, ...@@ -107,6 +107,34 @@ static int mlx5_cmd_stub_delete_fte(struct mlx5_flow_root_namespace *ns,
return 0; return 0;
} }
static int mlx5_cmd_stub_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,
int reformat_type,
size_t size,
void *reformat_data,
enum mlx5_flow_namespace_type namespace,
struct mlx5_pkt_reformat *pkt_reformat)
{
return 0;
}
static void mlx5_cmd_stub_packet_reformat_dealloc(struct mlx5_flow_root_namespace *ns,
struct mlx5_pkt_reformat *pkt_reformat)
{
}
static int mlx5_cmd_stub_modify_header_alloc(struct mlx5_flow_root_namespace *ns,
u8 namespace, u8 num_actions,
void *modify_actions,
struct mlx5_modify_hdr *modify_hdr)
{
return 0;
}
static void mlx5_cmd_stub_modify_header_dealloc(struct mlx5_flow_root_namespace *ns,
struct mlx5_modify_hdr *modify_hdr)
{
}
static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns, static int mlx5_cmd_update_root_ft(struct mlx5_flow_root_namespace *ns,
struct mlx5_flow_table *ft, u32 underlay_qpn, struct mlx5_flow_table *ft, u32 underlay_qpn,
bool disconnect) bool disconnect)
...@@ -412,11 +440,13 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, ...@@ -412,11 +440,13 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
} else { } else {
MLX5_SET(flow_context, in_flow_context, action, MLX5_SET(flow_context, in_flow_context, action,
fte->action.action); fte->action.action);
MLX5_SET(flow_context, in_flow_context, packet_reformat_id, if (fte->action.pkt_reformat)
fte->action.reformat_id); MLX5_SET(flow_context, in_flow_context, packet_reformat_id,
fte->action.pkt_reformat->id);
} }
MLX5_SET(flow_context, in_flow_context, modify_header_id, if (fte->action.modify_hdr)
fte->action.modify_id); MLX5_SET(flow_context, in_flow_context, modify_header_id,
fte->action.modify_hdr->id);
vlan = MLX5_ADDR_OF(flow_context, in_flow_context, push_vlan); vlan = MLX5_ADDR_OF(flow_context, in_flow_context, push_vlan);
...@@ -468,7 +498,7 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, ...@@ -468,7 +498,7 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
MLX5_FLOW_DEST_VPORT_REFORMAT_ID)); MLX5_FLOW_DEST_VPORT_REFORMAT_ID));
MLX5_SET(extended_dest_format, in_dests, MLX5_SET(extended_dest_format, in_dests,
packet_reformat_id, packet_reformat_id,
dst->dest_attr.vport.reformat_id); dst->dest_attr.vport.pkt_reformat->id);
} }
break; break;
default: default:
...@@ -643,14 +673,15 @@ int mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, u32 base_id, int bulk_len, ...@@ -643,14 +673,15 @@ int mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, u32 base_id, int bulk_len,
return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
} }
int mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev, static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,
int reformat_type, int reformat_type,
size_t size, size_t size,
void *reformat_data, void *reformat_data,
enum mlx5_flow_namespace_type namespace, enum mlx5_flow_namespace_type namespace,
u32 *packet_reformat_id) struct mlx5_pkt_reformat *pkt_reformat)
{ {
u32 out[MLX5_ST_SZ_DW(alloc_packet_reformat_context_out)]; u32 out[MLX5_ST_SZ_DW(alloc_packet_reformat_context_out)];
struct mlx5_core_dev *dev = ns->dev;
void *packet_reformat_context_in; void *packet_reformat_context_in;
int max_encap_size; int max_encap_size;
void *reformat; void *reformat;
...@@ -693,35 +724,36 @@ int mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev, ...@@ -693,35 +724,36 @@ int mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev,
memset(out, 0, sizeof(out)); memset(out, 0, sizeof(out));
err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
*packet_reformat_id = MLX5_GET(alloc_packet_reformat_context_out, pkt_reformat->id = MLX5_GET(alloc_packet_reformat_context_out,
out, packet_reformat_id); out, packet_reformat_id);
kfree(in); kfree(in);
return err; return err;
} }
EXPORT_SYMBOL(mlx5_packet_reformat_alloc);
void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev, static void mlx5_cmd_packet_reformat_dealloc(struct mlx5_flow_root_namespace *ns,
u32 packet_reformat_id) struct mlx5_pkt_reformat *pkt_reformat)
{ {
u32 in[MLX5_ST_SZ_DW(dealloc_packet_reformat_context_in)]; u32 in[MLX5_ST_SZ_DW(dealloc_packet_reformat_context_in)];
u32 out[MLX5_ST_SZ_DW(dealloc_packet_reformat_context_out)]; u32 out[MLX5_ST_SZ_DW(dealloc_packet_reformat_context_out)];
struct mlx5_core_dev *dev = ns->dev;
memset(in, 0, sizeof(in)); memset(in, 0, sizeof(in));
MLX5_SET(dealloc_packet_reformat_context_in, in, opcode, MLX5_SET(dealloc_packet_reformat_context_in, in, opcode,
MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT); MLX5_CMD_OP_DEALLOC_PACKET_REFORMAT_CONTEXT);
MLX5_SET(dealloc_packet_reformat_context_in, in, packet_reformat_id, MLX5_SET(dealloc_packet_reformat_context_in, in, packet_reformat_id,
packet_reformat_id); pkt_reformat->id);
mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
} }
EXPORT_SYMBOL(mlx5_packet_reformat_dealloc);
int mlx5_modify_header_alloc(struct mlx5_core_dev *dev, static int mlx5_cmd_modify_header_alloc(struct mlx5_flow_root_namespace *ns,
u8 namespace, u8 num_actions, u8 namespace, u8 num_actions,
void *modify_actions, u32 *modify_header_id) void *modify_actions,
struct mlx5_modify_hdr *modify_hdr)
{ {
u32 out[MLX5_ST_SZ_DW(alloc_modify_header_context_out)]; u32 out[MLX5_ST_SZ_DW(alloc_modify_header_context_out)];
int max_actions, actions_size, inlen, err; int max_actions, actions_size, inlen, err;
struct mlx5_core_dev *dev = ns->dev;
void *actions_in; void *actions_in;
u8 table_type; u8 table_type;
u32 *in; u32 *in;
...@@ -772,26 +804,26 @@ int mlx5_modify_header_alloc(struct mlx5_core_dev *dev, ...@@ -772,26 +804,26 @@ int mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
memset(out, 0, sizeof(out)); memset(out, 0, sizeof(out));
err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
*modify_header_id = MLX5_GET(alloc_modify_header_context_out, out, modify_header_id); modify_hdr->id = MLX5_GET(alloc_modify_header_context_out, out, modify_header_id);
kfree(in); kfree(in);
return err; return err;
} }
EXPORT_SYMBOL(mlx5_modify_header_alloc);
void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev, u32 modify_header_id) static void mlx5_cmd_modify_header_dealloc(struct mlx5_flow_root_namespace *ns,
struct mlx5_modify_hdr *modify_hdr)
{ {
u32 in[MLX5_ST_SZ_DW(dealloc_modify_header_context_in)]; u32 in[MLX5_ST_SZ_DW(dealloc_modify_header_context_in)];
u32 out[MLX5_ST_SZ_DW(dealloc_modify_header_context_out)]; u32 out[MLX5_ST_SZ_DW(dealloc_modify_header_context_out)];
struct mlx5_core_dev *dev = ns->dev;
memset(in, 0, sizeof(in)); memset(in, 0, sizeof(in));
MLX5_SET(dealloc_modify_header_context_in, in, opcode, MLX5_SET(dealloc_modify_header_context_in, in, opcode,
MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT); MLX5_CMD_OP_DEALLOC_MODIFY_HEADER_CONTEXT);
MLX5_SET(dealloc_modify_header_context_in, in, modify_header_id, MLX5_SET(dealloc_modify_header_context_in, in, modify_header_id,
modify_header_id); modify_hdr->id);
mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out));
} }
EXPORT_SYMBOL(mlx5_modify_header_dealloc);
static const struct mlx5_flow_cmds mlx5_flow_cmds = { static const struct mlx5_flow_cmds mlx5_flow_cmds = {
.create_flow_table = mlx5_cmd_create_flow_table, .create_flow_table = mlx5_cmd_create_flow_table,
...@@ -803,6 +835,10 @@ static const struct mlx5_flow_cmds mlx5_flow_cmds = { ...@@ -803,6 +835,10 @@ static const struct mlx5_flow_cmds mlx5_flow_cmds = {
.update_fte = mlx5_cmd_update_fte, .update_fte = mlx5_cmd_update_fte,
.delete_fte = mlx5_cmd_delete_fte, .delete_fte = mlx5_cmd_delete_fte,
.update_root_ft = mlx5_cmd_update_root_ft, .update_root_ft = mlx5_cmd_update_root_ft,
.packet_reformat_alloc = mlx5_cmd_packet_reformat_alloc,
.packet_reformat_dealloc = mlx5_cmd_packet_reformat_dealloc,
.modify_header_alloc = mlx5_cmd_modify_header_alloc,
.modify_header_dealloc = mlx5_cmd_modify_header_dealloc
}; };
static const struct mlx5_flow_cmds mlx5_flow_cmd_stubs = { static const struct mlx5_flow_cmds mlx5_flow_cmd_stubs = {
...@@ -815,6 +851,10 @@ static const struct mlx5_flow_cmds mlx5_flow_cmd_stubs = { ...@@ -815,6 +851,10 @@ static const struct mlx5_flow_cmds mlx5_flow_cmd_stubs = {
.update_fte = mlx5_cmd_stub_update_fte, .update_fte = mlx5_cmd_stub_update_fte,
.delete_fte = mlx5_cmd_stub_delete_fte, .delete_fte = mlx5_cmd_stub_delete_fte,
.update_root_ft = mlx5_cmd_stub_update_root_ft, .update_root_ft = mlx5_cmd_stub_update_root_ft,
.packet_reformat_alloc = mlx5_cmd_stub_packet_reformat_alloc,
.packet_reformat_dealloc = mlx5_cmd_stub_packet_reformat_dealloc,
.modify_header_alloc = mlx5_cmd_stub_modify_header_alloc,
.modify_header_dealloc = mlx5_cmd_stub_modify_header_dealloc
}; };
static const struct mlx5_flow_cmds *mlx5_fs_cmd_get_fw_cmds(void) static const struct mlx5_flow_cmds *mlx5_fs_cmd_get_fw_cmds(void)
......
...@@ -75,6 +75,24 @@ struct mlx5_flow_cmds { ...@@ -75,6 +75,24 @@ struct mlx5_flow_cmds {
struct mlx5_flow_table *ft, struct mlx5_flow_table *ft,
u32 underlay_qpn, u32 underlay_qpn,
bool disconnect); bool disconnect);
int (*packet_reformat_alloc)(struct mlx5_flow_root_namespace *ns,
int reformat_type,
size_t size,
void *reformat_data,
enum mlx5_flow_namespace_type namespace,
struct mlx5_pkt_reformat *pkt_reformat);
void (*packet_reformat_dealloc)(struct mlx5_flow_root_namespace *ns,
struct mlx5_pkt_reformat *pkt_reformat);
int (*modify_header_alloc)(struct mlx5_flow_root_namespace *ns,
u8 namespace, u8 num_actions,
void *modify_actions,
struct mlx5_modify_hdr *modify_hdr);
void (*modify_header_dealloc)(struct mlx5_flow_root_namespace *ns,
struct mlx5_modify_hdr *modify_hdr);
}; };
int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id); int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id);
......
...@@ -1415,7 +1415,8 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1, ...@@ -1415,7 +1415,8 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
((d1->vport.flags & MLX5_FLOW_DEST_VPORT_VHCA_ID) ? ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_VHCA_ID) ?
(d1->vport.vhca_id == d2->vport.vhca_id) : true) && (d1->vport.vhca_id == d2->vport.vhca_id) : true) &&
((d1->vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID) ? ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID) ?
(d1->vport.reformat_id == d2->vport.reformat_id) : true)) || (d1->vport.pkt_reformat->id ==
d2->vport.pkt_reformat->id) : true)) ||
(d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE && (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&
d1->ft == d2->ft) || d1->ft == d2->ft) ||
(d1->type == MLX5_FLOW_DESTINATION_TYPE_TIR && (d1->type == MLX5_FLOW_DESTINATION_TYPE_TIR &&
...@@ -2888,3 +2889,105 @@ int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn) ...@@ -2888,3 +2889,105 @@ int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn)
return err; return err;
} }
EXPORT_SYMBOL(mlx5_fs_remove_rx_underlay_qpn); EXPORT_SYMBOL(mlx5_fs_remove_rx_underlay_qpn);
static struct mlx5_flow_root_namespace
*get_root_namespace(struct mlx5_core_dev *dev, enum mlx5_flow_namespace_type ns_type)
{
struct mlx5_flow_namespace *ns;
if (ns_type == MLX5_FLOW_NAMESPACE_ESW_EGRESS ||
ns_type == MLX5_FLOW_NAMESPACE_ESW_INGRESS)
ns = mlx5_get_flow_vport_acl_namespace(dev, ns_type, 0);
else
ns = mlx5_get_flow_namespace(dev, ns_type);
if (!ns)
return NULL;
return find_root(&ns->node);
}
struct mlx5_modify_hdr *mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
u8 ns_type, u8 num_actions,
void *modify_actions)
{
struct mlx5_flow_root_namespace *root;
struct mlx5_modify_hdr *modify_hdr;
int err;
root = get_root_namespace(dev, ns_type);
if (!root)
return ERR_PTR(-EOPNOTSUPP);
modify_hdr = kzalloc(sizeof(*modify_hdr), GFP_KERNEL);
if (!modify_hdr)
return ERR_PTR(-ENOMEM);
modify_hdr->ns_type = ns_type;
err = root->cmds->modify_header_alloc(root, ns_type, num_actions,
modify_actions, modify_hdr);
if (err) {
kfree(modify_hdr);
return ERR_PTR(err);
}
return modify_hdr;
}
EXPORT_SYMBOL(mlx5_modify_header_alloc);
void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev,
struct mlx5_modify_hdr *modify_hdr)
{
struct mlx5_flow_root_namespace *root;
root = get_root_namespace(dev, modify_hdr->ns_type);
if (WARN_ON(!root))
return;
root->cmds->modify_header_dealloc(root, modify_hdr);
kfree(modify_hdr);
}
EXPORT_SYMBOL(mlx5_modify_header_dealloc);
struct mlx5_pkt_reformat *mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev,
int reformat_type,
size_t size,
void *reformat_data,
enum mlx5_flow_namespace_type ns_type)
{
struct mlx5_pkt_reformat *pkt_reformat;
struct mlx5_flow_root_namespace *root;
int err;
root = get_root_namespace(dev, ns_type);
if (!root)
return ERR_PTR(-EOPNOTSUPP);
pkt_reformat = kzalloc(sizeof(*pkt_reformat), GFP_KERNEL);
if (!pkt_reformat)
return ERR_PTR(-ENOMEM);
pkt_reformat->ns_type = ns_type;
pkt_reformat->reformat_type = reformat_type;
err = root->cmds->packet_reformat_alloc(root, reformat_type, size,
reformat_data, ns_type,
pkt_reformat);
if (err) {
kfree(pkt_reformat);
return ERR_PTR(err);
}
return pkt_reformat;
}
EXPORT_SYMBOL(mlx5_packet_reformat_alloc);
void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev,
struct mlx5_pkt_reformat *pkt_reformat)
{
struct mlx5_flow_root_namespace *root;
root = get_root_namespace(dev, pkt_reformat->ns_type);
if (WARN_ON(!root))
return;
root->cmds->packet_reformat_dealloc(root, pkt_reformat);
kfree(pkt_reformat);
}
EXPORT_SYMBOL(mlx5_packet_reformat_dealloc);
...@@ -38,6 +38,17 @@ ...@@ -38,6 +38,17 @@
#include <linux/rhashtable.h> #include <linux/rhashtable.h>
#include <linux/llist.h> #include <linux/llist.h>
struct mlx5_modify_hdr {
enum mlx5_flow_namespace_type ns_type;
u32 id;
};
struct mlx5_pkt_reformat {
enum mlx5_flow_namespace_type ns_type;
int reformat_type; /* from mlx5_ifc */
u32 id;
};
/* FS_TYPE_PRIO_CHAINS is a PRIO that will have namespaces only, /* FS_TYPE_PRIO_CHAINS is a PRIO that will have namespaces only,
* and those are in parallel to one another when going over them to connect * and those are in parallel to one another when going over them to connect
* a new flow table. Meaning the last flow table in a TYPE_PRIO prio in one * a new flow table. Meaning the last flow table in a TYPE_PRIO prio in one
......
...@@ -84,6 +84,8 @@ enum { ...@@ -84,6 +84,8 @@ enum {
FDB_SLOW_PATH, FDB_SLOW_PATH,
}; };
struct mlx5_pkt_reformat;
struct mlx5_modify_hdr;
struct mlx5_flow_table; struct mlx5_flow_table;
struct mlx5_flow_group; struct mlx5_flow_group;
struct mlx5_flow_namespace; struct mlx5_flow_namespace;
...@@ -121,7 +123,7 @@ struct mlx5_flow_destination { ...@@ -121,7 +123,7 @@ struct mlx5_flow_destination {
struct { struct {
u16 num; u16 num;
u16 vhca_id; u16 vhca_id;
u32 reformat_id; struct mlx5_pkt_reformat *pkt_reformat;
u8 flags; u8 flags;
} vport; } vport;
}; };
...@@ -195,8 +197,8 @@ enum { ...@@ -195,8 +197,8 @@ enum {
struct mlx5_flow_act { struct mlx5_flow_act {
u32 action; u32 action;
u32 reformat_id; struct mlx5_modify_hdr *modify_hdr;
u32 modify_id; struct mlx5_pkt_reformat *pkt_reformat;
uintptr_t esp_id; uintptr_t esp_id;
u32 flags; u32 flags;
struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH]; struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH];
...@@ -205,8 +207,6 @@ struct mlx5_flow_act { ...@@ -205,8 +207,6 @@ struct mlx5_flow_act {
#define MLX5_DECLARE_FLOW_ACT(name) \ #define MLX5_DECLARE_FLOW_ACT(name) \
struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\ struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\
.reformat_id = 0, \
.modify_id = 0, \
.flags = 0, } .flags = 0, }
/* Single destination per rule. /* Single destination per rule.
...@@ -236,19 +236,18 @@ u32 mlx5_fc_id(struct mlx5_fc *counter); ...@@ -236,19 +236,18 @@ u32 mlx5_fc_id(struct mlx5_fc *counter);
int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn); int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn); int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
int mlx5_modify_header_alloc(struct mlx5_core_dev *dev, struct mlx5_modify_hdr *mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
u8 namespace, u8 num_actions, u8 ns_type, u8 num_actions,
void *modify_actions, u32 *modify_header_id); void *modify_actions);
void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev, void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev,
u32 modify_header_id); struct mlx5_modify_hdr *modify_hdr);
int mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev, struct mlx5_pkt_reformat *mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev,
int reformat_type, int reformat_type,
size_t size, size_t size,
void *reformat_data, void *reformat_data,
enum mlx5_flow_namespace_type namespace, enum mlx5_flow_namespace_type ns_type);
u32 *packet_reformat_id);
void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev, void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev,
u32 packet_reformat_id); struct mlx5_pkt_reformat *reformat);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment