Commit 3f3f05ab authored by Yevgeny Kliteynik's avatar Yevgeny Kliteynik Committed by Saeed Mahameed

net/mlx5: Added new parameters to reformat context

Adding new reformat context type (INSERT_HEADER) requires adding two new
parameters to reformat context - reformat_param_0 and reformat_param_1.
As defined by HW spec, these parameters have different meaning for
different reformat context type.

The first parameter (reformat_param_0) is not new to HW spec, but it
wasn't used by any of the supported reformats. The second parameter
(reformat_param_1) is new to the HW spec - it was added to allow
supporting INSERT_HEADER.

For NSERT_HEADER, reformat_param_0 indicates the header used to
reference the location of the inserted header, and reformat_param_1
indicates the offset of the inserted header from the reference point
defined by reformat_param_0.
Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent d7418b4e
...@@ -2280,6 +2280,7 @@ static int mlx5_ib_flow_action_create_packet_reformat_ctx( ...@@ -2280,6 +2280,7 @@ static int mlx5_ib_flow_action_create_packet_reformat_ctx(
u8 ft_type, u8 dv_prt, u8 ft_type, u8 dv_prt,
void *in, size_t len) void *in, size_t len)
{ {
struct mlx5_pkt_reformat_params reformat_params;
enum mlx5_flow_namespace_type namespace; enum mlx5_flow_namespace_type namespace;
u8 prm_prt; u8 prm_prt;
int ret; int ret;
...@@ -2292,9 +2293,13 @@ static int mlx5_ib_flow_action_create_packet_reformat_ctx( ...@@ -2292,9 +2293,13 @@ static int mlx5_ib_flow_action_create_packet_reformat_ctx(
if (ret) if (ret)
return ret; return ret;
memset(&reformat_params, 0, sizeof(reformat_params));
reformat_params.type = prm_prt;
reformat_params.size = len;
reformat_params.data = in;
maction->flow_action_raw.pkt_reformat = maction->flow_action_raw.pkt_reformat =
mlx5_packet_reformat_alloc(dev->mdev, prm_prt, len, mlx5_packet_reformat_alloc(dev->mdev, &reformat_params,
in, namespace); namespace);
if (IS_ERR(maction->flow_action_raw.pkt_reformat)) { if (IS_ERR(maction->flow_action_raw.pkt_reformat)) {
ret = PTR_ERR(maction->flow_action_raw.pkt_reformat); ret = PTR_ERR(maction->flow_action_raw.pkt_reformat);
return ret; return ret;
......
...@@ -212,6 +212,7 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, ...@@ -212,6 +212,7 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
{ {
int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size); int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size);
const struct ip_tunnel_key *tun_key = &e->tun_info->key; const struct ip_tunnel_key *tun_key = &e->tun_info->key;
struct mlx5_pkt_reformat_params reformat_params;
struct mlx5e_neigh m_neigh = {}; struct mlx5e_neigh m_neigh = {};
TC_TUN_ROUTE_ATTR_INIT(attr); TC_TUN_ROUTE_ATTR_INIT(attr);
int ipv4_encap_size; int ipv4_encap_size;
...@@ -295,9 +296,12 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, ...@@ -295,9 +296,12 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
*/ */
goto release_neigh; goto release_neigh;
} }
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev,
e->reformat_type, memset(&reformat_params, 0, sizeof(reformat_params));
ipv4_encap_size, encap_header, reformat_params.type = e->reformat_type;
reformat_params.size = ipv4_encap_size;
reformat_params.data = encap_header;
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params,
MLX5_FLOW_NAMESPACE_FDB); MLX5_FLOW_NAMESPACE_FDB);
if (IS_ERR(e->pkt_reformat)) { if (IS_ERR(e->pkt_reformat)) {
err = PTR_ERR(e->pkt_reformat); err = PTR_ERR(e->pkt_reformat);
...@@ -324,6 +328,7 @@ int mlx5e_tc_tun_update_header_ipv4(struct mlx5e_priv *priv, ...@@ -324,6 +328,7 @@ int mlx5e_tc_tun_update_header_ipv4(struct mlx5e_priv *priv,
{ {
int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size); int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size);
const struct ip_tunnel_key *tun_key = &e->tun_info->key; const struct ip_tunnel_key *tun_key = &e->tun_info->key;
struct mlx5_pkt_reformat_params reformat_params;
TC_TUN_ROUTE_ATTR_INIT(attr); TC_TUN_ROUTE_ATTR_INIT(attr);
int ipv4_encap_size; int ipv4_encap_size;
char *encap_header; char *encap_header;
...@@ -396,9 +401,12 @@ int mlx5e_tc_tun_update_header_ipv4(struct mlx5e_priv *priv, ...@@ -396,9 +401,12 @@ int mlx5e_tc_tun_update_header_ipv4(struct mlx5e_priv *priv,
*/ */
goto release_neigh; goto release_neigh;
} }
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev,
e->reformat_type, memset(&reformat_params, 0, sizeof(reformat_params));
ipv4_encap_size, encap_header, reformat_params.type = e->reformat_type;
reformat_params.size = ipv4_encap_size;
reformat_params.data = encap_header;
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params,
MLX5_FLOW_NAMESPACE_FDB); MLX5_FLOW_NAMESPACE_FDB);
if (IS_ERR(e->pkt_reformat)) { if (IS_ERR(e->pkt_reformat)) {
err = PTR_ERR(e->pkt_reformat); err = PTR_ERR(e->pkt_reformat);
...@@ -471,6 +479,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, ...@@ -471,6 +479,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
{ {
int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size); int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size);
const struct ip_tunnel_key *tun_key = &e->tun_info->key; const struct ip_tunnel_key *tun_key = &e->tun_info->key;
struct mlx5_pkt_reformat_params reformat_params;
struct mlx5e_neigh m_neigh = {}; struct mlx5e_neigh m_neigh = {};
TC_TUN_ROUTE_ATTR_INIT(attr); TC_TUN_ROUTE_ATTR_INIT(attr);
struct ipv6hdr *ip6h; struct ipv6hdr *ip6h;
...@@ -553,9 +562,11 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, ...@@ -553,9 +562,11 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
goto release_neigh; goto release_neigh;
} }
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, memset(&reformat_params, 0, sizeof(reformat_params));
e->reformat_type, reformat_params.type = e->reformat_type;
ipv6_encap_size, encap_header, reformat_params.size = ipv6_encap_size;
reformat_params.data = encap_header;
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params,
MLX5_FLOW_NAMESPACE_FDB); MLX5_FLOW_NAMESPACE_FDB);
if (IS_ERR(e->pkt_reformat)) { if (IS_ERR(e->pkt_reformat)) {
err = PTR_ERR(e->pkt_reformat); err = PTR_ERR(e->pkt_reformat);
...@@ -582,6 +593,7 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv, ...@@ -582,6 +593,7 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv,
{ {
int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size); int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size);
const struct ip_tunnel_key *tun_key = &e->tun_info->key; const struct ip_tunnel_key *tun_key = &e->tun_info->key;
struct mlx5_pkt_reformat_params reformat_params;
TC_TUN_ROUTE_ATTR_INIT(attr); TC_TUN_ROUTE_ATTR_INIT(attr);
struct ipv6hdr *ip6h; struct ipv6hdr *ip6h;
int ipv6_encap_size; int ipv6_encap_size;
...@@ -654,9 +666,11 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv, ...@@ -654,9 +666,11 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv,
goto release_neigh; goto release_neigh;
} }
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, memset(&reformat_params, 0, sizeof(reformat_params));
e->reformat_type, reformat_params.type = e->reformat_type;
ipv6_encap_size, encap_header, reformat_params.size = ipv6_encap_size;
reformat_params.data = encap_header;
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, &reformat_params,
MLX5_FLOW_NAMESPACE_FDB); MLX5_FLOW_NAMESPACE_FDB);
if (IS_ERR(e->pkt_reformat)) { if (IS_ERR(e->pkt_reformat)) {
err = PTR_ERR(e->pkt_reformat); err = PTR_ERR(e->pkt_reformat);
......
...@@ -120,6 +120,7 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, ...@@ -120,6 +120,7 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
struct list_head *flow_list) struct list_head *flow_list)
{ {
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
struct mlx5_pkt_reformat_params reformat_params;
struct mlx5_esw_flow_attr *esw_attr; struct mlx5_esw_flow_attr *esw_attr;
struct mlx5_flow_handle *rule; struct mlx5_flow_handle *rule;
struct mlx5_flow_attr *attr; struct mlx5_flow_attr *attr;
...@@ -130,9 +131,12 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, ...@@ -130,9 +131,12 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
if (e->flags & MLX5_ENCAP_ENTRY_NO_ROUTE) if (e->flags & MLX5_ENCAP_ENTRY_NO_ROUTE)
return; return;
memset(&reformat_params, 0, sizeof(reformat_params));
reformat_params.type = e->reformat_type;
reformat_params.size = e->encap_size;
reformat_params.data = e->encap_header;
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev,
e->reformat_type, &reformat_params,
e->encap_size, e->encap_header,
MLX5_FLOW_NAMESPACE_FDB); MLX5_FLOW_NAMESPACE_FDB);
if (IS_ERR(e->pkt_reformat)) { if (IS_ERR(e->pkt_reformat)) {
mlx5_core_warn(priv->mdev, "Failed to offload cached encapsulation header, %lu\n", mlx5_core_warn(priv->mdev, "Failed to offload cached encapsulation header, %lu\n",
...@@ -812,6 +816,7 @@ int mlx5e_attach_decap(struct mlx5e_priv *priv, ...@@ -812,6 +816,7 @@ int mlx5e_attach_decap(struct mlx5e_priv *priv,
{ {
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
struct mlx5_esw_flow_attr *attr = flow->attr->esw_attr; struct mlx5_esw_flow_attr *attr = flow->attr->esw_attr;
struct mlx5_pkt_reformat_params reformat_params;
struct mlx5e_tc_flow_parse_attr *parse_attr; struct mlx5e_tc_flow_parse_attr *parse_attr;
struct mlx5e_decap_entry *d; struct mlx5e_decap_entry *d;
struct mlx5e_decap_key key; struct mlx5e_decap_key key;
...@@ -853,10 +858,12 @@ int mlx5e_attach_decap(struct mlx5e_priv *priv, ...@@ -853,10 +858,12 @@ int mlx5e_attach_decap(struct mlx5e_priv *priv,
hash_add_rcu(esw->offloads.decap_tbl, &d->hlist, hash_key); hash_add_rcu(esw->offloads.decap_tbl, &d->hlist, hash_key);
mutex_unlock(&esw->offloads.decap_tbl_lock); mutex_unlock(&esw->offloads.decap_tbl_lock);
memset(&reformat_params, 0, sizeof(reformat_params));
reformat_params.type = MLX5_REFORMAT_TYPE_L3_TUNNEL_TO_L2;
reformat_params.size = sizeof(parse_attr->eth);
reformat_params.data = &parse_attr->eth;
d->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev, d->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev,
MLX5_REFORMAT_TYPE_L3_TUNNEL_TO_L2, &reformat_params,
sizeof(parse_attr->eth),
&parse_attr->eth,
MLX5_FLOW_NAMESPACE_FDB); MLX5_FLOW_NAMESPACE_FDB);
if (IS_ERR(d->pkt_reformat)) { if (IS_ERR(d->pkt_reformat)) {
err = PTR_ERR(d->pkt_reformat); err = PTR_ERR(d->pkt_reformat);
......
...@@ -111,9 +111,7 @@ static int mlx5_cmd_stub_delete_fte(struct mlx5_flow_root_namespace *ns, ...@@ -111,9 +111,7 @@ static int mlx5_cmd_stub_delete_fte(struct mlx5_flow_root_namespace *ns,
} }
static int mlx5_cmd_stub_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns, static int mlx5_cmd_stub_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,
int reformat_type, struct mlx5_pkt_reformat_params *params,
size_t size,
void *reformat_data,
enum mlx5_flow_namespace_type namespace, enum mlx5_flow_namespace_type namespace,
struct mlx5_pkt_reformat *pkt_reformat) struct mlx5_pkt_reformat *pkt_reformat)
{ {
...@@ -701,9 +699,7 @@ int mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, u32 base_id, int bulk_len, ...@@ -701,9 +699,7 @@ int mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, u32 base_id, int bulk_len,
} }
static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns, static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,
int reformat_type, struct mlx5_pkt_reformat_params *params,
size_t size,
void *reformat_data,
enum mlx5_flow_namespace_type namespace, enum mlx5_flow_namespace_type namespace,
struct mlx5_pkt_reformat *pkt_reformat) struct mlx5_pkt_reformat *pkt_reformat)
{ {
...@@ -721,14 +717,14 @@ static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns, ...@@ -721,14 +717,14 @@ static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,
else else
max_encap_size = MLX5_CAP_FLOWTABLE(dev, max_encap_header_size); max_encap_size = MLX5_CAP_FLOWTABLE(dev, max_encap_header_size);
if (size > max_encap_size) { if (params->size > max_encap_size) {
mlx5_core_warn(dev, "encap size %zd too big, max supported is %d\n", mlx5_core_warn(dev, "encap size %zd too big, max supported is %d\n",
size, max_encap_size); params->size, max_encap_size);
return -EINVAL; return -EINVAL;
} }
in = kzalloc(MLX5_ST_SZ_BYTES(alloc_packet_reformat_context_in) + size, in = kzalloc(MLX5_ST_SZ_BYTES(alloc_packet_reformat_context_in) +
GFP_KERNEL); params->size, GFP_KERNEL);
if (!in) if (!in)
return -ENOMEM; return -ENOMEM;
...@@ -737,15 +733,20 @@ static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns, ...@@ -737,15 +733,20 @@ static int mlx5_cmd_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,
reformat = MLX5_ADDR_OF(packet_reformat_context_in, reformat = MLX5_ADDR_OF(packet_reformat_context_in,
packet_reformat_context_in, packet_reformat_context_in,
reformat_data); reformat_data);
inlen = reformat - (void *)in + size; inlen = reformat - (void *)in + params->size;
MLX5_SET(alloc_packet_reformat_context_in, in, opcode, MLX5_SET(alloc_packet_reformat_context_in, in, opcode,
MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT); MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT);
MLX5_SET(packet_reformat_context_in, packet_reformat_context_in, MLX5_SET(packet_reformat_context_in, packet_reformat_context_in,
reformat_data_size, size); reformat_data_size, params->size);
MLX5_SET(packet_reformat_context_in, packet_reformat_context_in, MLX5_SET(packet_reformat_context_in, packet_reformat_context_in,
reformat_type, reformat_type); reformat_type, params->type);
memcpy(reformat, reformat_data, size); MLX5_SET(packet_reformat_context_in, packet_reformat_context_in,
reformat_param_0, params->param_0);
MLX5_SET(packet_reformat_context_in, packet_reformat_context_in,
reformat_param_1, params->param_1);
if (params->data && params->size)
memcpy(reformat, params->data, params->size);
err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
......
...@@ -77,9 +77,7 @@ struct mlx5_flow_cmds { ...@@ -77,9 +77,7 @@ struct mlx5_flow_cmds {
bool disconnect); bool disconnect);
int (*packet_reformat_alloc)(struct mlx5_flow_root_namespace *ns, int (*packet_reformat_alloc)(struct mlx5_flow_root_namespace *ns,
int reformat_type, struct mlx5_pkt_reformat_params *params,
size_t size,
void *reformat_data,
enum mlx5_flow_namespace_type namespace, enum mlx5_flow_namespace_type namespace,
struct mlx5_pkt_reformat *pkt_reformat); struct mlx5_pkt_reformat *pkt_reformat);
......
...@@ -3165,9 +3165,7 @@ void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev, ...@@ -3165,9 +3165,7 @@ void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev,
EXPORT_SYMBOL(mlx5_modify_header_dealloc); EXPORT_SYMBOL(mlx5_modify_header_dealloc);
struct mlx5_pkt_reformat *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, struct mlx5_pkt_reformat_params *params,
size_t size,
void *reformat_data,
enum mlx5_flow_namespace_type ns_type) enum mlx5_flow_namespace_type ns_type)
{ {
struct mlx5_pkt_reformat *pkt_reformat; struct mlx5_pkt_reformat *pkt_reformat;
...@@ -3183,9 +3181,8 @@ struct mlx5_pkt_reformat *mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev, ...@@ -3183,9 +3181,8 @@ struct mlx5_pkt_reformat *mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
pkt_reformat->ns_type = ns_type; pkt_reformat->ns_type = ns_type;
pkt_reformat->reformat_type = reformat_type; pkt_reformat->reformat_type = params->type;
err = root->cmds->packet_reformat_alloc(root, reformat_type, size, err = root->cmds->packet_reformat_alloc(root, params, ns_type,
reformat_data, ns_type,
pkt_reformat); pkt_reformat);
if (err) { if (err) {
kfree(pkt_reformat); kfree(pkt_reformat);
......
...@@ -937,6 +937,8 @@ struct mlx5dr_action *mlx5dr_action_create_push_vlan(struct mlx5dr_domain *dmn, ...@@ -937,6 +937,8 @@ struct mlx5dr_action *mlx5dr_action_create_push_vlan(struct mlx5dr_domain *dmn,
struct mlx5dr_action * struct mlx5dr_action *
mlx5dr_action_create_packet_reformat(struct mlx5dr_domain *dmn, mlx5dr_action_create_packet_reformat(struct mlx5dr_domain *dmn,
enum mlx5dr_action_reformat_type reformat_type, enum mlx5dr_action_reformat_type reformat_type,
u8 reformat_param_0,
u8 reformat_param_1,
size_t data_sz, size_t data_sz,
void *data) void *data)
{ {
......
...@@ -289,7 +289,8 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, ...@@ -289,7 +289,8 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
DR_ACTION_REFORMAT_TYP_TNL_L2_TO_L2; DR_ACTION_REFORMAT_TYP_TNL_L2_TO_L2;
tmp_action = mlx5dr_action_create_packet_reformat(domain, tmp_action = mlx5dr_action_create_packet_reformat(domain,
decap_type, 0, decap_type,
0, 0, 0,
NULL); NULL);
if (!tmp_action) { if (!tmp_action) {
err = -ENOMEM; err = -ENOMEM;
...@@ -522,9 +523,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, ...@@ -522,9 +523,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
} }
static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns, static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,
int reformat_type, struct mlx5_pkt_reformat_params *params,
size_t size,
void *reformat_data,
enum mlx5_flow_namespace_type namespace, enum mlx5_flow_namespace_type namespace,
struct mlx5_pkt_reformat *pkt_reformat) struct mlx5_pkt_reformat *pkt_reformat)
{ {
...@@ -532,7 +531,7 @@ static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns ...@@ -532,7 +531,7 @@ static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns
struct mlx5dr_action *action; struct mlx5dr_action *action;
int dr_reformat; int dr_reformat;
switch (reformat_type) { switch (params->type) {
case MLX5_REFORMAT_TYPE_L2_TO_VXLAN: case MLX5_REFORMAT_TYPE_L2_TO_VXLAN:
case MLX5_REFORMAT_TYPE_L2_TO_NVGRE: case MLX5_REFORMAT_TYPE_L2_TO_NVGRE:
case MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL: case MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL:
...@@ -546,14 +545,16 @@ static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns ...@@ -546,14 +545,16 @@ static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns
break; break;
default: default:
mlx5_core_err(ns->dev, "Packet-reformat not supported(%d)\n", mlx5_core_err(ns->dev, "Packet-reformat not supported(%d)\n",
reformat_type); params->type);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
action = mlx5dr_action_create_packet_reformat(dr_domain, action = mlx5dr_action_create_packet_reformat(dr_domain,
dr_reformat, dr_reformat,
size, params->param_0,
reformat_data); params->param_1,
params->size,
params->data);
if (!action) { if (!action) {
mlx5_core_err(ns->dev, "Failed allocating packet-reformat action\n"); mlx5_core_err(ns->dev, "Failed allocating packet-reformat action\n");
return -EINVAL; return -EINVAL;
......
...@@ -105,6 +105,8 @@ mlx5dr_action_create_flow_counter(u32 counter_id); ...@@ -105,6 +105,8 @@ mlx5dr_action_create_flow_counter(u32 counter_id);
struct mlx5dr_action * struct mlx5dr_action *
mlx5dr_action_create_packet_reformat(struct mlx5dr_domain *dmn, mlx5dr_action_create_packet_reformat(struct mlx5dr_domain *dmn,
enum mlx5dr_action_reformat_type reformat_type, enum mlx5dr_action_reformat_type reformat_type,
u8 reformat_param_0,
u8 reformat_param_1,
size_t data_sz, size_t data_sz,
void *data); void *data);
......
...@@ -254,10 +254,16 @@ struct mlx5_modify_hdr *mlx5_modify_header_alloc(struct mlx5_core_dev *dev, ...@@ -254,10 +254,16 @@ struct mlx5_modify_hdr *mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev, void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev,
struct mlx5_modify_hdr *modify_hdr); struct mlx5_modify_hdr *modify_hdr);
struct mlx5_pkt_reformat_params {
int type;
u8 param_0;
u8 param_1;
size_t size;
void *data;
};
struct mlx5_pkt_reformat *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, struct mlx5_pkt_reformat_params *params,
size_t size,
void *reformat_data,
enum mlx5_flow_namespace_type ns_type); enum mlx5_flow_namespace_type ns_type);
void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev, void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev,
struct mlx5_pkt_reformat *reformat); struct mlx5_pkt_reformat *reformat);
......
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