+static u32
+qeth_ethtool_get_tx_csum(struct net_device *dev)
+{
+ /* We may need to say that we support tx csum offload if
+ * we do EDDP or TSO. There are discussions going on to
+ * enforce rules in the stack and in ethtool that make
+ * SG and TSO depend on HW_CSUM. At the moment there are
+ * no such rules....
+ * If we say yes here, we have to checksum outbound packets
+ * any time. */
+ return 0;
+}
+
+static int
+qeth_ethtool_set_tx_csum(struct net_device *dev, u32 data)
+{
+ return -EINVAL;
+}
+
+static u32
+qeth_ethtool_get_rx_csum(struct net_device *dev)
+{
+ struct qeth_card *card = (struct qeth_card *)dev->priv;
+
+ return (card->options.checksum_type == HW_CHECKSUMMING);
+}
+
+static int
+qeth_ethtool_set_rx_csum(struct net_device *dev, u32 data)
+{
+ struct qeth_card *card = (struct qeth_card *)dev->priv;
+
+ if ((card->state != CARD_STATE_DOWN) &&
+ (card->state != CARD_STATE_RECOVER))
+ return -EPERM;
+ if (data)
+ card->options.checksum_type = HW_CHECKSUMMING;
+ else
+ card->options.checksum_type = SW_CHECKSUMMING;
+ return 0;
+}
+
+static u32
+qeth_ethtool_get_sg(struct net_device *dev)
+{
+ struct qeth_card *card = (struct qeth_card *)dev->priv;
+
+ return ((card->options.large_send != QETH_LARGE_SEND_NO) &&
+ (dev->features & NETIF_F_SG));
+}
+
+static int
+qeth_ethtool_set_sg(struct net_device *dev, u32 data)
+{
+ struct qeth_card *card = (struct qeth_card *)dev->priv;
+
+ if (data) {
+ if (card->options.large_send != QETH_LARGE_SEND_NO)
+ dev->features |= NETIF_F_SG;
+ else {
+ dev->features &= ~NETIF_F_SG;
+ return -EINVAL;
+ }
+ } else
+ dev->features &= ~NETIF_F_SG;
+ return 0;
+}
+
+static u32
+qeth_ethtool_get_tso(struct net_device *dev)
+{
+ struct qeth_card *card = (struct qeth_card *)dev->priv;
+
+ return ((card->options.large_send != QETH_LARGE_SEND_NO) &&
+ (dev->features & NETIF_F_TSO));
+}
+
+static int
+qeth_ethtool_set_tso(struct net_device *dev, u32 data)
+{
+ struct qeth_card *card = (struct qeth_card *)dev->priv;
+
+ if (data) {
+ if (card->options.large_send != QETH_LARGE_SEND_NO)
+ dev->features |= NETIF_F_TSO;
+ else {
+ dev->features &= ~NETIF_F_TSO;
+ return -EINVAL;
+ }
+ } else
+ dev->features &= ~NETIF_F_TSO;
+ return 0;
+}
+
+static struct ethtool_ops qeth_ethtool_ops = {
+ .get_tx_csum = qeth_ethtool_get_tx_csum,
+ .set_tx_csum = qeth_ethtool_set_tx_csum,
+ .get_rx_csum = qeth_ethtool_get_rx_csum,
+ .set_rx_csum = qeth_ethtool_set_rx_csum,
+ .get_sg = qeth_ethtool_get_sg,
+ .set_sg = qeth_ethtool_set_sg,
+ .get_tso = qeth_ethtool_get_tso,
+ .set_tso = qeth_ethtool_set_tso,
+};
+
+static int
+qeth_hard_header_parse(struct sk_buff *skb, unsigned char *haddr)
+{
+ struct qeth_card *card;
+ struct ethhdr *eth;
+
+ card = qeth_get_card_from_dev(skb->dev);
+ if (card->options.layer2)
+ goto haveheader;
+#ifdef CONFIG_QETH_IPV6
+ /* cause of the manipulated arp constructor and the ARP
+ flag for OSAE devices we have some nasty exceptions */
+ if (card->info.type == QETH_CARD_TYPE_OSAE) {
+ if (!card->options.fake_ll) {
+ if ((skb->pkt_type==PACKET_OUTGOING) &&
+ (skb->protocol==ETH_P_IPV6))
+ goto haveheader;
+ else
+ return 0;
+ } else {
+ if ((skb->pkt_type==PACKET_OUTGOING) &&
+ (skb->protocol==ETH_P_IP))
+ return 0;
+ else
+ goto haveheader;
+ }
+ }
+#endif
+ if (!card->options.fake_ll)
+ return 0;
+haveheader:
+ eth = eth_hdr(skb);
+ memcpy(haddr, eth->h_source, ETH_ALEN);
+ return ETH_ALEN;
+}
+