Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76fcee24 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'inet_csums_part3'



Tom Herbert says:

====================
net: Checksum offload changes - Part III

I am working on overhauling RX checksum offload. Goals of this effort
are:

- Specify what exactly it means when driver returns CHECKSUM_UNNECESSARY
- Preserve CHECKSUM_COMPLETE through encapsulation layers
- Don't do skb_checksum more than once per packet
- Unify GRO and non-GRO csum verification as much as possible
- Unify the checksum functions (checksum_init)
- Simply code

What is in this third patch set:

- Remove sk_no_check from sunrpc (doesn't seem to have any effect)
- Eliminate no_check from protosw. All protocols are using default of
  zero for this
- Split sk_no_check into sk_no_check_tx and sk_no_check_rx
- Make enabling of UDP6 more restrictive and explicit
- Support zero UDP6 checksums in l2tp

V2: Took out vxlan changes to set zero csums in IPv6, this will
    be in a later patch set.
V3: Fixed bug in restricting UDP6 checksums.

Please review carefully and test if possible, mucking with basic
checksum functions is always a little precarious :-)
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0c3592b8 6b649fea
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -244,7 +244,7 @@ iscsi_sw_tcp_conn_restore_callbacks(struct iscsi_conn *conn)
	sk->sk_data_ready   = tcp_sw_conn->old_data_ready;
	sk->sk_data_ready   = tcp_sw_conn->old_data_ready;
	sk->sk_state_change = tcp_sw_conn->old_state_change;
	sk->sk_state_change = tcp_sw_conn->old_state_change;
	sk->sk_write_space  = tcp_sw_conn->old_write_space;
	sk->sk_write_space  = tcp_sw_conn->old_write_space;
	sk->sk_no_check	 = 0;
	sk->sk_no_check_tx = 0;
	write_unlock_bh(&sk->sk_callback_lock);
	write_unlock_bh(&sk->sk_callback_lock);
}
}


+23 −1
Original line number Original line Diff line number Diff line
@@ -47,7 +47,9 @@ struct udp_sock {
#define udp_portaddr_node	inet.sk.__sk_common.skc_portaddr_node
#define udp_portaddr_node	inet.sk.__sk_common.skc_portaddr_node
	int		 pending;	/* Any pending frames ? */
	int		 pending;	/* Any pending frames ? */
	unsigned int	 corkflag;	/* Cork is required */
	unsigned int	 corkflag;	/* Cork is required */
  	__u16		 encap_type;	/* Is this an Encapsulation socket? */
	__u8		 encap_type;	/* Is this an Encapsulation socket? */
	unsigned char	 no_check6_tx:1,/* Send zero UDP6 checksums on TX? */
			 no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */
	/*
	/*
	 * Following member retains the information to create a UDP header
	 * Following member retains the information to create a UDP header
	 * when the socket is uncorked.
	 * when the socket is uncorked.
@@ -76,6 +78,26 @@ static inline struct udp_sock *udp_sk(const struct sock *sk)
	return (struct udp_sock *)sk;
	return (struct udp_sock *)sk;
}
}


static inline void udp_set_no_check6_tx(struct sock *sk, bool val)
{
	udp_sk(sk)->no_check6_tx = val;
}

static inline void udp_set_no_check6_rx(struct sock *sk, bool val)
{
	udp_sk(sk)->no_check6_rx = val;
}

static inline bool udp_get_no_check6_tx(struct sock *sk)
{
	return udp_sk(sk)->no_check6_tx;
}

static inline bool udp_get_no_check6_rx(struct sock *sk)
{
	return udp_sk(sk)->no_check6_rx;
}

#define udp_portaddr_for_each_entry(__sk, node, list) \
#define udp_portaddr_for_each_entry(__sk, node, list) \
	hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node)
	hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node)


+0 −1
Original line number Original line Diff line number Diff line
@@ -86,7 +86,6 @@ struct inet_protosw {
	struct proto	 *prot;
	struct proto	 *prot;
	const struct proto_ops *ops;
	const struct proto_ops *ops;
  
  
	char             no_check;   /* checksum on rcv/xmit/none? */
	unsigned char	 flags;      /* See INET_PROTOSW_* below.  */
	unsigned char	 flags;      /* See INET_PROTOSW_* below.  */
};
};
#define INET_PROTOSW_REUSE 0x01	     /* Are ports automatically reusable? */
#define INET_PROTOSW_REUSE 0x01	     /* Are ports automatically reusable? */
+4 −2
Original line number Original line Diff line number Diff line
@@ -243,7 +243,8 @@ struct cg_proto;
  *	@sk_sndbuf: size of send buffer in bytes
  *	@sk_sndbuf: size of send buffer in bytes
  *	@sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
  *	@sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
  *		   %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
  *		   %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
  *	@sk_no_check: %SO_NO_CHECK setting, whether or not checkup packets
  *	@sk_no_check_tx: %SO_NO_CHECK setting, set checksum in TX packets
  *	@sk_no_check_rx: allow zero checksum in RX packets
  *	@sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
  *	@sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
  *	@sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
  *	@sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
  *	@sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
  *	@sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
@@ -371,7 +372,8 @@ struct sock {
	struct sk_buff_head	sk_write_queue;
	struct sk_buff_head	sk_write_queue;
	kmemcheck_bitfield_begin(flags);
	kmemcheck_bitfield_begin(flags);
	unsigned int		sk_shutdown  : 2,
	unsigned int		sk_shutdown  : 2,
				sk_no_check  : 2,
				sk_no_check_tx : 1,
				sk_no_check_rx : 1,
				sk_userlocks : 4,
				sk_userlocks : 4,
				sk_protocol  : 8,
				sk_protocol  : 8,
				sk_type      : 16;
				sk_type      : 16;
+0 −9
Original line number Original line Diff line number Diff line
@@ -95,15 +95,6 @@ static inline struct udp_hslot *udp_hashslot2(struct udp_table *table,
	return &table->hash2[hash & table->mask];
	return &table->hash2[hash & table->mask];
}
}


/* Note: this must match 'valbool' in sock_setsockopt */
#define UDP_CSUM_NOXMIT		1

/* Used by SunRPC/xprt layer. */
#define UDP_CSUM_NORCV		2

/* Default, as per the RFC, is to always do csums. */
#define UDP_CSUM_DEFAULT	0

extern struct proto udp_prot;
extern struct proto udp_prot;


extern atomic_long_t udp_memory_allocated;
extern atomic_long_t udp_memory_allocated;
Loading