Subject: linux-next: manual merge of the net-next tree with the net tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 8 Feb 2019 11:24:32 +1100

Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

between commit:

  218d05ce326f ("net/mlx5e: Don't overwrite pedit action when multiple pedit used")

from the net tree and commit:

  c500c86b0c75 ("net/mlx5e: support for two independent packet edit actions")

from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index b5c1b039375a,85c5dd7fc2c7..000000000000
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@@ -1310,15 -1308,12 +1309,12 @@@ static int parse_tunnel_attr(struct mlx
  				       outer_headers);
  	void *headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value,
  				       outer_headers);
- 
- 	struct flow_dissector_key_control *enc_control =
- 		skb_flow_dissector_target(f->dissector,
- 					  FLOW_DISSECTOR_KEY_ENC_CONTROL,
- 					  f->key);
- 	int err = 0;
+ 	struct flow_rule *rule = tc_cls_flower_offload_flow_rule(f);
+ 	struct flow_match_control enc_control;
+ 	int err;
  
  	err = mlx5e_tc_tun_parse(filter_dev, priv, spec, f,
 -				 headers_c, headers_v);
 +				 headers_c, headers_v, match_level);
  	if (err) {
  		NL_SET_ERR_MSG_MOD(extack,
  				   "failed to parse tunnel attributes");
@@@ -1466,19 -1454,17 +1455,17 @@@ static int __parse_cls_flower(struct ml
  		return -EOPNOTSUPP;
  	}
  
- 	if ((dissector_uses_key(f->dissector,
- 				FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS) ||
- 	     dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ENC_KEYID) ||
- 	     dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ENC_PORTS)) &&
- 	    dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
- 		struct flow_dissector_key_control *key =
- 			skb_flow_dissector_target(f->dissector,
- 						  FLOW_DISSECTOR_KEY_ENC_CONTROL,
- 						  f->key);
- 		switch (key->addr_type) {
+ 	if ((flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS) ||
+ 	     flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_KEYID) ||
+ 	     flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_PORTS)) &&
+ 	    flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
+ 		struct flow_match_control match;
+ 
+ 		flow_rule_match_enc_control(rule, &match);
+ 		switch (match.key->addr_type) {
  		case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
  		case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
 -			if (parse_tunnel_attr(priv, spec, f, filter_dev))
 +			if (parse_tunnel_attr(priv, spec, f, filter_dev, tunnel_match_level))
  				return -EOPNOTSUPP;
  			break;
  		default:
@@@ -1937,12 -1880,11 +1883,11 @@@ static struct mlx5_fields fields[] = 
  	OFFLOAD(UDP_DPORT, 2, udp.dest,   0),
  };
  
 -/* On input attr->num_mod_hdr_actions tells how many HW actions can be parsed at
 - * max from the SW pedit action. On success, it says how many HW actions were
 - * actually parsed.
 +/* On input attr->max_mod_hdr_actions tells how many HW actions can be parsed at
 + * max from the SW pedit action. On success, attr->num_mod_hdr_actions
 + * says how many HW actions were actually parsed.
   */
- static int offload_pedit_fields(struct pedit_headers *masks,
- 				struct pedit_headers *vals,
+ static int offload_pedit_fields(struct pedit_headers_action *hdrs,
  				struct mlx5e_tc_flow_parse_attr *parse_attr,
  				struct netlink_ext_ack *extack)
  {
@@@ -1957,17 -1899,15 +1902,17 @@@
  	__be16 mask_be16;
  	void *action;
  
- 	set_masks = &masks[TCA_PEDIT_KEY_EX_CMD_SET];
- 	add_masks = &masks[TCA_PEDIT_KEY_EX_CMD_ADD];
- 	set_vals = &vals[TCA_PEDIT_KEY_EX_CMD_SET];
- 	add_vals = &vals[TCA_PEDIT_KEY_EX_CMD_ADD];
+ 	set_masks = &hdrs[0].masks;
+ 	add_masks = &hdrs[1].masks;
+ 	set_vals = &hdrs[0].vals;
+ 	add_vals = &hdrs[1].vals;
  
  	action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto);
 -	action = parse_attr->mod_hdr_actions;
 -	max_actions = parse_attr->num_mod_hdr_actions;
 -	nactions = 0;
 +	action = parse_attr->mod_hdr_actions +
 +		 parse_attr->num_mod_hdr_actions * action_size;
 +
 +	max_actions = parse_attr->max_mod_hdr_actions;
 +	nactions = parse_attr->num_mod_hdr_actions;
  
  	for (i = 0; i < ARRAY_SIZE(fields); i++) {
  		f = &fields[i];
@@@ -2085,52 -2027,53 +2032,55 @@@ static int alloc_mod_hdr_actions(struc
  static const struct pedit_headers zero_masks = {};
  
  static int parse_tc_pedit_action(struct mlx5e_priv *priv,
- 				 const struct tc_action *a, int namespace,
+ 				 const struct flow_action_entry *act, int namespace,
  				 struct mlx5e_tc_flow_parse_attr *parse_attr,
+ 				 struct pedit_headers_action *hdrs,
  				 struct netlink_ext_ack *extack)
  {
- 	struct pedit_headers masks[__PEDIT_CMD_MAX], vals[__PEDIT_CMD_MAX], *cmd_masks;
- 	int nkeys, i, err = -EOPNOTSUPP;
+ 	u8 cmd = (act->id == FLOW_ACTION_MANGLE) ? 0 : 1;
+ 	int err = -EOPNOTSUPP;
  	u32 mask, val, offset;
- 	u8 cmd, htype;
+ 	u8 htype;
  
- 	nkeys = tcf_pedit_nkeys(a);
+ 	htype = act->mangle.htype;
+ 	err = -EOPNOTSUPP; /* can't be all optimistic */
  
- 	memset(masks, 0, sizeof(struct pedit_headers) * __PEDIT_CMD_MAX);
- 	memset(vals,  0, sizeof(struct pedit_headers) * __PEDIT_CMD_MAX);
+ 	if (htype == FLOW_ACT_MANGLE_UNSPEC) {
+ 		NL_SET_ERR_MSG_MOD(extack, "legacy pedit isn't offloaded");
+ 		goto out_err;
+ 	}
  
- 	for (i = 0; i < nkeys; i++) {
- 		htype = tcf_pedit_htype(a, i);
- 		cmd = tcf_pedit_cmd(a, i);
- 		err = -EOPNOTSUPP; /* can't be all optimistic */
+ 	mask = act->mangle.mask;
+ 	val = act->mangle.val;
+ 	offset = act->mangle.offset;
  
- 		if (htype == TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK) {
- 			NL_SET_ERR_MSG_MOD(extack,
- 					   "legacy pedit isn't offloaded");
- 			goto out_err;
- 		}
+ 	err = set_pedit_val(htype, ~mask, val, offset, &hdrs[cmd]);
+ 	if (err)
+ 		goto out_err;
  
- 		if (cmd != TCA_PEDIT_KEY_EX_CMD_SET && cmd != TCA_PEDIT_KEY_EX_CMD_ADD) {
- 			NL_SET_ERR_MSG_MOD(extack, "pedit cmd isn't offloaded");
- 			goto out_err;
- 		}
+ 	hdrs[cmd].pedits++;
  
- 		mask = tcf_pedit_mask(a, i);
- 		val = tcf_pedit_val(a, i);
- 		offset = tcf_pedit_offset(a, i);
+ 	return 0;
+ out_err:
+ 	return err;
+ }
  
- 		err = set_pedit_val(htype, ~mask, val, offset, &masks[cmd], &vals[cmd]);
- 		if (err)
- 			goto out_err;
- 	}
+ static int alloc_tc_pedit_action(struct mlx5e_priv *priv, int namespace,
+ 				 struct mlx5e_tc_flow_parse_attr *parse_attr,
+ 				 struct pedit_headers_action *hdrs,
+ 				 struct netlink_ext_ack *extack)
+ {
+ 	struct pedit_headers *cmd_masks;
+ 	int err;
+ 	u8 cmd;
  
 -	err = alloc_mod_hdr_actions(priv, hdrs, namespace, parse_attr);
 -	if (err)
 -		goto out_err;
 +	if (!parse_attr->mod_hdr_actions) {
- 		err = alloc_mod_hdr_actions(priv, a, namespace, parse_attr);
++		err = alloc_mod_hdr_actions(priv, hdrs, namespace, parse_attr);
 +		if (err)
 +			goto out_err;
 +	}
  
- 	err = offload_pedit_fields(masks, vals, parse_attr, extack);
+ 	err = offload_pedit_fields(hdrs, parse_attr, extack);
  	if (err < 0)
  		goto out_dealloc_parsed_actions;
  
@@@ -2185,22 -2128,17 +2135,22 @@@ static bool csum_offload_supported(stru
  }
  
  static bool modify_header_match_supported(struct mlx5_flow_spec *spec,
- 					  struct tcf_exts *exts,
+ 					  struct flow_action *flow_action,
 +					  u32 actions,
  					  struct netlink_ext_ack *extack)
  {
- 	const struct tc_action *a;
+ 	const struct flow_action_entry *act;
  	bool modify_ip_header;
  	u8 htype, ip_proto;
  	void *headers_v;
  	u16 ethertype;
- 	int nkeys, i;
+ 	int i;
  
 -	headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers);
 +	if (actions & MLX5_FLOW_CONTEXT_ACTION_DECAP)
 +		headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, inner_headers);
 +	else
 +		headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers);
 +
  	ethertype = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ethertype);
  
  	/* for non-IP we only re-write MACs, so we're okay */
@@@ -2256,8 -2190,9 +2202,9 @@@ static bool actions_match_supported(str
  		return false;
  
  	if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
- 		return modify_header_match_supported(&parse_attr->spec, exts,
+ 		return modify_header_match_supported(&parse_attr->spec,
+ 						     flow_action,
 -						     extack);
 +						     actions, extack);
  
  	return true;
  }