aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/qeth_core.h
diff options
context:
space:
mode:
authorJulian Wiedmann <jwi@linux.vnet.ibm.com>2018-04-26 09:42:17 +0200
committerDavid S. Miller <davem@davemloft.net>2018-04-27 13:38:48 -0400
commit6195b936610018d11bbb67bd97158d50bdaa2767 (patch)
tree965e5e22194e5add2cd4c8635a5abaf76d2e14a2 /drivers/s390/net/qeth_core.h
parents390/qeth: de-indent else after return (diff)
downloadlinux-dev-6195b936610018d11bbb67bd97158d50bdaa2767.tar.xz
linux-dev-6195b936610018d11bbb67bd97158d50bdaa2767.zip
s390/qeth: extract csum offload helpers
This consolidates the checksum offload code that was duplicated over the two qeth subdrivers. Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390/net/qeth_core.h')
-rw-r--r--drivers/s390/net/qeth_core.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 6d7a72da71dd..a8114758075f 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -864,6 +864,27 @@ static inline int qeth_get_ip_version(struct sk_buff *skb)
}
}
+static inline void qeth_rx_csum(struct qeth_card *card, struct sk_buff *skb,
+ u8 flags)
+{
+ if ((card->dev->features & NETIF_F_RXCSUM) &&
+ (flags & QETH_HDR_EXT_CSUM_HDR_REQ) &&
+ (flags & QETH_HDR_EXT_CSUM_TRANSP_REQ))
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ else
+ skb->ip_summed = CHECKSUM_NONE;
+}
+
+static inline void qeth_tx_csum(struct sk_buff *skb, u8 *flags)
+{
+ *flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ;
+ if (ip_hdr(skb)->protocol == IPPROTO_UDP)
+ *flags |= QETH_HDR_EXT_UDP;
+ /* some HW requires combined L3+L4 csum offload: */
+ *flags |= QETH_HDR_EXT_CSUM_HDR_REQ;
+ ip_hdr(skb)->check = 0;
+}
+
static inline void qeth_put_buffer_pool_entry(struct qeth_card *card,
struct qeth_buffer_pool_entry *entry)
{