Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352111
b: refs/heads/master
c: 12b0004
h: refs/heads/master
i:
  352109: 0470468
  352107: c5ac31b
  352103: 158ed73
  352095: 050cf89
v: v3
  • Loading branch information
Cong Wang authored and David S. Miller committed Feb 6, 2013
1 parent b237051 commit 63b55a4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 25060d8f3f2c21daadb4fc1fb0e37ce2c992e30b
refs/heads/master: 12b0004d1d1e2a9aa667412d479041e403bcafae
11 changes: 9 additions & 2 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -2662,8 +2662,15 @@ extern int netdev_master_upper_dev_link(struct net_device *dev,
extern void netdev_upper_dev_unlink(struct net_device *dev,
struct net_device *upper_dev);
extern int skb_checksum_help(struct sk_buff *skb);
extern struct sk_buff *skb_gso_segment(struct sk_buff *skb,
netdev_features_t features);
extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
netdev_features_t features, bool tx_path);

static inline
struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
{
return __skb_gso_segment(skb, features, true);
}

#ifdef CONFIG_BUG
extern void netdev_rx_csum_fault(struct net_device *dev);
#else
Expand Down
21 changes: 16 additions & 5 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2327,18 +2327,29 @@ int skb_checksum_help(struct sk_buff *skb)
}
EXPORT_SYMBOL(skb_checksum_help);

/* openvswitch calls this on rx path, so we need a different check.
*/
static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
{
if (tx_path)
return skb->ip_summed != CHECKSUM_PARTIAL;
else
return skb->ip_summed == CHECKSUM_NONE;
}

/**
* skb_gso_segment - Perform segmentation on skb.
* __skb_gso_segment - Perform segmentation on skb.
* @skb: buffer to segment
* @features: features for the output path (see dev->features)
* @tx_path: whether it is called in TX path
*
* This function segments the given skb and returns a list of segments.
*
* It may return NULL if the skb requires no segmentation. This is
* only possible when GSO is used for verifying header integrity.
*/
struct sk_buff *skb_gso_segment(struct sk_buff *skb,
netdev_features_t features)
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
netdev_features_t features, bool tx_path)
{
struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
struct packet_offload *ptype;
Expand All @@ -2361,7 +2372,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb,
skb->mac_len = skb->network_header - skb->mac_header;
__skb_pull(skb, skb->mac_len);

if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
if (unlikely(skb_needs_check(skb, tx_path))) {
skb_warn_bad_offload(skb);

if (skb_header_cloned(skb) &&
Expand Down Expand Up @@ -2390,7 +2401,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb,

return segs;
}
EXPORT_SYMBOL(skb_gso_segment);
EXPORT_SYMBOL(__skb_gso_segment);

/* Take action when hardware reception checksum errors are detected. */
#ifdef CONFIG_BUG
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/openvswitch/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ static int queue_gso_packets(struct net *net, int dp_ifindex,
struct sk_buff *segs, *nskb;
int err;

segs = skb_gso_segment(skb, NETIF_F_SG | NETIF_F_HW_CSUM);
segs = __skb_gso_segment(skb, NETIF_F_SG | NETIF_F_HW_CSUM, false);
if (IS_ERR(segs))
return PTR_ERR(segs);

Expand Down

0 comments on commit 63b55a4

Please sign in to comment.