mirror of https://gitee.com/openkylin/linux.git
net: remove redundant code
eth_type_trans(skb, netdev) does the "skb->dev = netdev;" initialization, we can remove it from various network drivers. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e446630c96
commit
b05b7d9563
|
@ -743,7 +743,6 @@ static void netdev_rx(struct net_device *dev)
|
|||
return;
|
||||
}
|
||||
|
||||
skb->dev = dev;
|
||||
skb_reserve(skb, 2);
|
||||
skb_put(skb, length);
|
||||
skb_copy_to_linear_data(skb, data, length);
|
||||
|
|
|
@ -1817,7 +1817,6 @@ static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, u8 que,
|
|||
atl1c_clean_rfd(rfd_ring, rrs, rfd_num);
|
||||
skb_put(skb, length - ETH_FCS_LEN);
|
||||
skb->protocol = eth_type_trans(skb, netdev);
|
||||
skb->dev = netdev;
|
||||
atl1c_rx_checksum(adapter, skb, rrs);
|
||||
if (unlikely(adapter->vlgrp) && rrs->word3 & RRS_VLAN_INS) {
|
||||
u16 vlan;
|
||||
|
|
|
@ -1428,7 +1428,6 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
|
|||
"Memory squeeze, deferring packet\n");
|
||||
goto skip_pkt;
|
||||
}
|
||||
skb->dev = netdev;
|
||||
memcpy(skb->data, (u8 *)(prrs + 1), packet_size);
|
||||
skb_put(skb, packet_size);
|
||||
skb->protocol = eth_type_trans(skb, netdev);
|
||||
|
|
|
@ -421,7 +421,6 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
|
|||
netdev->stats.rx_dropped++;
|
||||
break;
|
||||
}
|
||||
skb->dev = netdev;
|
||||
memcpy(skb->data, rxd->packet, rx_size);
|
||||
skb_put(skb, rx_size);
|
||||
skb->protocol = eth_type_trans(skb, netdev);
|
||||
|
|
|
@ -340,7 +340,6 @@ static int bcm_enet_receive_queue(struct net_device *dev, int budget)
|
|||
}
|
||||
|
||||
skb_put(skb, len);
|
||||
skb->dev = dev;
|
||||
skb->protocol = eth_type_trans(skb, dev);
|
||||
priv->stats.rx_packets++;
|
||||
priv->stats.rx_bytes += len;
|
||||
|
|
|
@ -826,7 +826,6 @@ static void be_rx_compl_process(struct be_adapter *adapter,
|
|||
|
||||
skb->truesize = skb->len + sizeof(struct sk_buff);
|
||||
skb->protocol = eth_type_trans(skb, adapter->netdev);
|
||||
skb->dev = adapter->netdev;
|
||||
|
||||
vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp);
|
||||
vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp);
|
||||
|
|
|
@ -435,7 +435,6 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)
|
|||
DMA_FROM_DEVICE);
|
||||
length = status & BCOM_FEC_RX_BD_LEN_MASK;
|
||||
skb_put(rskb, length - 4); /* length without CRC32 */
|
||||
rskb->dev = dev;
|
||||
rskb->protocol = eth_type_trans(rskb, dev);
|
||||
netif_rx(rskb);
|
||||
|
||||
|
|
|
@ -894,7 +894,6 @@ static int greth_rx_gbit(struct net_device *dev, int limit)
|
|||
else
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
|
||||
skb->dev = dev;
|
||||
skb->protocol = eth_type_trans(skb, dev);
|
||||
dev->stats.rx_packets++;
|
||||
netif_receive_skb(skb);
|
||||
|
|
|
@ -1699,7 +1699,6 @@ static int emac_poll_rx(void *param, int budget)
|
|||
|
||||
skb_put(skb, len);
|
||||
push_packet:
|
||||
skb->dev = dev->ndev;
|
||||
skb->protocol = eth_type_trans(skb, dev->ndev);
|
||||
emac_rx_csum(dev, skb, ctrl);
|
||||
|
||||
|
|
|
@ -801,7 +801,6 @@ static void ks_rcv(struct ks_net *ks, struct net_device *netdev)
|
|||
/* read data block including CRC 4 bytes */
|
||||
ks_read_qmu(ks, (u16 *)skb->data, frame_hdr->len);
|
||||
skb_put(skb, frame_hdr->len);
|
||||
skb->dev = netdev;
|
||||
skb->protocol = eth_type_trans(skb, netdev);
|
||||
netif_rx(skb);
|
||||
} else {
|
||||
|
|
|
@ -5043,8 +5043,6 @@ static inline int rx_proc(struct net_device *dev, struct ksz_hw* hw,
|
|||
dma_buf->skb->data, packet_len);
|
||||
} while (0);
|
||||
|
||||
skb->dev = dev;
|
||||
|
||||
skb->protocol = eth_type_trans(skb, dev);
|
||||
|
||||
if (hw->rx_cfg & (DMA_RX_CSUM_UDP | DMA_RX_CSUM_TCP))
|
||||
|
|
|
@ -396,7 +396,6 @@ static void s6gmac_rx_interrupt(struct net_device *dev)
|
|||
} else {
|
||||
skb_put(skb, (pfx >> S6_GMAC_BURST_POSTRD_LEN)
|
||||
& S6_GMAC_BURST_POSTRD_LEN_MASK);
|
||||
skb->dev = dev;
|
||||
skb->protocol = eth_type_trans(skb, dev);
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
netif_rx(skb);
|
||||
|
|
|
@ -1303,7 +1303,6 @@ static int bdx_rx_receive(struct bdx_priv *priv, struct rxd_fifo *f, int budget)
|
|||
priv->net_stats.rx_bytes += len;
|
||||
|
||||
skb_put(skb, len);
|
||||
skb->dev = priv->ndev;
|
||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
skb->protocol = eth_type_trans(skb, priv->ndev);
|
||||
|
||||
|
|
|
@ -638,7 +638,6 @@ static void xemaclite_rx_handler(struct net_device *dev)
|
|||
}
|
||||
|
||||
skb_put(skb, len); /* Tell the skb how much data we got */
|
||||
skb->dev = dev; /* Fill out required meta-data */
|
||||
|
||||
skb->protocol = eth_type_trans(skb, dev);
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
|
|
Loading…
Reference in New Issue