diff options
Diffstat (limited to 'drivers/net')
| -rw-r--r-- | drivers/net/veth.c | 45 |
1 files changed, 5 insertions, 40 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 2de9b90c5f8f..654228849951 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
| @@ -36,7 +36,6 @@ struct veth_net_stats { | |||
| 36 | struct veth_priv { | 36 | struct veth_priv { |
| 37 | struct net_device *peer; | 37 | struct net_device *peer; |
| 38 | struct veth_net_stats __percpu *stats; | 38 | struct veth_net_stats __percpu *stats; |
| 39 | unsigned ip_summed; | ||
| 40 | }; | 39 | }; |
| 41 | 40 | ||
| 42 | /* | 41 | /* |
| @@ -99,47 +98,10 @@ static void veth_get_ethtool_stats(struct net_device *dev, | |||
| 99 | data[0] = priv->peer->ifindex; | 98 | data[0] = priv->peer->ifindex; |
| 100 | } | 99 | } |
| 101 | 100 | ||
| 102 | static u32 veth_get_rx_csum(struct net_device *dev) | ||
| 103 | { | ||
| 104 | struct veth_priv *priv; | ||
| 105 | |||
| 106 | priv = netdev_priv(dev); | ||
| 107 | return priv->ip_summed == CHECKSUM_UNNECESSARY; | ||
| 108 | } | ||
| 109 | |||
| 110 | static int veth_set_rx_csum(struct net_device *dev, u32 data) | ||
| 111 | { | ||
| 112 | struct veth_priv *priv; | ||
| 113 | |||
| 114 | priv = netdev_priv(dev); | ||
| 115 | priv->ip_summed = data ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE; | ||
| 116 | return 0; | ||
| 117 | } | ||
| 118 | |||
| 119 | static u32 veth_get_tx_csum(struct net_device *dev) | ||
| 120 | { | ||
| 121 | return (dev->features & NETIF_F_NO_CSUM) != 0; | ||
| 122 | } | ||
| 123 | |||
| 124 | static int veth_set_tx_csum(struct net_device *dev, u32 data) | ||
| 125 | { | ||
| 126 | if (data) | ||
| 127 | dev->features |= NETIF_F_NO_CSUM; | ||
| 128 | else | ||
| 129 | dev->features &= ~NETIF_F_NO_CSUM; | ||
| 130 | return 0; | ||
| 131 | } | ||
| 132 | |||
| 133 | static const struct ethtool_ops veth_ethtool_ops = { | 101 | static const struct ethtool_ops veth_ethtool_ops = { |
| 134 | .get_settings = veth_get_settings, | 102 | .get_settings = veth_get_settings, |
| 135 | .get_drvinfo = veth_get_drvinfo, | 103 | .get_drvinfo = veth_get_drvinfo, |
| 136 | .get_link = ethtool_op_get_link, | 104 | .get_link = ethtool_op_get_link, |
| 137 | .get_rx_csum = veth_get_rx_csum, | ||
| 138 | .set_rx_csum = veth_set_rx_csum, | ||
| 139 | .get_tx_csum = veth_get_tx_csum, | ||
| 140 | .set_tx_csum = veth_set_tx_csum, | ||
| 141 | .get_sg = ethtool_op_get_sg, | ||
| 142 | .set_sg = ethtool_op_set_sg, | ||
| 143 | .get_strings = veth_get_strings, | 105 | .get_strings = veth_get_strings, |
| 144 | .get_sset_count = veth_get_sset_count, | 106 | .get_sset_count = veth_get_sset_count, |
| 145 | .get_ethtool_stats = veth_get_ethtool_stats, | 107 | .get_ethtool_stats = veth_get_ethtool_stats, |
| @@ -168,8 +130,9 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 168 | 130 | ||
| 169 | /* don't change ip_summed == CHECKSUM_PARTIAL, as that | 131 | /* don't change ip_summed == CHECKSUM_PARTIAL, as that |
| 170 | will cause bad checksum on forwarded packets */ | 132 | will cause bad checksum on forwarded packets */ |
| 171 | if (skb->ip_summed == CHECKSUM_NONE) | 133 | if (skb->ip_summed == CHECKSUM_NONE && |
| 172 | skb->ip_summed = rcv_priv->ip_summed; | 134 | rcv->features & NETIF_F_RXCSUM) |
| 135 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 173 | 136 | ||
| 174 | length = skb->len; | 137 | length = skb->len; |
| 175 | if (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS) | 138 | if (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS) |
| @@ -304,6 +267,8 @@ static void veth_setup(struct net_device *dev) | |||
| 304 | dev->ethtool_ops = &veth_ethtool_ops; | 267 | dev->ethtool_ops = &veth_ethtool_ops; |
| 305 | dev->features |= NETIF_F_LLTX; | 268 | dev->features |= NETIF_F_LLTX; |
| 306 | dev->destructor = veth_dev_free; | 269 | dev->destructor = veth_dev_free; |
| 270 | |||
| 271 | dev->hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM; | ||
| 307 | } | 272 | } |
| 308 | 273 | ||
| 309 | /* | 274 | /* |
