diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-12-06 05:36:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-09 20:23:33 -0500 |
commit | 4262e5ccbbb5171abd2921eed16ed339633d6478 (patch) | |
tree | 20b11bfb690a4ab70c726f81a1f0826eb5a939f0 | |
parent | 34f9f437104b86f6ddfa2770e2cd852846385dc3 (diff) |
net: dev: move inline skb_needs_linearize helper to header
As we need it elsewhere, move the inline helper function of
skb_needs_linearize() over to skbuff.h include file. While
at it, also convert the return to 'bool' instead of 'int'
and add a proper kernel doc.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/skbuff.h | 18 | ||||
-rw-r--r-- | net/core/dev.c | 15 |
2 files changed, 18 insertions, 15 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 215b5ea1cb30..77c7aae1c6b2 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -2392,6 +2392,24 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | |||
2392 | return buffer; | 2392 | return buffer; |
2393 | } | 2393 | } |
2394 | 2394 | ||
2395 | /** | ||
2396 | * skb_needs_linearize - check if we need to linearize a given skb | ||
2397 | * depending on the given device features. | ||
2398 | * @skb: socket buffer to check | ||
2399 | * @features: net device features | ||
2400 | * | ||
2401 | * Returns true if either: | ||
2402 | * 1. skb has frag_list and the device doesn't support FRAGLIST, or | ||
2403 | * 2. skb is fragmented and the device does not support SG. | ||
2404 | */ | ||
2405 | static inline bool skb_needs_linearize(struct sk_buff *skb, | ||
2406 | netdev_features_t features) | ||
2407 | { | ||
2408 | return skb_is_nonlinear(skb) && | ||
2409 | ((skb_has_frag_list(skb) && !(features & NETIF_F_FRAGLIST)) || | ||
2410 | (skb_shinfo(skb)->nr_frags && !(features & NETIF_F_SG))); | ||
2411 | } | ||
2412 | |||
2395 | static inline void skb_copy_from_linear_data(const struct sk_buff *skb, | 2413 | static inline void skb_copy_from_linear_data(const struct sk_buff *skb, |
2396 | void *to, | 2414 | void *to, |
2397 | const unsigned int len) | 2415 | const unsigned int len) |
diff --git a/net/core/dev.c b/net/core/dev.c index 6cc98dd49c7a..355df36360b4 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2535,21 +2535,6 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) | |||
2535 | } | 2535 | } |
2536 | EXPORT_SYMBOL(netif_skb_features); | 2536 | EXPORT_SYMBOL(netif_skb_features); |
2537 | 2537 | ||
2538 | /* | ||
2539 | * Returns true if either: | ||
2540 | * 1. skb has frag_list and the device doesn't support FRAGLIST, or | ||
2541 | * 2. skb is fragmented and the device does not support SG. | ||
2542 | */ | ||
2543 | static inline int skb_needs_linearize(struct sk_buff *skb, | ||
2544 | netdev_features_t features) | ||
2545 | { | ||
2546 | return skb_is_nonlinear(skb) && | ||
2547 | ((skb_has_frag_list(skb) && | ||
2548 | !(features & NETIF_F_FRAGLIST)) || | ||
2549 | (skb_shinfo(skb)->nr_frags && | ||
2550 | !(features & NETIF_F_SG))); | ||
2551 | } | ||
2552 | |||
2553 | int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | 2538 | int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, |
2554 | struct netdev_queue *txq, void *accel_priv) | 2539 | struct netdev_queue *txq, void *accel_priv) |
2555 | { | 2540 | { |