]> Git Repo - J-linux.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
authorJakub Kicinski <[email protected]>
Thu, 27 Jan 2022 20:54:16 +0000 (12:54 -0800)
committerJakub Kicinski <[email protected]>
Thu, 27 Jan 2022 20:54:16 +0000 (12:54 -0800)
No conflicts.

Signed-off-by: Jakub Kicinski <[email protected]>
1  2 
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
include/linux/skbuff.h
net/ipv4/tcp_ipv4.c

index e4381e13dae5e556e56f491087f2ae1819b422b5,639a753266e67ff2ed80b322ae96f56e8345c737..eb7e41d415298b42971a754339e4ee50fa51be0d
@@@ -402,7 -402,7 +402,7 @@@ static void stmmac_lpi_entry_timer_conf
   * Description: this function is to verify and enter in LPI mode in case of
   * EEE.
   */
- static void stmmac_enable_eee_mode(struct stmmac_priv *priv)
+ static int stmmac_enable_eee_mode(struct stmmac_priv *priv)
  {
        u32 tx_cnt = priv->plat->tx_queues_to_use;
        u32 queue;
                struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
  
                if (tx_q->dirty_tx != tx_q->cur_tx)
-                       return; /* still unfinished work */
+                       return -EBUSY; /* still unfinished work */
        }
  
        /* Check and enter in LPI mode */
        if (!priv->tx_path_in_lpi_mode)
                stmmac_set_eee_mode(priv, priv->hw,
                                priv->plat->en_tx_lpi_clockgating);
+       return 0;
  }
  
  /**
@@@ -450,8 -451,8 +451,8 @@@ static void stmmac_eee_ctrl_timer(struc
  {
        struct stmmac_priv *priv = from_timer(priv, t, eee_ctrl_timer);
  
-       stmmac_enable_eee_mode(priv);
-       mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer));
+       if (stmmac_enable_eee_mode(priv))
+               mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer));
  }
  
  /**
@@@ -889,6 -890,9 +890,9 @@@ static int stmmac_init_ptp(struct stmma
        bool xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac;
        int ret;
  
+       if (priv->plat->ptp_clk_freq_config)
+               priv->plat->ptp_clk_freq_config(priv);
        ret = stmmac_init_tstamp_counter(priv, STMMAC_HWTS_ACTIVE);
        if (ret)
                return ret;
        priv->hwts_tx_en = 0;
        priv->hwts_rx_en = 0;
  
-       stmmac_ptp_register(priv);
        return 0;
  }
  
@@@ -936,15 -938,105 +938,15 @@@ static void stmmac_mac_flow_ctrl(struc
                        priv->pause, tx_cnt);
  }
  
 -static void stmmac_validate(struct phylink_config *config,
 -                          unsigned long *supported,
 -                          struct phylink_link_state *state)
 +static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config,
 +                                               phy_interface_t interface)
  {
        struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
 -      __ETHTOOL_DECLARE_LINK_MODE_MASK(mac_supported) = { 0, };
 -      __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 -      int tx_cnt = priv->plat->tx_queues_to_use;
 -      int max_speed = priv->plat->max_speed;
 -
 -      phylink_set(mac_supported, 10baseT_Half);
 -      phylink_set(mac_supported, 10baseT_Full);
 -      phylink_set(mac_supported, 100baseT_Half);
 -      phylink_set(mac_supported, 100baseT_Full);
 -      phylink_set(mac_supported, 1000baseT_Half);
 -      phylink_set(mac_supported, 1000baseT_Full);
 -      phylink_set(mac_supported, 1000baseKX_Full);
 -
 -      phylink_set(mac_supported, Autoneg);
 -      phylink_set(mac_supported, Pause);
 -      phylink_set(mac_supported, Asym_Pause);
 -      phylink_set_port_modes(mac_supported);
 -
 -      /* Cut down 1G if asked to */
 -      if ((max_speed > 0) && (max_speed < 1000)) {
 -              phylink_set(mask, 1000baseT_Full);
 -              phylink_set(mask, 1000baseX_Full);
 -      } else if (priv->plat->has_gmac4) {
 -              if (!max_speed || max_speed >= 2500) {
 -                      phylink_set(mac_supported, 2500baseT_Full);
 -                      phylink_set(mac_supported, 2500baseX_Full);
 -              }
 -      } else if (priv->plat->has_xgmac) {
 -              if (!max_speed || (max_speed >= 2500)) {
 -                      phylink_set(mac_supported, 2500baseT_Full);
 -                      phylink_set(mac_supported, 2500baseX_Full);
 -              }
 -              if (!max_speed || (max_speed >= 5000)) {
 -                      phylink_set(mac_supported, 5000baseT_Full);
 -              }
 -              if (!max_speed || (max_speed >= 10000)) {
 -                      phylink_set(mac_supported, 10000baseSR_Full);
 -                      phylink_set(mac_supported, 10000baseLR_Full);
 -                      phylink_set(mac_supported, 10000baseER_Full);
 -                      phylink_set(mac_supported, 10000baseLRM_Full);
 -                      phylink_set(mac_supported, 10000baseT_Full);
 -                      phylink_set(mac_supported, 10000baseKX4_Full);
 -                      phylink_set(mac_supported, 10000baseKR_Full);
 -              }
 -              if (!max_speed || (max_speed >= 25000)) {
 -                      phylink_set(mac_supported, 25000baseCR_Full);
 -                      phylink_set(mac_supported, 25000baseKR_Full);
 -                      phylink_set(mac_supported, 25000baseSR_Full);
 -              }
 -              if (!max_speed || (max_speed >= 40000)) {
 -                      phylink_set(mac_supported, 40000baseKR4_Full);
 -                      phylink_set(mac_supported, 40000baseCR4_Full);
 -                      phylink_set(mac_supported, 40000baseSR4_Full);
 -                      phylink_set(mac_supported, 40000baseLR4_Full);
 -              }
 -              if (!max_speed || (max_speed >= 50000)) {
 -                      phylink_set(mac_supported, 50000baseCR2_Full);
 -                      phylink_set(mac_supported, 50000baseKR2_Full);
 -                      phylink_set(mac_supported, 50000baseSR2_Full);
 -                      phylink_set(mac_supported, 50000baseKR_Full);
 -                      phylink_set(mac_supported, 50000baseSR_Full);
 -                      phylink_set(mac_supported, 50000baseCR_Full);
 -                      phylink_set(mac_supported, 50000baseLR_ER_FR_Full);
 -                      phylink_set(mac_supported, 50000baseDR_Full);
 -              }
 -              if (!max_speed || (max_speed >= 100000)) {
 -                      phylink_set(mac_supported, 100000baseKR4_Full);
 -                      phylink_set(mac_supported, 100000baseSR4_Full);
 -                      phylink_set(mac_supported, 100000baseCR4_Full);
 -                      phylink_set(mac_supported, 100000baseLR4_ER4_Full);
 -                      phylink_set(mac_supported, 100000baseKR2_Full);
 -                      phylink_set(mac_supported, 100000baseSR2_Full);
 -                      phylink_set(mac_supported, 100000baseCR2_Full);
 -                      phylink_set(mac_supported, 100000baseLR2_ER2_FR2_Full);
 -                      phylink_set(mac_supported, 100000baseDR2_Full);
 -              }
 -      }
 -
 -      /* Half-Duplex can only work with single queue */
 -      if (tx_cnt > 1) {
 -              phylink_set(mask, 10baseT_Half);
 -              phylink_set(mask, 100baseT_Half);
 -              phylink_set(mask, 1000baseT_Half);
 -      }
  
 -      linkmode_and(supported, supported, mac_supported);
 -      linkmode_andnot(supported, supported, mask);
 +      if (!priv->hw->xpcs)
 +              return NULL;
  
 -      linkmode_and(state->advertising, state->advertising, mac_supported);
 -      linkmode_andnot(state->advertising, state->advertising, mask);
 -
 -      /* If PCS is supported, check which modes it supports. */
 -      if (priv->hw->xpcs)
 -              xpcs_validate(priv->hw->xpcs, supported, state);
 +      return &priv->hw->xpcs->pcs;
  }
  
  static void stmmac_mac_config(struct phylink_config *config, unsigned int mode,
@@@ -1083,8 -1175,7 +1085,8 @@@ static void stmmac_mac_link_up(struct p
  }
  
  static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
 -      .validate = stmmac_validate,
 +      .validate = phylink_generic_validate,
 +      .mac_select_pcs = stmmac_mac_select_pcs,
        .mac_config = stmmac_mac_config,
        .mac_link_down = stmmac_mac_link_down,
        .mac_link_up = stmmac_mac_link_up,
@@@ -1164,12 -1255,12 +1166,12 @@@ static int stmmac_phy_setup(struct stmm
  {
        struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
        struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat->phylink_node);
 +      int max_speed = priv->plat->max_speed;
        int mode = priv->plat->phy_interface;
        struct phylink *phylink;
  
        priv->phylink_config.dev = &priv->dev->dev;
        priv->phylink_config.type = PHYLINK_NETDEV;
 -      priv->phylink_config.pcs_poll = true;
        if (priv->plat->mdio_bus_data)
                priv->phylink_config.ovr_an_inband =
                        mdio_bus_data->xpcs_an_inband;
        if (!fwnode)
                fwnode = dev_fwnode(priv->device);
  
 +      /* Set the platform/firmware specified interface mode */
 +      __set_bit(mode, priv->phylink_config.supported_interfaces);
 +
 +      /* If we have an xpcs, it defines which PHY interfaces are supported. */
 +      if (priv->hw->xpcs)
 +              xpcs_get_interfaces(priv->hw->xpcs,
 +                                  priv->phylink_config.supported_interfaces);
 +
 +      priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
 +              MAC_10 | MAC_100;
 +
 +      if (!max_speed || max_speed >= 1000)
 +              priv->phylink_config.mac_capabilities |= MAC_1000;
 +
 +      if (priv->plat->has_gmac4) {
 +              if (!max_speed || max_speed >= 2500)
 +                      priv->phylink_config.mac_capabilities |= MAC_2500FD;
 +      } else if (priv->plat->has_xgmac) {
 +              if (!max_speed || max_speed >= 2500)
 +                      priv->phylink_config.mac_capabilities |= MAC_2500FD;
 +              if (!max_speed || max_speed >= 5000)
 +                      priv->phylink_config.mac_capabilities |= MAC_5000FD;
 +              if (!max_speed || max_speed >= 10000)
 +                      priv->phylink_config.mac_capabilities |= MAC_10000FD;
 +              if (!max_speed || max_speed >= 25000)
 +                      priv->phylink_config.mac_capabilities |= MAC_25000FD;
 +              if (!max_speed || max_speed >= 40000)
 +                      priv->phylink_config.mac_capabilities |= MAC_40000FD;
 +              if (!max_speed || max_speed >= 50000)
 +                      priv->phylink_config.mac_capabilities |= MAC_50000FD;
 +              if (!max_speed || max_speed >= 100000)
 +                      priv->phylink_config.mac_capabilities |= MAC_100000FD;
 +      }
 +
 +      /* Half-Duplex can only work with single queue */
 +      if (priv->plat->tx_queues_to_use > 1)
 +              priv->phylink_config.mac_capabilities &=
 +                      ~(MAC_10HD | MAC_100HD | MAC_1000HD);
 +
        phylink = phylink_create(&priv->phylink_config, fwnode,
                                 mode, &stmmac_phylink_mac_ops);
        if (IS_ERR(phylink))
                return PTR_ERR(phylink);
  
 -      if (priv->hw->xpcs)
 -              phylink_set_pcs(phylink, &priv->hw->xpcs->pcs);
 -
        priv->phylink = phylink;
        return 0;
  }
@@@ -2594,8 -2649,8 +2596,8 @@@ static int stmmac_tx_clean(struct stmma
  
        if (priv->eee_enabled && !priv->tx_path_in_lpi_mode &&
            priv->eee_sw_timer_en) {
-               stmmac_enable_eee_mode(priv);
-               mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer));
+               if (stmmac_enable_eee_mode(priv))
+                       mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer));
        }
  
        /* We still have pending packets, let's call for a new scheduling */
@@@ -3185,7 -3240,7 +3187,7 @@@ static int stmmac_fpe_start_wq(struct s
  /**
   * stmmac_hw_setup - setup mac in a usable state.
   *  @dev : pointer to the device structure.
-  *  @init_ptp: initialize PTP if set
+  *  @ptp_register: register PTP if set
   *  Description:
   *  this is the main function to setup the HW in a usable state because the
   *  dma engine is reset, the core registers are configured (e.g. AXI,
   *  0 on success and an appropriate (-)ve integer as defined in errno.h
   *  file on failure.
   */
- static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
+ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register)
  {
        struct stmmac_priv *priv = netdev_priv(dev);
        u32 rx_cnt = priv->plat->rx_queues_to_use;
  
        stmmac_mmc_setup(priv);
  
-       if (init_ptp) {
-               ret = stmmac_init_ptp(priv);
-               if (ret == -EOPNOTSUPP)
-                       netdev_warn(priv->dev, "PTP not supported by HW\n");
-               else if (ret)
-                       netdev_warn(priv->dev, "PTP init failed\n");
-       }
+       ret = stmmac_init_ptp(priv);
+       if (ret == -EOPNOTSUPP)
+               netdev_warn(priv->dev, "PTP not supported by HW\n");
+       else if (ret)
+               netdev_warn(priv->dev, "PTP init failed\n");
+       else if (ptp_register)
+               stmmac_ptp_register(priv);
  
        priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS;
  
diff --combined include/linux/skbuff.h
index 60bd2347708c1f6baff7d155bea54fe9da0e2d6f,8a636e678902db73ef95a1ce3effc8d3d160abb2..a27bcc4f7e9a92ea4f4f4f6e5f454bb4f8099f66
@@@ -318,7 -318,7 +318,7 @@@ enum skb_drop_reason 
        SKB_DROP_REASON_NO_SOCKET,
        SKB_DROP_REASON_PKT_TOO_SMALL,
        SKB_DROP_REASON_TCP_CSUM,
-       SKB_DROP_REASON_TCP_FILTER,
+       SKB_DROP_REASON_SOCKET_FILTER,
        SKB_DROP_REASON_UDP_CSUM,
        SKB_DROP_REASON_MAX,
  };
@@@ -557,7 -557,6 +557,7 @@@ struct skb_shared_info 
         * Warning : all fields before dataref are cleared in __alloc_skb()
         */
        atomic_t        dataref;
 +      unsigned int    xdp_frags_size;
  
        /* Intermediate layers must ensure that destructor_arg
         * remains valid until skb destructor */
@@@ -3899,6 -3898,11 +3899,6 @@@ static inline ktime_t net_timedelta(kti
        return ktime_sub(ktime_get_real(), t);
  }
  
 -static inline ktime_t net_invalid_timestamp(void)
 -{
 -      return 0;
 -}
 -
  static inline u8 skb_metadata_len(const struct sk_buff *skb)
  {
        return skb_shinfo(skb)->meta_len;
diff --combined net/ipv4/tcp_ipv4.c
index 00cd6ccf3ab480cfb6f1ea3ab7c4c3df70c39a19,fec656f5a39ee2f30ffa3a65daea3dee2d068a28..6873f46fc8ba8b9c769ca3a1d7acffdcdc56871a
@@@ -91,8 -91,6 +91,8 @@@ static int tcp_v4_md5_hash_hdr(char *md
  struct inet_hashinfo tcp_hashinfo;
  EXPORT_SYMBOL(tcp_hashinfo);
  
 +static DEFINE_PER_CPU(struct sock *, ipv4_tcp_sk);
 +
  static u32 tcp_v4_init_seq(const struct sk_buff *skb)
  {
        return secure_tcp_seq(ip_hdr(skb)->daddr,
@@@ -208,7 -206,7 +208,7 @@@ int tcp_v4_connect(struct sock *sk, str
        struct rtable *rt;
        int err;
        struct ip_options_rcu *inet_opt;
 -      struct inet_timewait_death_row *tcp_death_row = &sock_net(sk)->ipv4.tcp_death_row;
 +      struct inet_timewait_death_row *tcp_death_row = sock_net(sk)->ipv4.tcp_death_row;
  
        if (addr_len < sizeof(struct sockaddr_in))
                return -EINVAL;
@@@ -812,8 -810,7 +812,8 @@@ static void tcp_v4_send_reset(const str
        arg.tos = ip_hdr(skb)->tos;
        arg.uid = sock_net_uid(net, sk && sk_fullsock(sk) ? sk : NULL);
        local_bh_disable();
 -      ctl_sk = this_cpu_read(*net->ipv4.tcp_sk);
 +      ctl_sk = this_cpu_read(ipv4_tcp_sk);
 +      sock_net_set(ctl_sk, net);
        if (sk) {
                ctl_sk->sk_mark = (sk->sk_state == TCP_TIME_WAIT) ?
                                   inet_twsk(sk)->tw_mark : sk->sk_mark;
                              transmit_time);
  
        ctl_sk->sk_mark = 0;
 +      sock_net_set(ctl_sk, &init_net);
        __TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
        __TCP_INC_STATS(net, TCP_MIB_OUTRSTS);
        local_bh_enable();
@@@ -912,8 -908,7 +912,8 @@@ static void tcp_v4_send_ack(const struc
        arg.tos = tos;
        arg.uid = sock_net_uid(net, sk_fullsock(sk) ? sk : NULL);
        local_bh_disable();
 -      ctl_sk = this_cpu_read(*net->ipv4.tcp_sk);
 +      ctl_sk = this_cpu_read(ipv4_tcp_sk);
 +      sock_net_set(ctl_sk, net);
        ctl_sk->sk_mark = (sk->sk_state == TCP_TIME_WAIT) ?
                           inet_twsk(sk)->tw_mark : sk->sk_mark;
        ctl_sk->sk_priority = (sk->sk_state == TCP_TIME_WAIT) ?
                              transmit_time);
  
        ctl_sk->sk_mark = 0;
 +      sock_net_set(ctl_sk, &init_net);
        __TCP_INC_STATS(net, TCP_MIB_OUTSEGS);
        local_bh_enable();
  }
@@@ -2101,7 -2095,7 +2101,7 @@@ process
        nf_reset_ct(skb);
  
        if (tcp_filter(sk, skb)) {
-               drop_reason = SKB_DROP_REASON_TCP_FILTER;
+               drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
                goto discard_and_relse;
        }
        th = (const struct tcphdr *)skb->data;
@@@ -3008,7 -3002,7 +3008,7 @@@ static unsigned short seq_file_family(c
  #endif
  
        /* Iterated from proc fs */
-       afinfo = PDE_DATA(file_inode(seq->file));
+       afinfo = pde_data(file_inode(seq->file));
        return afinfo->family;
  }
  
@@@ -3117,18 -3111,41 +3117,18 @@@ EXPORT_SYMBOL(tcp_prot)
  
  static void __net_exit tcp_sk_exit(struct net *net)
  {
 -      int cpu;
 +      struct inet_timewait_death_row *tcp_death_row = net->ipv4.tcp_death_row;
  
        if (net->ipv4.tcp_congestion_control)
                bpf_module_put(net->ipv4.tcp_congestion_control,
                               net->ipv4.tcp_congestion_control->owner);
 -
 -      for_each_possible_cpu(cpu)
 -              inet_ctl_sock_destroy(*per_cpu_ptr(net->ipv4.tcp_sk, cpu));
 -      free_percpu(net->ipv4.tcp_sk);
 +      if (refcount_dec_and_test(&tcp_death_row->tw_refcount))
 +              kfree(tcp_death_row);
  }
  
  static int __net_init tcp_sk_init(struct net *net)
  {
 -      int res, cpu, cnt;
 -
 -      net->ipv4.tcp_sk = alloc_percpu(struct sock *);
 -      if (!net->ipv4.tcp_sk)
 -              return -ENOMEM;
 -
 -      for_each_possible_cpu(cpu) {
 -              struct sock *sk;
 -
 -              res = inet_ctl_sock_create(&sk, PF_INET, SOCK_RAW,
 -                                         IPPROTO_TCP, net);
 -              if (res)
 -                      goto fail;
 -              sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
 -
 -              /* Please enforce IP_DF and IPID==0 for RST and
 -               * ACK sent in SYN-RECV and TIME-WAIT state.
 -               */
 -              inet_sk(sk)->pmtudisc = IP_PMTUDISC_DO;
 -
 -              *per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk;
 -      }
 +      int cnt;
  
        net->ipv4.sysctl_tcp_ecn = 2;
        net->ipv4.sysctl_tcp_ecn_fallback = 1;
        net->ipv4.sysctl_tcp_tw_reuse = 2;
        net->ipv4.sysctl_tcp_no_ssthresh_metrics_save = 1;
  
 +      net->ipv4.tcp_death_row = kzalloc(sizeof(struct inet_timewait_death_row), GFP_KERNEL);
 +      if (!net->ipv4.tcp_death_row)
 +              return -ENOMEM;
 +      refcount_set(&net->ipv4.tcp_death_row->tw_refcount, 1);
        cnt = tcp_hashinfo.ehash_mask + 1;
 -      net->ipv4.tcp_death_row.sysctl_max_tw_buckets = cnt / 2;
 -      net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo;
 +      net->ipv4.tcp_death_row->sysctl_max_tw_buckets = cnt / 2;
 +      net->ipv4.tcp_death_row->hashinfo = &tcp_hashinfo;
  
        net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 128);
        net->ipv4.sysctl_tcp_sack = 1;
                net->ipv4.tcp_congestion_control = &tcp_reno;
  
        return 0;
 -fail:
 -      tcp_sk_exit(net);
 -
 -      return res;
  }
  
  static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
  {
        struct net *net;
  
 -      inet_twsk_purge(&tcp_hashinfo, AF_INET);
 -
        list_for_each_entry(net, net_exit_list, exit_list)
                tcp_fastopen_ctx_destroy(net);
  }
@@@ -3307,24 -3326,6 +3307,24 @@@ static void __init bpf_iter_register(vo
  
  void __init tcp_v4_init(void)
  {
 +      int cpu, res;
 +
 +      for_each_possible_cpu(cpu) {
 +              struct sock *sk;
 +
 +              res = inet_ctl_sock_create(&sk, PF_INET, SOCK_RAW,
 +                                         IPPROTO_TCP, &init_net);
 +              if (res)
 +                      panic("Failed to create the TCP control socket.\n");
 +              sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
 +
 +              /* Please enforce IP_DF and IPID==0 for RST and
 +               * ACK sent in SYN-RECV and TIME-WAIT state.
 +               */
 +              inet_sk(sk)->pmtudisc = IP_PMTUDISC_DO;
 +
 +              per_cpu(ipv4_tcp_sk, cpu) = sk;
 +      }
        if (register_pernet_subsys(&tcp_sk_ops))
                panic("Failed to create the TCP control socket.\n");
  
This page took 0.14112 seconds and 4 git commands to generate.