Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
authorDavid S. Miller <davem@davemloft.net>
Fri, 8 Feb 2019 23:00:17 +0000 (15:00 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Feb 2019 23:00:17 +0000 (15:00 -0800)
An ipvlan bug fix in 'net' conflicted with the abstraction away
of the IPV6 specific support in 'net-next'.

Similarly, a bug fix for mlx5 in 'net' conflicted with the flow
action conversion in 'net-next'.

Signed-off-by: David S. Miller <davem@davemloft.net>
54 files changed:
1  2 
MAINTAINERS
arch/riscv/Kconfig
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
drivers/net/ethernet/qlogic/qed/qed.h
drivers/net/ethernet/qlogic/qed/qed_spq.c
drivers/net/ethernet/qlogic/qede/qede.h
drivers/net/ethernet/qlogic/qede/qede_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ipvlan/ipvlan_l3s.c
drivers/net/phy/dp83640.c
drivers/net/phy/marvell.c
drivers/net/virtio_net.c
drivers/net/wan/dscc4.c
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
drivers/s390/net/qeth_core.h
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c
include/linux/filter.h
include/linux/netdevice.h
include/net/netfilter/nf_tables.h
kernel/bpf/btf.c
kernel/bpf/cgroup.c
kernel/bpf/hashtab.c
kernel/bpf/syscall.c
net/batman-adv/bat_v_elp.c
net/batman-adv/hard-interface.c
net/batman-adv/soft-interface.c
net/core/filter.c
net/core/skmsg.c
net/dsa/master.c
net/dsa/slave.c
net/ipv4/ip_gre.c
net/ipv6/ip6_gre.c
net/mac80211/tx.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_tables_api.c
net/netfilter/nft_dynset.c
net/netfilter/nft_immediate.c
net/netfilter/nft_objref.c
net/sched/cls_flower.c
net/sctp/socket.c
net/smc/af_smc.c
net/smc/smc_cdc.h
net/smc/smc_close.c
net/smc/smc_core.c
net/socket.c
tools/bpf/bpftool/map.c
tools/bpf/bpftool/prog.c
tools/testing/selftests/bpf/test_btf.c

diff --cc MAINTAINERS
Simple merge
Simple merge
index 85c5dd7fc2c7d0246b243bbe710f7814899ddd00,b5c1b039375ae28c82540fa519051853addde7a1..e9437757cad72318d70da25652016306fa3a66e0
@@@ -1308,12 -1310,15 +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");
@@@ -1454,17 -1466,19 +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:
@@@ -1880,11 -1937,12 +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)
  {
        __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];
@@@ -2027,53 -2085,52 +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;
  
@@@ -2128,17 -2185,22 +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 */
@@@ -2190,9 -2256,8 +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,
 -                                                   actions, extack);
 +              return modify_header_match_supported(&parse_attr->spec,
-                                                    flow_action,
++                                                   flow_action, actions,
 +                                                   extack);
  
        return true;
  }
Simple merge
index 9a2f24078a542864ef42142d24574ffcd9cf9f05,0000000000000000000000000000000000000000..d17480a911a33d461403c405c442c1930dee19e1
mode 100644,000000..100644
--- /dev/null
@@@ -1,227 -1,0 +1,227 @@@
-               dev->priv_flags |= IFF_L3MDEV_MASTER;
 +/* Copyright (c) 2014 Mahesh Bandewar <maheshb@google.com>
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + */
 +
 +#include "ipvlan.h"
 +
 +static unsigned int ipvlan_netid __read_mostly;
 +
 +struct ipvlan_netns {
 +      unsigned int ipvl_nf_hook_refcnt;
 +};
 +
 +static struct ipvl_addr *ipvlan_skb_to_addr(struct sk_buff *skb,
 +                                          struct net_device *dev)
 +{
 +      struct ipvl_addr *addr = NULL;
 +      struct ipvl_port *port;
 +      int addr_type;
 +      void *lyr3h;
 +
 +      if (!dev || !netif_is_ipvlan_port(dev))
 +              goto out;
 +
 +      port = ipvlan_port_get_rcu(dev);
 +      if (!port || port->mode != IPVLAN_MODE_L3S)
 +              goto out;
 +
 +      lyr3h = ipvlan_get_L3_hdr(port, skb, &addr_type);
 +      if (!lyr3h)
 +              goto out;
 +
 +      addr = ipvlan_addr_lookup(port, lyr3h, addr_type, true);
 +out:
 +      return addr;
 +}
 +
 +static struct sk_buff *ipvlan_l3_rcv(struct net_device *dev,
 +                                   struct sk_buff *skb, u16 proto)
 +{
 +      struct ipvl_addr *addr;
 +      struct net_device *sdev;
 +
 +      addr = ipvlan_skb_to_addr(skb, dev);
 +      if (!addr)
 +              goto out;
 +
 +      sdev = addr->master->dev;
 +      switch (proto) {
 +      case AF_INET:
 +      {
 +              struct iphdr *ip4h = ip_hdr(skb);
 +              int err;
 +
 +              err = ip_route_input_noref(skb, ip4h->daddr, ip4h->saddr,
 +                                         ip4h->tos, sdev);
 +              if (unlikely(err))
 +                      goto out;
 +              break;
 +      }
 +#if IS_ENABLED(CONFIG_IPV6)
 +      case AF_INET6:
 +      {
 +              struct dst_entry *dst;
 +              struct ipv6hdr *ip6h = ipv6_hdr(skb);
 +              int flags = RT6_LOOKUP_F_HAS_SADDR;
 +              struct flowi6 fl6 = {
 +                      .flowi6_iif   = sdev->ifindex,
 +                      .daddr        = ip6h->daddr,
 +                      .saddr        = ip6h->saddr,
 +                      .flowlabel    = ip6_flowinfo(ip6h),
 +                      .flowi6_mark  = skb->mark,
 +                      .flowi6_proto = ip6h->nexthdr,
 +              };
 +
 +              skb_dst_drop(skb);
 +              dst = ip6_route_input_lookup(dev_net(sdev), sdev, &fl6,
 +                                           skb, flags);
 +              skb_dst_set(skb, dst);
 +              break;
 +      }
 +#endif
 +      default:
 +              break;
 +      }
 +out:
 +      return skb;
 +}
 +
 +static const struct l3mdev_ops ipvl_l3mdev_ops = {
 +      .l3mdev_l3_rcv = ipvlan_l3_rcv,
 +};
 +
 +static unsigned int ipvlan_nf_input(void *priv, struct sk_buff *skb,
 +                                  const struct nf_hook_state *state)
 +{
 +      struct ipvl_addr *addr;
 +      unsigned int len;
 +
 +      addr = ipvlan_skb_to_addr(skb, skb->dev);
 +      if (!addr)
 +              goto out;
 +
 +      skb->dev = addr->master->dev;
 +      len = skb->len + ETH_HLEN;
 +      ipvlan_count_rx(addr->master, len, true, false);
 +out:
 +      return NF_ACCEPT;
 +}
 +
 +static const struct nf_hook_ops ipvl_nfops[] = {
 +      {
 +              .hook     = ipvlan_nf_input,
 +              .pf       = NFPROTO_IPV4,
 +              .hooknum  = NF_INET_LOCAL_IN,
 +              .priority = INT_MAX,
 +      },
 +#if IS_ENABLED(CONFIG_IPV6)
 +      {
 +              .hook     = ipvlan_nf_input,
 +              .pf       = NFPROTO_IPV6,
 +              .hooknum  = NF_INET_LOCAL_IN,
 +              .priority = INT_MAX,
 +      },
 +#endif
 +};
 +
 +static int ipvlan_register_nf_hook(struct net *net)
 +{
 +      struct ipvlan_netns *vnet = net_generic(net, ipvlan_netid);
 +      int err = 0;
 +
 +      if (!vnet->ipvl_nf_hook_refcnt) {
 +              err = nf_register_net_hooks(net, ipvl_nfops,
 +                                          ARRAY_SIZE(ipvl_nfops));
 +              if (!err)
 +                      vnet->ipvl_nf_hook_refcnt = 1;
 +      } else {
 +              vnet->ipvl_nf_hook_refcnt++;
 +      }
 +
 +      return err;
 +}
 +
 +static void ipvlan_unregister_nf_hook(struct net *net)
 +{
 +      struct ipvlan_netns *vnet = net_generic(net, ipvlan_netid);
 +
 +      if (WARN_ON(!vnet->ipvl_nf_hook_refcnt))
 +              return;
 +
 +      vnet->ipvl_nf_hook_refcnt--;
 +      if (!vnet->ipvl_nf_hook_refcnt)
 +              nf_unregister_net_hooks(net, ipvl_nfops,
 +                                      ARRAY_SIZE(ipvl_nfops));
 +}
 +
 +void ipvlan_migrate_l3s_hook(struct net *oldnet, struct net *newnet)
 +{
 +      struct ipvlan_netns *old_vnet;
 +
 +      ASSERT_RTNL();
 +
 +      old_vnet = net_generic(oldnet, ipvlan_netid);
 +      if (!old_vnet->ipvl_nf_hook_refcnt)
 +              return;
 +
 +      ipvlan_register_nf_hook(newnet);
 +      ipvlan_unregister_nf_hook(oldnet);
 +}
 +
 +static void ipvlan_ns_exit(struct net *net)
 +{
 +      struct ipvlan_netns *vnet = net_generic(net, ipvlan_netid);
 +
 +      if (WARN_ON_ONCE(vnet->ipvl_nf_hook_refcnt)) {
 +              vnet->ipvl_nf_hook_refcnt = 0;
 +              nf_unregister_net_hooks(net, ipvl_nfops,
 +                                      ARRAY_SIZE(ipvl_nfops));
 +      }
 +}
 +
 +static struct pernet_operations ipvlan_net_ops = {
 +      .id   = &ipvlan_netid,
 +      .size = sizeof(struct ipvlan_netns),
 +      .exit = ipvlan_ns_exit,
 +};
 +
 +int ipvlan_l3s_init(void)
 +{
 +      return register_pernet_subsys(&ipvlan_net_ops);
 +}
 +
 +void ipvlan_l3s_cleanup(void)
 +{
 +      unregister_pernet_subsys(&ipvlan_net_ops);
 +}
 +
 +int ipvlan_l3s_register(struct ipvl_port *port)
 +{
 +      struct net_device *dev = port->dev;
 +      int ret;
 +
 +      ASSERT_RTNL();
 +
 +      ret = ipvlan_register_nf_hook(read_pnet(&port->pnet));
 +      if (!ret) {
 +              dev->l3mdev_ops = &ipvl_l3mdev_ops;
-       dev->priv_flags &= ~IFF_L3MDEV_MASTER;
++              dev->priv_flags |= IFF_L3MDEV_RX_HANDLER;
 +      }
 +
 +      return ret;
 +}
 +
 +void ipvlan_l3s_unregister(struct ipvl_port *port)
 +{
 +      struct net_device *dev = port->dev;
 +
 +      ASSERT_RTNL();
 +
++      dev->priv_flags &= ~IFF_L3MDEV_RX_HANDLER;
 +      ipvlan_unregister_nf_hook(read_pnet(&port->pnet));
 +      dev->l3mdev_ops = NULL;
 +}
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index b14fb3462af73cf2118430cffe8998df5cbf46e4,b85ca809e509220b56492c34a9071c6c0d051f25..93a5975c21a42b2d346aee18e1e01aaec50b6d73
@@@ -222,17 -221,16 +222,19 @@@ static netdev_tx_t batadv_interface_tx(
  
        netif_trans_update(soft_iface);
        vid = batadv_get_vid(skb, 0);
+       skb_reset_mac_header(skb);
        ethhdr = eth_hdr(skb);
  
 -      switch (ntohs(ethhdr->h_proto)) {
 +      proto = ethhdr->h_proto;
 +
 +      switch (ntohs(proto)) {
        case ETH_P_8021Q:
                vhdr = vlan_eth_hdr(skb);
 +              proto = vhdr->h_vlan_encapsulated_proto;
  
                /* drop batman-in-batman packets to prevent loops */
 -              if (vhdr->h_vlan_encapsulated_proto != htons(ETH_P_BATMAN)) {
 +              if (proto != htons(ETH_P_BATMAN)) {
                        network_offset += VLAN_HLEN;
                        break;
                }
Simple merge
Simple merge
Simple merge
diff --cc net/dsa/slave.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc net/socket.c
Simple merge
Simple merge
Simple merge