atm: eliminate atm_guess_pdu2truesize()
authorchas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tue, 22 Nov 2011 12:51:56 +0000 (12:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Nov 2011 21:40:30 +0000 (16:40 -0500)
Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/atm/iphase.c
include/linux/atmdev.h
net/atm/atm_misc.c

index 3d0c2b0fed9cefcdd724487a9e9af00af1fd61d4..9e373ba203082f8bc0cb5757a011a3efccf7b291 100644 (file)
@@ -1320,8 +1320,8 @@ static void rx_dle_intr(struct atm_dev *dev)
           if (ia_vcc == NULL)
           {
              atomic_inc(&vcc->stats->rx_err);
+             atm_return(vcc, skb->truesize);
              dev_kfree_skb_any(skb);
-             atm_return(vcc, atm_guess_pdu2truesize(len));
              goto INCR_DLE;
            }
           // get real pkt length  pwang_test
@@ -1334,8 +1334,8 @@ static void rx_dle_intr(struct atm_dev *dev)
              atomic_inc(&vcc->stats->rx_err);
              IF_ERR(printk("rx_dle_intr: Bad  AAL5 trailer %d (skb len %d)", 
                                                             length, skb->len);)
+             atm_return(vcc, skb->truesize);
              dev_kfree_skb_any(skb);
-             atm_return(vcc, atm_guess_pdu2truesize(len));
              goto INCR_DLE;
           }
           skb_trim(skb, length);
index 43ea1b2de3ee52a7d9527dc8afe193ff7fe2e2fb..f4ff882cb2daa864d5e0e0c318783229ebf5d9f5 100644 (file)
@@ -445,16 +445,6 @@ void vcc_insert_socket(struct sock *sk);
 
 void atm_dev_release_vccs(struct atm_dev *dev);
 
-/*
- * This is approximately the algorithm used by alloc_skb.
- *
- */
-
-static inline int atm_guess_pdu2truesize(int size)
-{
-       return SKB_TRUESIZE(size);
-}
-
 
 static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
 {
index f41f02656ff41a18adefdcf33423b15c1aed785f..876fbe83e2e4db5ded907ea9938c435edc059e0c 100644 (file)
@@ -26,7 +26,7 @@ struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc, int pdu_size,
                                 gfp_t gfp_flags)
 {
        struct sock *sk = sk_atm(vcc);
-       int guess = atm_guess_pdu2truesize(pdu_size);
+       int guess = SKB_TRUESIZE(pdu_size);
 
        atm_force_charge(vcc, guess);
        if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf) {