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

Commit 53e50398 authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller
Browse files

net: Remove gso_send_check as an offload callback



The send_check logic was only interesting in cases of TCP offload and
UDP UFO where the checksum needed to be initialized to the pseudo
header checksum. Now we've moved that logic into the related
gso_segment functions so gso_send_check is no longer needed.

Signed-off-by: default avatarTom Herbert <therbert@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f71470b3
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -1911,7 +1911,6 @@ struct packet_type {
struct offload_callbacks {
struct offload_callbacks {
	struct sk_buff		*(*gso_segment)(struct sk_buff *skb,
	struct sk_buff		*(*gso_segment)(struct sk_buff *skb,
						netdev_features_t features);
						netdev_features_t features);
	int			(*gso_send_check)(struct sk_buff *skb);
	struct sk_buff		**(*gro_receive)(struct sk_buff **head,
	struct sk_buff		**(*gro_receive)(struct sk_buff **head,
					       struct sk_buff *skb);
					       struct sk_buff *skb);
	int			(*gro_complete)(struct sk_buff *skb, int nhoff);
	int			(*gro_complete)(struct sk_buff *skb, int nhoff);
+0 −10
Original line number Original line Diff line number Diff line
@@ -2422,16 +2422,6 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
	rcu_read_lock();
	rcu_read_lock();
	list_for_each_entry_rcu(ptype, &offload_base, list) {
	list_for_each_entry_rcu(ptype, &offload_base, list) {
		if (ptype->type == type && ptype->callbacks.gso_segment) {
		if (ptype->type == type && ptype->callbacks.gso_segment) {
			if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
				int err;

				err = ptype->callbacks.gso_send_check(skb);
				segs = ERR_PTR(err);
				if (err || skb_gso_ok(skb, features))
					break;
				__skb_push(skb, (skb->data -
						 skb_network_header(skb)));
			}
			segs = ptype->callbacks.gso_segment(skb, features);
			segs = ptype->callbacks.gso_segment(skb, features);
			break;
			break;
		}
		}
+0 −36
Original line number Original line Diff line number Diff line
@@ -1197,40 +1197,6 @@ int inet_sk_rebuild_header(struct sock *sk)
}
}
EXPORT_SYMBOL(inet_sk_rebuild_header);
EXPORT_SYMBOL(inet_sk_rebuild_header);


static int inet_gso_send_check(struct sk_buff *skb)
{
	const struct net_offload *ops;
	const struct iphdr *iph;
	int proto;
	int ihl;
	int err = -EINVAL;

	if (unlikely(!pskb_may_pull(skb, sizeof(*iph))))
		goto out;

	iph = ip_hdr(skb);
	ihl = iph->ihl * 4;
	if (ihl < sizeof(*iph))
		goto out;

	proto = iph->protocol;

	/* Warning: after this point, iph might be no longer valid */
	if (unlikely(!pskb_may_pull(skb, ihl)))
		goto out;
	__skb_pull(skb, ihl);

	skb_reset_transport_header(skb);
	err = -EPROTONOSUPPORT;

	ops = rcu_dereference(inet_offloads[proto]);
	if (likely(ops && ops->callbacks.gso_send_check))
		err = ops->callbacks.gso_send_check(skb);

out:
	return err;
}

static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
					netdev_features_t features)
					netdev_features_t features)
{
{
@@ -1655,7 +1621,6 @@ static int ipv4_proc_init(void);
static struct packet_offload ip_packet_offload __read_mostly = {
static struct packet_offload ip_packet_offload __read_mostly = {
	.type = cpu_to_be16(ETH_P_IP),
	.type = cpu_to_be16(ETH_P_IP),
	.callbacks = {
	.callbacks = {
		.gso_send_check = inet_gso_send_check,
		.gso_segment = inet_gso_segment,
		.gso_segment = inet_gso_segment,
		.gro_receive = inet_gro_receive,
		.gro_receive = inet_gro_receive,
		.gro_complete = inet_gro_complete,
		.gro_complete = inet_gro_complete,
@@ -1664,7 +1629,6 @@ static struct packet_offload ip_packet_offload __read_mostly = {


static const struct net_offload ipip_offload = {
static const struct net_offload ipip_offload = {
	.callbacks = {
	.callbacks = {
		.gso_send_check = inet_gso_send_check,
		.gso_segment	= inet_gso_segment,
		.gso_segment	= inet_gso_segment,
		.gro_receive	= inet_gro_receive,
		.gro_receive	= inet_gro_receive,
		.gro_complete	= inet_gro_complete,
		.gro_complete	= inet_gro_complete,
+3 −8
Original line number Original line Diff line number Diff line
@@ -15,13 +15,6 @@
#include <net/protocol.h>
#include <net/protocol.h>
#include <net/gre.h>
#include <net/gre.h>


static int gre_gso_send_check(struct sk_buff *skb)
{
	if (!skb->encapsulation)
		return -EINVAL;
	return 0;
}

static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
				       netdev_features_t features)
				       netdev_features_t features)
{
{
@@ -46,6 +39,9 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
				  SKB_GSO_IPIP)))
				  SKB_GSO_IPIP)))
		goto out;
		goto out;


	if (!skb->encapsulation)
		goto out;

	if (unlikely(!pskb_may_pull(skb, sizeof(*greh))))
	if (unlikely(!pskb_may_pull(skb, sizeof(*greh))))
		goto out;
		goto out;


@@ -256,7 +252,6 @@ static int gre_gro_complete(struct sk_buff *skb, int nhoff)


static const struct net_offload gre_offload = {
static const struct net_offload gre_offload = {
	.callbacks = {
	.callbacks = {
		.gso_send_check = gre_gso_send_check,
		.gso_segment = gre_gso_segment,
		.gso_segment = gre_gso_segment,
		.gro_receive = gre_gro_receive,
		.gro_receive = gre_gro_receive,
		.gro_complete = gre_gro_complete,
		.gro_complete = gre_gro_complete,
+0 −6
Original line number Original line Diff line number Diff line
@@ -288,11 +288,6 @@ int tcp_gro_complete(struct sk_buff *skb)
}
}
EXPORT_SYMBOL(tcp_gro_complete);
EXPORT_SYMBOL(tcp_gro_complete);


static int tcp_v4_gso_send_check(struct sk_buff *skb)
{
	return 0;
}

static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb)
static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb)
{
{
	/* Don't bother verifying checksum if we're going to flush anyway. */
	/* Don't bother verifying checksum if we're going to flush anyway. */
@@ -320,7 +315,6 @@ static int tcp4_gro_complete(struct sk_buff *skb, int thoff)


static const struct net_offload tcpv4_offload = {
static const struct net_offload tcpv4_offload = {
	.callbacks = {
	.callbacks = {
		.gso_send_check	=	tcp_v4_gso_send_check,
		.gso_segment	=	tcp4_gso_segment,
		.gso_segment	=	tcp4_gso_segment,
		.gro_receive	=	tcp4_gro_receive,
		.gro_receive	=	tcp4_gro_receive,
		.gro_complete	=	tcp4_gro_complete,
		.gro_complete	=	tcp4_gro_complete,
Loading