@@ -36,7 +36,6 @@ struct veth_net_stats {
3636struct veth_priv {
3737 struct net_device * peer ;
3838 struct veth_net_stats __percpu * stats ;
39- unsigned ip_summed ;
4039};
4140
4241/*
@@ -99,47 +98,10 @@ static void veth_get_ethtool_stats(struct net_device *dev,
9998 data [0 ] = priv -> peer -> ifindex ;
10099}
101100
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-
133101static const struct ethtool_ops veth_ethtool_ops = {
134102 .get_settings = veth_get_settings ,
135103 .get_drvinfo = veth_get_drvinfo ,
136104 .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 ,
143105 .get_strings = veth_get_strings ,
144106 .get_sset_count = veth_get_sset_count ,
145107 .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)
168130
169131 /* don't change ip_summed == CHECKSUM_PARTIAL, as that
170132 will cause bad checksum on forwarded packets */
171- if (skb -> ip_summed == CHECKSUM_NONE )
172- skb -> ip_summed = rcv_priv -> ip_summed ;
133+ if (skb -> ip_summed == CHECKSUM_NONE &&
134+ rcv -> features & NETIF_F_RXCSUM )
135+ skb -> ip_summed = CHECKSUM_UNNECESSARY ;
173136
174137 length = skb -> len ;
175138 if (dev_forward_skb (rcv , skb ) != NET_RX_SUCCESS )
@@ -304,6 +267,8 @@ static void veth_setup(struct net_device *dev)
304267 dev -> ethtool_ops = & veth_ethtool_ops ;
305268 dev -> features |= NETIF_F_LLTX ;
306269 dev -> destructor = veth_dev_free ;
270+
271+ dev -> hw_features = NETIF_F_NO_CSUM | NETIF_F_SG | NETIF_F_RXCSUM ;
307272}
308273
309274/*
0 commit comments