Commit 3f705f73 authored by David S. Miller's avatar David S. Miller

Merge branch 'skb_cow_head'

Francois Romieu says:

====================
remove open-coded skb_cow_head.

As per http://marc.info/?l=linux-netdev&m=139440579104701.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c3f0dd38 b06626b8
...@@ -1973,17 +1973,17 @@ static int atl1c_tso_csum(struct atl1c_adapter *adapter, ...@@ -1973,17 +1973,17 @@ static int atl1c_tso_csum(struct atl1c_adapter *adapter,
enum atl1c_trans_queue type) enum atl1c_trans_queue type)
{ {
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
unsigned short offload_type;
u8 hdr_len; u8 hdr_len;
u32 real_len; u32 real_len;
unsigned short offload_type;
int err;
if (skb_is_gso(skb)) { if (skb_is_gso(skb)) {
if (skb_header_cloned(skb)) { int err;
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (unlikely(err)) err = skb_cow_head(skb, 0);
return -1; if (err < 0)
} return err;
offload_type = skb_shinfo(skb)->gso_type; offload_type = skb_shinfo(skb)->gso_type;
if (offload_type & SKB_GSO_TCPV4) { if (offload_type & SKB_GSO_TCPV4) {
......
...@@ -1641,17 +1641,17 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *skb) ...@@ -1641,17 +1641,17 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *skb)
static int atl1e_tso_csum(struct atl1e_adapter *adapter, static int atl1e_tso_csum(struct atl1e_adapter *adapter,
struct sk_buff *skb, struct atl1e_tpd_desc *tpd) struct sk_buff *skb, struct atl1e_tpd_desc *tpd)
{ {
unsigned short offload_type;
u8 hdr_len; u8 hdr_len;
u32 real_len; u32 real_len;
unsigned short offload_type;
int err;
if (skb_is_gso(skb)) { if (skb_is_gso(skb)) {
if (skb_header_cloned(skb)) { int err;
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (unlikely(err)) err = skb_cow_head(skb, 0);
return -1; if (err < 0)
} return err;
offload_type = skb_shinfo(skb)->gso_type; offload_type = skb_shinfo(skb)->gso_type;
if (offload_type & SKB_GSO_TCPV4) { if (offload_type & SKB_GSO_TCPV4) {
......
...@@ -2118,18 +2118,17 @@ static u16 atl1_tpd_avail(struct atl1_tpd_ring *tpd_ring) ...@@ -2118,18 +2118,17 @@ static u16 atl1_tpd_avail(struct atl1_tpd_ring *tpd_ring)
} }
static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
struct tx_packet_desc *ptpd) struct tx_packet_desc *ptpd)
{ {
u8 hdr_len, ip_off; u8 hdr_len, ip_off;
u32 real_len; u32 real_len;
int err;
if (skb_shinfo(skb)->gso_size) { if (skb_shinfo(skb)->gso_size) {
if (skb_header_cloned(skb)) { int err;
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (unlikely(err)) err = skb_cow_head(skb, 0);
return -1; if (err < 0)
} return err;
if (skb->protocol == htons(ETH_P_IP)) { if (skb->protocol == htons(ETH_P_IP)) {
struct iphdr *iph = ip_hdr(skb); struct iphdr *iph = ip_hdr(skb);
...@@ -2175,7 +2174,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, ...@@ -2175,7 +2174,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
return 3; return 3;
} }
} }
return false; return 0;
} }
static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb, static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb,
......
...@@ -7918,8 +7918,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -7918,8 +7918,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
struct iphdr *iph; struct iphdr *iph;
u32 tcp_opt_len, hdr_len; u32 tcp_opt_len, hdr_len;
if (skb_header_cloned(skb) && if (skb_cow_head(skb, 0))
pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
goto drop; goto drop;
iph = ip_hdr(skb); iph = ip_hdr(skb);
......
...@@ -2496,12 +2496,10 @@ bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb) ...@@ -2496,12 +2496,10 @@ bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb)
{ {
int err; int err;
if (skb_header_cloned(skb)) { err = skb_cow_head(skb, 0);
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); if (err < 0) {
if (err) { BNAD_UPDATE_CTR(bnad, tso_err);
BNAD_UPDATE_CTR(bnad, tso_err); return err;
return err;
}
} }
/* /*
......
...@@ -2053,19 +2053,6 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx) ...@@ -2053,19 +2053,6 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx)
} }
static int
jme_expand_header(struct jme_adapter *jme, struct sk_buff *skb)
{
if (unlikely(skb_shinfo(skb)->gso_size &&
skb_header_cloned(skb) &&
pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) {
dev_kfree_skb_any(skb);
return -1;
}
return 0;
}
static int static int
jme_tx_tso(struct sk_buff *skb, __le16 *mss, u8 *flags) jme_tx_tso(struct sk_buff *skb, __le16 *mss, u8 *flags)
{ {
...@@ -2225,7 +2212,8 @@ jme_start_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -2225,7 +2212,8 @@ jme_start_xmit(struct sk_buff *skb, struct net_device *netdev)
struct jme_adapter *jme = netdev_priv(netdev); struct jme_adapter *jme = netdev_priv(netdev);
int idx; int idx;
if (unlikely(jme_expand_header(jme, skb))) { if (unlikely(skb_is_gso(skb) && skb_cow_head(skb, 0))) {
dev_kfree_skb_any(skb);
++(NET_STAT(jme).tx_dropped); ++(NET_STAT(jme).tx_dropped);
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
......
...@@ -2556,11 +2556,10 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) ...@@ -2556,11 +2556,10 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr)
if (skb_is_gso(skb)) { if (skb_is_gso(skb)) {
int err; int err;
if (skb_header_cloned(skb)) {
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); err = skb_cow_head(skb, 0);
if (err) if (err < 0)
return err; return err;
}
mac_iocb_ptr->opcode = OPCODE_OB_MAC_TSO_IOCB; mac_iocb_ptr->opcode = OPCODE_OB_MAC_TSO_IOCB;
mac_iocb_ptr->flags3 |= OB_MAC_TSO_IOCB_IC; mac_iocb_ptr->flags3 |= OB_MAC_TSO_IOCB_IC;
......
...@@ -374,8 +374,7 @@ netdev_tx_t i2400m_hard_start_xmit(struct sk_buff *skb, ...@@ -374,8 +374,7 @@ netdev_tx_t i2400m_hard_start_xmit(struct sk_buff *skb,
d_fnstart(3, dev, "(skb %p net_dev %p)\n", skb, net_dev); d_fnstart(3, dev, "(skb %p net_dev %p)\n", skb, net_dev);
if (skb_header_cloned(skb) && if (skb_cow_head(skb, 0))
pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
goto drop; goto drop;
if (i2400m->state == I2400M_SS_IDLE) if (i2400m->state == I2400M_SS_IDLE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment