Merge tag 'net-5.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski.
 "Including fixes from bpf and netfilter.

  Current release - regressions:

   - sock: fix parameter order in sock_setsockopt()

  Current release - new code bugs:

   - netfilter: nft_last:
       - fix incorrect arithmetic when restoring last used
       - honor NFTA_LAST_SET on restoration

  Previous releases - regressions:

   - udp: properly flush normal packet at GRO time

   - sfc: ensure correct number of XDP queues; don't allow enabling the
     feature if there isn't sufficient resources to Tx from any CPU

   - dsa: sja1105: fix address learning getting disabled on the CPU port

   - mptcp: addresses a rmem accounting issue that could keep packets in
     subflow receive buffers longer than necessary, delaying MPTCP-level
     ACKs

   - ip_tunnel: fix mtu calculation for ETHER tunnel devices

   - do not reuse skbs allocated from skbuff_fclone_cache in the napi
     skb cache, we'd try to return them to the wrong slab cache

   - tcp: consistently disable header prediction for mptcp

  Previous releases - always broken:

   - bpf: fix subprog poke descriptor tracking use-after-free

   - ipv6:
       - allocate enough headroom in ip6_finish_output2() in case
         iptables TEE is used
       - tcp: drop silly ICMPv6 packet too big messages to avoid
         expensive and pointless lookups (which may serve as a DDOS
         vector)
       - make sure fwmark is copied in SYNACK packets
       - fix 'disable_policy' for forwarded packets (align with IPv4)

   - netfilter: conntrack:
       - do not renew entry stuck in tcp SYN_SENT state
       - do not mark RST in the reply direction coming after SYN packet
         for an out-of-sync entry

   - mptcp: cleanly handle error conditions with MP_JOIN and syncookies

   - mptcp: fix double free when rejecting a join due to port mismatch

   - validate lwtstate->data before returning from skb_tunnel_info()

   - tcp: call sk_wmem_schedule before sk_mem_charge in zerocopy path

   - mt76: mt7921: continue to probe driver when fw already downloaded

   - bonding: fix multiple issues with offloading IPsec to (thru?) bond

   - stmmac: ptp: fix issues around Qbv support and setting time back

   - bcmgenet: always clear wake-up based on energy detection

  Misc:

   - sctp: move 198 addresses from unusable to private scope

   - ptp: support virtual clocks and timestamping

   - openvswitch: optimize operation for key comparison"

* tag 'net-5.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (158 commits)
  net: dsa: properly check for the bridge_leave methods in dsa_switch_bridge_leave()
  sfc: add logs explaining XDP_TX/REDIRECT is not available
  sfc: ensure correct number of XDP queues
  sfc: fix lack of XDP TX queues - error XDP TX failed (-22)
  net: fddi: fix UAF in fza_probe
  net: dsa: sja1105: fix address learning getting disabled on the CPU port
  net: ocelot: fix switchdev objects synced for wrong netdev with LAG offload
  net: Use nlmsg_unicast() instead of netlink_unicast()
  octeontx2-pf: Fix uninitialized boolean variable pps
  ipv6: allocate enough headroom in ip6_finish_output2()
  net: hdlc: rename 'mod_init' & 'mod_exit' functions to be module-specific
  net: bridge: multicast: fix MRD advertisement router port marking race
  net: bridge: multicast: fix PIM hello router port marking race
  net: phy: marvell10g: fix differentiation of 88X3310 from 88X3340
  dsa: fix for_each_child.cocci warnings
  virtio_net: check virtqueue_add_sgs() return value
  mptcp: properly account bulk freed memory
  selftests: mptcp: fix case multiple subflows limited by server
  mptcp: avoid processing packet if a subflow reset
  mptcp: fix syncookie process if mptcp can not_accept new subflow
  ...
This commit is contained in:
Linus Torvalds
2021-07-14 09:24:32 -07:00
191 changed files with 3598 additions and 2349 deletions
+8 -1
View File
@@ -201,6 +201,11 @@ struct bond_up_slave {
*/
#define BOND_LINK_NOCHANGE -1
struct bond_ipsec {
struct list_head list;
struct xfrm_state *xs;
};
/*
* Here are the locking policies for the two bonding locks:
* Get rcu_read_lock when reading or RTNL when writing slave list.
@@ -249,7 +254,9 @@ struct bonding {
#endif /* CONFIG_DEBUG_FS */
struct rtnl_link_stats64 bond_stats;
#ifdef CONFIG_XFRM_OFFLOAD
struct xfrm_state *xs;
struct list_head ipsec_list;
/* protecting ipsec_list */
spinlock_t ipsec_lock;
#endif /* CONFIG_XFRM_OFFLOAD */
};
+1 -1
View File
@@ -38,7 +38,7 @@ static inline bool net_busy_loop_on(void)
static inline bool sk_can_busy_loop(const struct sock *sk)
{
return sk->sk_ll_usec && !signal_pending(current);
return READ_ONCE(sk->sk_ll_usec) && !signal_pending(current);
}
bool sk_busy_loop_end(void *p, unsigned long start_time);
-200
View File
@@ -1,200 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) ST-Ericsson AB 2010
* Author: Daniel Martensson / daniel.martensson@stericsson.com
* Dmitry.Tarnyagin / dmitry.tarnyagin@stericsson.com
*/
#ifndef CAIF_HSI_H_
#define CAIF_HSI_H_
#include <net/caif/caif_layer.h>
#include <net/caif/caif_device.h>
#include <linux/atomic.h>
/*
* Maximum number of CAIF frames that can reside in the same HSI frame.
*/
#define CFHSI_MAX_PKTS 15
/*
* Maximum number of bytes used for the frame that can be embedded in the
* HSI descriptor.
*/
#define CFHSI_MAX_EMB_FRM_SZ 96
/*
* Decides if HSI buffers should be prefilled with 0xFF pattern for easier
* debugging. Both TX and RX buffers will be filled before the transfer.
*/
#define CFHSI_DBG_PREFILL 0
/* Structure describing a HSI packet descriptor. */
#pragma pack(1) /* Byte alignment. */
struct cfhsi_desc {
u8 header;
u8 offset;
u16 cffrm_len[CFHSI_MAX_PKTS];
u8 emb_frm[CFHSI_MAX_EMB_FRM_SZ];
};
#pragma pack() /* Default alignment. */
/* Size of the complete HSI packet descriptor. */
#define CFHSI_DESC_SZ (sizeof(struct cfhsi_desc))
/*
* Size of the complete HSI packet descriptor excluding the optional embedded
* CAIF frame.
*/
#define CFHSI_DESC_SHORT_SZ (CFHSI_DESC_SZ - CFHSI_MAX_EMB_FRM_SZ)
/*
* Maximum bytes transferred in one transfer.
*/
#define CFHSI_MAX_CAIF_FRAME_SZ 4096
#define CFHSI_MAX_PAYLOAD_SZ (CFHSI_MAX_PKTS * CFHSI_MAX_CAIF_FRAME_SZ)
/* Size of the complete HSI TX buffer. */
#define CFHSI_BUF_SZ_TX (CFHSI_DESC_SZ + CFHSI_MAX_PAYLOAD_SZ)
/* Size of the complete HSI RX buffer. */
#define CFHSI_BUF_SZ_RX ((2 * CFHSI_DESC_SZ) + CFHSI_MAX_PAYLOAD_SZ)
/* Bitmasks for the HSI descriptor. */
#define CFHSI_PIGGY_DESC (0x01 << 7)
#define CFHSI_TX_STATE_IDLE 0
#define CFHSI_TX_STATE_XFER 1
#define CFHSI_RX_STATE_DESC 0
#define CFHSI_RX_STATE_PAYLOAD 1
/* Bitmasks for power management. */
#define CFHSI_WAKE_UP 0
#define CFHSI_WAKE_UP_ACK 1
#define CFHSI_WAKE_DOWN_ACK 2
#define CFHSI_AWAKE 3
#define CFHSI_WAKELOCK_HELD 4
#define CFHSI_SHUTDOWN 5
#define CFHSI_FLUSH_FIFO 6
#ifndef CFHSI_INACTIVITY_TOUT
#define CFHSI_INACTIVITY_TOUT (1 * HZ)
#endif /* CFHSI_INACTIVITY_TOUT */
#ifndef CFHSI_WAKE_TOUT
#define CFHSI_WAKE_TOUT (3 * HZ)
#endif /* CFHSI_WAKE_TOUT */
#ifndef CFHSI_MAX_RX_RETRIES
#define CFHSI_MAX_RX_RETRIES (10 * HZ)
#endif
/* Structure implemented by the CAIF HSI driver. */
struct cfhsi_cb_ops {
void (*tx_done_cb) (struct cfhsi_cb_ops *drv);
void (*rx_done_cb) (struct cfhsi_cb_ops *drv);
void (*wake_up_cb) (struct cfhsi_cb_ops *drv);
void (*wake_down_cb) (struct cfhsi_cb_ops *drv);
};
/* Structure implemented by HSI device. */
struct cfhsi_ops {
int (*cfhsi_up) (struct cfhsi_ops *dev);
int (*cfhsi_down) (struct cfhsi_ops *dev);
int (*cfhsi_tx) (u8 *ptr, int len, struct cfhsi_ops *dev);
int (*cfhsi_rx) (u8 *ptr, int len, struct cfhsi_ops *dev);
int (*cfhsi_wake_up) (struct cfhsi_ops *dev);
int (*cfhsi_wake_down) (struct cfhsi_ops *dev);
int (*cfhsi_get_peer_wake) (struct cfhsi_ops *dev, bool *status);
int (*cfhsi_fifo_occupancy) (struct cfhsi_ops *dev, size_t *occupancy);
int (*cfhsi_rx_cancel)(struct cfhsi_ops *dev);
struct cfhsi_cb_ops *cb_ops;
};
/* Structure holds status of received CAIF frames processing */
struct cfhsi_rx_state {
int state;
int nfrms;
int pld_len;
int retries;
bool piggy_desc;
};
/* Priority mapping */
enum {
CFHSI_PRIO_CTL = 0,
CFHSI_PRIO_VI,
CFHSI_PRIO_VO,
CFHSI_PRIO_BEBK,
CFHSI_PRIO_LAST,
};
struct cfhsi_config {
u32 inactivity_timeout;
u32 aggregation_timeout;
u32 head_align;
u32 tail_align;
u32 q_high_mark;
u32 q_low_mark;
};
/* Structure implemented by CAIF HSI drivers. */
struct cfhsi {
struct caif_dev_common cfdev;
struct net_device *ndev;
struct platform_device *pdev;
struct sk_buff_head qhead[CFHSI_PRIO_LAST];
struct cfhsi_cb_ops cb_ops;
struct cfhsi_ops *ops;
int tx_state;
struct cfhsi_rx_state rx_state;
struct cfhsi_config cfg;
int rx_len;
u8 *rx_ptr;
u8 *tx_buf;
u8 *rx_buf;
u8 *rx_flip_buf;
spinlock_t lock;
int flow_off_sent;
struct list_head list;
struct work_struct wake_up_work;
struct work_struct wake_down_work;
struct work_struct out_of_sync_work;
struct workqueue_struct *wq;
wait_queue_head_t wake_up_wait;
wait_queue_head_t wake_down_wait;
wait_queue_head_t flush_fifo_wait;
struct timer_list inactivity_timer;
struct timer_list rx_slowpath_timer;
/* TX aggregation */
int aggregation_len;
struct timer_list aggregation_timer;
unsigned long bits;
};
extern struct platform_driver cfhsi_driver;
/**
* enum ifla_caif_hsi - CAIF HSI NetlinkRT parameters.
* @IFLA_CAIF_HSI_INACTIVITY_TOUT: Inactivity timeout before
* taking the HSI wakeline down, in milliseconds.
* When using RT Netlink to create, destroy or configure a CAIF HSI interface,
* enum ifla_caif_hsi is used to specify the configuration attributes.
*/
enum ifla_caif_hsi {
__IFLA_CAIF_HSI_UNSPEC,
__IFLA_CAIF_HSI_INACTIVITY_TOUT,
__IFLA_CAIF_HSI_AGGREGATION_TOUT,
__IFLA_CAIF_HSI_HEAD_ALIGN,
__IFLA_CAIF_HSI_TAIL_ALIGN,
__IFLA_CAIF_HSI_QHIGH_WATERMARK,
__IFLA_CAIF_HSI_QLOW_WATERMARK,
__IFLA_CAIF_HSI_MAX
};
struct cfhsi_ops *cfhsi_get_ops(void);
#endif /* CAIF_HSI_H_ */
+3 -1
View File
@@ -45,7 +45,9 @@ skb_tunnel_info(const struct sk_buff *skb)
return &md_dst->u.tun_info;
dst = skb_dst(skb);
if (dst && dst->lwtstate)
if (dst && dst->lwtstate &&
(dst->lwtstate->type == LWTUNNEL_ENCAP_IP ||
dst->lwtstate->type == LWTUNNEL_ENCAP_IP6))
return lwt_tun_info(dst->lwtstate);
return NULL;
+1 -1
View File
@@ -263,7 +263,7 @@ static inline bool ipv6_anycast_destination(const struct dst_entry *dst,
int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
int (*output)(struct net *, struct sock *, struct sk_buff *));
static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
static inline unsigned int ip6_skb_dst_mtu(struct sk_buff *skb)
{
int mtu;
+3 -2
View File
@@ -105,7 +105,7 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
unsigned int *size, unsigned int remaining,
struct mptcp_out_options *opts);
void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb);
bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb);
void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
struct mptcp_out_options *opts);
@@ -227,9 +227,10 @@ static inline bool mptcp_established_options(struct sock *sk,
return false;
}
static inline void mptcp_incoming_options(struct sock *sk,
static inline bool mptcp_incoming_options(struct sock *sk,
struct sk_buff *skb)
{
return true;
}
static inline void mptcp_skb_ext_move(struct sk_buff *to,
@@ -30,7 +30,6 @@ void nf_conntrack_cleanup_net(struct net *net);
void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list);
void nf_conntrack_proto_pernet_init(struct net *net);
void nf_conntrack_proto_pernet_fini(struct net *net);
int nf_conntrack_proto_init(void);
void nf_conntrack_proto_fini(void);
+1
View File
@@ -27,6 +27,7 @@ struct nf_tcp_net {
u8 tcp_loose;
u8 tcp_be_liberal;
u8 tcp_max_retrans;
u8 tcp_ignore_invalid_rst;
#if IS_ENABLED(CONFIG_NF_FLOW_TABLE)
unsigned int offload_timeout;
unsigned int offload_pickup;
+1 -3
View File
@@ -360,8 +360,7 @@ enum {
#define SCTP_SCOPE_POLICY_MAX SCTP_SCOPE_POLICY_LINK
/* Based on IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>,
* SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 198.18.0.0/24,
* 192.88.99.0/24.
* SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 192.88.99.0/24.
* Also, RFC 8.4, non-unicast addresses are not considered valid SCTP
* addresses.
*/
@@ -369,7 +368,6 @@ enum {
((htonl(INADDR_BROADCAST) == a) || \
ipv4_is_multicast(a) || \
ipv4_is_zeronet(a) || \
ipv4_is_test_198(a) || \
ipv4_is_anycast_6to4(a))
/* Flags used for the bind address copy functions. */
+6 -2
View File
@@ -316,7 +316,9 @@ struct bpf_local_storage;
* @sk_timer: sock cleanup timer
* @sk_stamp: time stamp of last packet received
* @sk_stamp_seq: lock for accessing sk_stamp on 32 bit architectures only
* @sk_tsflags: SO_TIMESTAMPING socket options
* @sk_tsflags: SO_TIMESTAMPING flags
* @sk_bind_phc: SO_TIMESTAMPING bind PHC index of PTP virtual clock
* for timestamping
* @sk_tskey: counter to disambiguate concurrent tstamp requests
* @sk_zckey: counter to order MSG_ZEROCOPY notifications
* @sk_socket: Identd and reporting IO signals
@@ -493,6 +495,7 @@ struct sock {
seqlock_t sk_stamp_seq;
#endif
u16 sk_tsflags;
int sk_bind_phc;
u8 sk_shutdown;
u32 sk_tskey;
atomic_t sk_zckey;
@@ -2755,7 +2758,8 @@ void sock_def_readable(struct sock *sk);
int sock_bindtoindex(struct sock *sk, int ifindex, bool lock_sk);
void sock_set_timestamp(struct sock *sk, int optname, bool valbool);
int sock_set_timestamping(struct sock *sk, int optname, int val);
int sock_set_timestamping(struct sock *sk, int optname,
struct so_timestamping timestamping);
void sock_enable_timestamps(struct sock *sk);
void sock_no_linger(struct sock *sk);
+4
View File
@@ -686,6 +686,10 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
{
/* mptcp hooks are only on the slow path */
if (sk_is_mptcp((struct sock *)tp))
return;
tp->pred_flags = htonl((tp->tcp_header_len << 26) |
ntohl(TCP_FLAG_ACK) |
snd_wnd);