1 // SPDX-License-Identifier: GPL-2.0 2 /* net/atm/atm_misc.c - Various functions for use by ATM drivers */ 3 4 /* Written 1995-2000 by Werner Almesberger, EPFL ICA */ 5 6 #include <linux/module.h> 7 #include <linux/atm.h> 8 #include <linux/atmdev.h> 9 #include <linux/skbuff.h> 10 #include <linux/bitops.h> 11 #include <linux/errno.h> 12 #include <linux/atomic.h> 13 atm_charge(struct atm_vcc * vcc,int truesize)14int atm_charge(struct atm_vcc *vcc, int truesize) 15 { 16 atm_force_charge(vcc, truesize); 17 if (atomic_read(&sk_atm(vcc)->sk_rmem_alloc) <= sk_atm(vcc)->sk_rcvbuf) 18 return 1; 19 atm_return(vcc, truesize); 20 atomic_inc(&vcc->stats->rx_drop); 21 return 0; 22 } 23 EXPORT_SYMBOL(atm_charge); 24