llc: avoid skb_clone() if there is only one handler
Signed-off-by: Changli Gao <xiaosuo@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9850767201
commit
696ea472e1
@ -181,25 +181,26 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||||||
* LLC functionality
|
* LLC functionality
|
||||||
*/
|
*/
|
||||||
rcv = rcu_dereference(sap->rcv_func);
|
rcv = rcu_dereference(sap->rcv_func);
|
||||||
if (rcv) {
|
|
||||||
struct sk_buff *cskb = skb_clone(skb, GFP_ATOMIC);
|
|
||||||
if (cskb)
|
|
||||||
rcv(cskb, dev, pt, orig_dev);
|
|
||||||
}
|
|
||||||
dest = llc_pdu_type(skb);
|
dest = llc_pdu_type(skb);
|
||||||
if (unlikely(!dest || !llc_type_handlers[dest - 1]))
|
if (unlikely(!dest || !llc_type_handlers[dest - 1])) {
|
||||||
goto drop_put;
|
if (rcv)
|
||||||
llc_type_handlers[dest - 1](sap, skb);
|
rcv(skb, dev, pt, orig_dev);
|
||||||
out_put:
|
else
|
||||||
|
kfree_skb(skb);
|
||||||
|
} else {
|
||||||
|
if (rcv) {
|
||||||
|
struct sk_buff *cskb = skb_clone(skb, GFP_ATOMIC);
|
||||||
|
if (cskb)
|
||||||
|
rcv(cskb, dev, pt, orig_dev);
|
||||||
|
}
|
||||||
|
llc_type_handlers[dest - 1](sap, skb);
|
||||||
|
}
|
||||||
llc_sap_put(sap);
|
llc_sap_put(sap);
|
||||||
out:
|
out:
|
||||||
return 0;
|
return 0;
|
||||||
drop:
|
drop:
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
goto out;
|
goto out;
|
||||||
drop_put:
|
|
||||||
kfree_skb(skb);
|
|
||||||
goto out_put;
|
|
||||||
handle_station:
|
handle_station:
|
||||||
if (!llc_station_handler)
|
if (!llc_station_handler)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
Loading…
Reference in New Issue
Block a user