forked from Minki/linux
geneve: change to use UDP socket GRO
Adapt geneve_gro_receive, geneve_gro_complete to take a socket argument. Set these functions in tunnel_config. Don't set udp_offloads any more. Signed-off-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d92283e338
commit
4a0090a98e
@ -87,7 +87,6 @@ struct geneve_sock {
|
|||||||
struct socket *sock;
|
struct socket *sock;
|
||||||
struct rcu_head rcu;
|
struct rcu_head rcu;
|
||||||
int refcnt;
|
int refcnt;
|
||||||
struct udp_offload udp_offloads;
|
|
||||||
struct hlist_head vni_list[VNI_HASH_SIZE];
|
struct hlist_head vni_list[VNI_HASH_SIZE];
|
||||||
u32 flags;
|
u32 flags;
|
||||||
};
|
};
|
||||||
@ -409,14 +408,6 @@ static void geneve_notify_add_rx_port(struct geneve_sock *gs)
|
|||||||
struct net *net = sock_net(sk);
|
struct net *net = sock_net(sk);
|
||||||
sa_family_t sa_family = geneve_get_sk_family(gs);
|
sa_family_t sa_family = geneve_get_sk_family(gs);
|
||||||
__be16 port = inet_sk(sk)->inet_sport;
|
__be16 port = inet_sk(sk)->inet_sport;
|
||||||
int err;
|
|
||||||
|
|
||||||
if (sa_family == AF_INET) {
|
|
||||||
err = udp_add_offload(sock_net(sk), &gs->udp_offloads);
|
|
||||||
if (err)
|
|
||||||
pr_warn("geneve: udp_add_offload failed with status %d\n",
|
|
||||||
err);
|
|
||||||
}
|
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
for_each_netdev_rcu(net, dev) {
|
for_each_netdev_rcu(net, dev) {
|
||||||
@ -432,9 +423,9 @@ static int geneve_hlen(struct genevehdr *gh)
|
|||||||
return sizeof(*gh) + gh->opt_len * 4;
|
return sizeof(*gh) + gh->opt_len * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sk_buff **geneve_gro_receive(struct sk_buff **head,
|
static struct sk_buff **geneve_gro_receive(struct sock *sk,
|
||||||
struct sk_buff *skb,
|
struct sk_buff **head,
|
||||||
struct udp_offload *uoff)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct sk_buff *p, **pp = NULL;
|
struct sk_buff *p, **pp = NULL;
|
||||||
struct genevehdr *gh, *gh2;
|
struct genevehdr *gh, *gh2;
|
||||||
@ -495,8 +486,8 @@ out:
|
|||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int geneve_gro_complete(struct sk_buff *skb, int nhoff,
|
static int geneve_gro_complete(struct sock *sk, struct sk_buff *skb,
|
||||||
struct udp_offload *uoff)
|
int nhoff)
|
||||||
{
|
{
|
||||||
struct genevehdr *gh;
|
struct genevehdr *gh;
|
||||||
struct packet_offload *ptype;
|
struct packet_offload *ptype;
|
||||||
@ -545,14 +536,14 @@ static struct geneve_sock *geneve_socket_create(struct net *net, __be16 port,
|
|||||||
INIT_HLIST_HEAD(&gs->vni_list[h]);
|
INIT_HLIST_HEAD(&gs->vni_list[h]);
|
||||||
|
|
||||||
/* Initialize the geneve udp offloads structure */
|
/* Initialize the geneve udp offloads structure */
|
||||||
gs->udp_offloads.port = port;
|
|
||||||
gs->udp_offloads.callbacks.gro_receive = geneve_gro_receive;
|
|
||||||
gs->udp_offloads.callbacks.gro_complete = geneve_gro_complete;
|
|
||||||
geneve_notify_add_rx_port(gs);
|
geneve_notify_add_rx_port(gs);
|
||||||
|
|
||||||
/* Mark socket as an encapsulation socket */
|
/* Mark socket as an encapsulation socket */
|
||||||
|
memset(&tunnel_cfg, 0, sizeof(tunnel_cfg));
|
||||||
tunnel_cfg.sk_user_data = gs;
|
tunnel_cfg.sk_user_data = gs;
|
||||||
tunnel_cfg.encap_type = 1;
|
tunnel_cfg.encap_type = 1;
|
||||||
|
tunnel_cfg.gro_receive = geneve_gro_receive;
|
||||||
|
tunnel_cfg.gro_complete = geneve_gro_complete;
|
||||||
tunnel_cfg.encap_rcv = geneve_udp_encap_recv;
|
tunnel_cfg.encap_rcv = geneve_udp_encap_recv;
|
||||||
tunnel_cfg.encap_destroy = NULL;
|
tunnel_cfg.encap_destroy = NULL;
|
||||||
setup_udp_tunnel_sock(net, sock, &tunnel_cfg);
|
setup_udp_tunnel_sock(net, sock, &tunnel_cfg);
|
||||||
@ -576,9 +567,6 @@ static void geneve_notify_del_rx_port(struct geneve_sock *gs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
if (sa_family == AF_INET)
|
|
||||||
udp_del_offload(&gs->udp_offloads);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __geneve_sock_release(struct geneve_sock *gs)
|
static void __geneve_sock_release(struct geneve_sock *gs)
|
||||||
|
Loading…
Reference in New Issue
Block a user