[PATCH] atm: introduce vcc_pop_skb()
From: Krzysztof Mazur <hidden>
Date: 2012-11-28 22:33:05
Also in:
lkml
Subsystem:
atm, networking [general], the rest · Maintainers:
Chas Williams, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
On Wed, Nov 28, 2012 at 11:10:40PM +0100, Krzysztof Mazur wrote:
On Wed, Nov 28, 2012 at 04:59:06PM -0500, chas williams - CONTRACTOR wrote:quoted
On Wed, 28 Nov 2012 22:45:34 +0100 Krzysztof Mazur [off-list ref] wrote:quoted
On Wed, Nov 28, 2012 at 04:20:01PM -0500, chas williams - CONTRACTOR wrote:quoted
i dont like the vcc->pop() implementation and at one point i had the crazy idea of using skb->destructors to handle it. however, i think it would be necessary to clone the skb's so any existing destructor is preserved.With this patch we will kill vcc->pop() in drivers and in future we can do that without changes in drivers.okquoted
quoted
quoted
+#define vcc_pop(vcc, skb) vcc_pop_any(vcc, skb) +#define vcc_pop_irq(vcc, skb) vcc_pop_any(vcc, skb)don't define these if you dont plan on using them anway.I removed them. I also added check if vcc is NULL, as David Woodhouse suggested, some drivers use that.it should probably be if (likely(vcc) && likely(vcc->pop)) since it will almost always be the case.
I think that we should also add that single-argument skb-only version. Currently it can be used only after the driver does ATM_SKB(skb)->vcc = vcc. Most drivers do that. Thanks, Krzysiek -- >8 -- Subject: [PATCH] atm: introduce atm_pop_skb() Many ATM drivers store vcc in ATM_SKB(skb)->vcc and use it for freeing skbs. Now they can just use atm_pop_skb() to free such buffers. Signed-off-by: Krzysztof Mazur <redacted> --- include/linux/atmdev.h | 8 ++++++++ net/atm/common.c | 6 ++++++ 2 files changed, 14 insertions(+)
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 57bd93f..648fb79 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h@@ -291,6 +291,14 @@ void vcc_release_async(struct atm_vcc *vcc, int reply); */ void vcc_pop(struct atm_vcc *vcc, struct sk_buff *skb); +/** + * vcc_pop_skb - free transmitted ATM skb + * + * This variant of vcc_pop() assumes that ATM_SKB(skb)->vcc is set + * by driver. + */ +void vcc_pop_skb(struct sk_buff *skb); + struct atm_ioctl { struct module *owner; /* A module reference is kept if appropriate over this call.
diff --git a/net/atm/common.c b/net/atm/common.c
index c42ff62..378c911 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c@@ -663,6 +663,12 @@ void vcc_pop(struct atm_vcc *vcc, struct sk_buff *skb) } EXPORT_SYMBOL(vcc_pop); +void vcc_pop_skb(struct sk_buff *skb) +{ + vcc_pop(ATM_SKB(skb)->vcc, skb); +} +EXPORT_SYMBOL(vcc_pop_skb); + unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk;
--
1.8.0.411.g71a7da8