]> Pileus Git - ~andy/linux/blobdiff - net/ipv4/af_inet.c
net: Add net protocol offload registration infrustructure
[~andy/linux] / net / ipv4 / af_inet.c
index 766c596585631e1001bdd64c80639554c6ab7831..3918d869d6d4f7b7e02f9f254158452f156987f2 100644 (file)
@@ -1566,6 +1566,13 @@ static const struct net_protocol tcp_protocol = {
        .netns_ok       =       1,
 };
 
+static const struct net_offload tcp_offload = {
+       .gso_send_check =       tcp_v4_gso_send_check,
+       .gso_segment    =       tcp_tso_segment,
+       .gro_receive    =       tcp4_gro_receive,
+       .gro_complete   =       tcp4_gro_complete,
+};
+
 static const struct net_protocol udp_protocol = {
        .handler =      udp_rcv,
        .err_handler =  udp_err,
@@ -1575,6 +1582,11 @@ static const struct net_protocol udp_protocol = {
        .netns_ok =     1,
 };
 
+static const struct net_offload udp_offload = {
+       .gso_send_check = udp4_ufo_send_check,
+       .gso_segment = udp4_ufo_fragment,
+};
+
 static const struct net_protocol icmp_protocol = {
        .handler =      icmp_rcv,
        .err_handler =  ping_err,
@@ -1662,6 +1674,10 @@ static int ipv4_proc_init(void);
 static struct packet_type ip_packet_type __read_mostly = {
        .type = cpu_to_be16(ETH_P_IP),
        .func = ip_rcv,
+};
+
+static struct packet_offload ip_packet_offload __read_mostly = {
+       .type = cpu_to_be16(ETH_P_IP),
        .gso_send_check = inet_gso_send_check,
        .gso_segment = inet_gso_segment,
        .gro_receive = inet_gro_receive,
@@ -1781,6 +1797,7 @@ static int __init inet_init(void)
 
        ipfrag_init();
 
+       dev_add_offload(&ip_packet_offload);
        dev_add_pack(&ip_packet_type);
 
        rc = 0;