proc: remove PDE_DATA() completely
[sfrench/cifs-2.6.git] / net / ipv4 / tcp_ipv4.c
index 084df223b5dff8089a615a4a8d392b620fc0a28a..b53476e78c84f2b5d7cd9a04e0d947961f1f0495 100644 (file)
@@ -1182,7 +1182,7 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
                if (!md5sig)
                        return -ENOMEM;
 
-               sk_nocaps_add(sk, NETIF_F_GSO_MASK);
+               sk_gso_disable(sk);
                INIT_HLIST_HEAD(&md5sig->head);
                rcu_assign_pointer(tp->md5sig_info, md5sig);
        }
@@ -1620,7 +1620,7 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
                 */
                tcp_md5_do_add(newsk, addr, AF_INET, 32, l3index, key->flags,
                               key->key, key->keylen, GFP_ATOMIC);
-               sk_nocaps_add(newsk, NETIF_F_GSO_MASK);
+               sk_gso_disable(newsk);
        }
 #endif
 
@@ -1803,8 +1803,7 @@ int tcp_v4_early_demux(struct sk_buff *skb)
 
 bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
 {
-       u32 limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf);
-       u32 tail_gso_size, tail_gso_segs;
+       u32 limit, tail_gso_size, tail_gso_segs;
        struct skb_shared_info *shinfo;
        const struct tcphdr *th;
        struct tcphdr *thtail;
@@ -1912,7 +1911,7 @@ no_coalesce:
         * to reduce memory overhead, so add a little headroom here.
         * Few sockets backlog are possibly concurrently non empty.
         */
-       limit += 64*1024;
+       limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf) + 64*1024;
 
        if (unlikely(sk_add_backlog(sk, skb, limit))) {
                bh_unlock_sock(sk);
@@ -1972,8 +1971,10 @@ int tcp_v4_rcv(struct sk_buff *skb)
        const struct tcphdr *th;
        bool refcounted;
        struct sock *sk;
+       int drop_reason;
        int ret;
 
+       drop_reason = SKB_DROP_REASON_NOT_SPECIFIED;
        if (skb->pkt_type != PACKET_HOST)
                goto discard_it;
 
@@ -1985,8 +1986,10 @@ int tcp_v4_rcv(struct sk_buff *skb)
 
        th = (const struct tcphdr *)skb->data;
 
-       if (unlikely(th->doff < sizeof(struct tcphdr) / 4))
+       if (unlikely(th->doff < sizeof(struct tcphdr) / 4)) {
+               drop_reason = SKB_DROP_REASON_PKT_TOO_SMALL;
                goto bad_packet;
+       }
        if (!pskb_may_pull(skb, th->doff * 4))
                goto discard_it;
 
@@ -2091,8 +2094,10 @@ process:
 
        nf_reset_ct(skb);
 
-       if (tcp_filter(sk, skb))
+       if (tcp_filter(sk, skb)) {
+               drop_reason = SKB_DROP_REASON_TCP_FILTER;
                goto discard_and_relse;
+       }
        th = (const struct tcphdr *)skb->data;
        iph = ip_hdr(skb);
        tcp_v4_fill_cb(skb, iph, th);
@@ -2106,6 +2111,7 @@ process:
 
        sk_incoming_cpu_update(sk);
 
+       sk_defer_free_flush(sk);
        bh_lock_sock_nested(sk);
        tcp_segs_in(tcp_sk(sk), skb);
        ret = 0;
@@ -2124,6 +2130,7 @@ put_and_return:
        return ret;
 
 no_tcp_socket:
+       drop_reason = SKB_DROP_REASON_NO_SOCKET;
        if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
                goto discard_it;
 
@@ -2131,6 +2138,7 @@ no_tcp_socket:
 
        if (tcp_checksum_complete(skb)) {
 csum_error:
+               drop_reason = SKB_DROP_REASON_TCP_CSUM;
                trace_tcp_bad_csum(skb);
                __TCP_INC_STATS(net, TCP_MIB_CSUMERRORS);
 bad_packet:
@@ -2141,7 +2149,7 @@ bad_packet:
 
 discard_it:
        /* Discard frame. */
-       kfree_skb(skb);
+       kfree_skb_reason(skb, drop_reason);
        return 0;
 
 discard_and_relse:
@@ -2994,7 +3002,7 @@ static unsigned short seq_file_family(const struct seq_file *seq)
 #endif
 
        /* Iterated from proc fs */
-       afinfo = PDE_DATA(file_inode(seq->file));
+       afinfo = pde_data(file_inode(seq->file));
        return afinfo->family;
 }
 
@@ -3076,6 +3084,7 @@ struct proto tcp_prot = {
        .hash                   = inet_hash,
        .unhash                 = inet_unhash,
        .get_port               = inet_csk_get_port,
+       .put_port               = inet_put_port,
 #ifdef CONFIG_BPF_SYSCALL
        .psock_update_sk_prot   = tcp_bpf_update_proto,
 #endif