diff options
author | Robert Mustacchi <rm@fingolfin.org> | 2021-01-12 22:45:01 -0800 |
---|---|---|
committer | Robert Mustacchi <rm@fingolfin.org> | 2021-02-24 12:14:51 -0800 |
commit | d75c60626217c1d02658d48c8cabf81bd44c6729 (patch) | |
tree | ca9e5f449134389a2bfb8ead70ecdb16fada115b /usr/src/uts | |
parent | 67ba9ac97cfcbc2368432da6d6d5cc1eb888fda3 (diff) | |
download | illumos-joyent-d75c60626217c1d02658d48c8cabf81bd44c6729.tar.gz |
13449 cxgbe IPv6 checksum and LSO support
Reviewed by: Ryan Zezeski <ryan@oxide.computer>
Reviewed by: Paul Winder <paul@winder.uk.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/uts')
-rw-r--r-- | usr/src/uts/common/io/cxgbe/t4nex/t4_mac.c | 8 | ||||
-rw-r--r-- | usr/src/uts/common/io/cxgbe/t4nex/t4_sge.c | 31 |
2 files changed, 29 insertions, 10 deletions
diff --git a/usr/src/uts/common/io/cxgbe/t4nex/t4_mac.c b/usr/src/uts/common/io/cxgbe/t4nex/t4_mac.c index 9b4ffd8325..7dbd90089a 100644 --- a/usr/src/uts/common/io/cxgbe/t4nex/t4_mac.c +++ b/usr/src/uts/common/io/cxgbe/t4nex/t4_mac.c @@ -22,6 +22,7 @@ /* * Copyright 2020 RackTop Systems, Inc. + * Copyright 2021 Oxide Computer Company */ #include <sys/ddi.h> @@ -867,7 +868,8 @@ t4_mc_getcapab(void *arg, mac_capab_t cap, void *data) case MAC_CAPAB_HCKSUM: if (pi->features & CXGBE_HW_CSUM) { uint32_t *d = data; - *d = HCKSUM_INET_FULL_V4 | HCKSUM_IPHDRCKSUM; + *d = HCKSUM_INET_FULL_V4 | HCKSUM_IPHDRCKSUM | + HCKSUM_INET_FULL_V6; } else status = B_FALSE; break; @@ -878,8 +880,10 @@ t4_mc_getcapab(void *arg, mac_capab_t cap, void *data) pi->features & CXGBE_HW_CSUM) { mac_capab_lso_t *d = data; - d->lso_flags = LSO_TX_BASIC_TCP_IPV4; + d->lso_flags = LSO_TX_BASIC_TCP_IPV4 | + LSO_TX_BASIC_TCP_IPV6; d->lso_basic_tcp_ipv4.lso_max = 65535; + d->lso_basic_tcp_ipv6.lso_max = 65535; } else status = B_FALSE; break; diff --git a/usr/src/uts/common/io/cxgbe/t4nex/t4_sge.c b/usr/src/uts/common/io/cxgbe/t4nex/t4_sge.c index 2f7856bd5e..3ec695dfbe 100644 --- a/usr/src/uts/common/io/cxgbe/t4nex/t4_sge.c +++ b/usr/src/uts/common/io/cxgbe/t4nex/t4_sge.c @@ -20,6 +20,10 @@ * release for licensing terms and conditions. */ +/* + * Copyright 2021 Oxide Computer Company + */ + #include <sys/ddi.h> #include <sys/sunddi.h> #include <sys/sunndi.h> @@ -2900,23 +2904,34 @@ write_txpkt_wr(struct port_info *pi, struct sge_txq *txq, mblk_t *m, wr->r3 = 0; if (txinfo->flags & HW_LSO) { + uint16_t etype; struct cpl_tx_pkt_lso_core *lso = (void *)(wr + 1); char *p = (void *)m->b_rptr; ctrl = V_LSO_OPCODE((u32)CPL_TX_PKT_LSO) | F_LSO_FIRST_SLICE | F_LSO_LAST_SLICE; - /* LINTED: E_BAD_PTR_CAST_ALIGN */ - if (((struct ether_header *)p)->ether_type == - htons(ETHERTYPE_VLAN)) { + etype = ntohs(((struct ether_header *)p)->ether_type); + if (etype == ETHERTYPE_VLAN) { ctrl |= V_LSO_ETHHDR_LEN(1); + etype = ntohs(((struct ether_vlan_header *)p)->ether_type); p += sizeof (struct ether_vlan_header); - } else + } else { p += sizeof (struct ether_header); + } + + switch (etype) { + case ETHERTYPE_IP: + ctrl |= V_LSO_IPHDR_LEN(IPH_HDR_LENGTH(p) / 4); + p += IPH_HDR_LENGTH(p); + break; + case ETHERTYPE_IPV6: + ctrl |= F_LSO_IPV6; + ctrl |= V_LSO_IPHDR_LEN(sizeof (ip6_t) / 4); + p += sizeof (ip6_t); + default: + break; + } - /* LINTED: E_BAD_PTR_CAST_ALIGN for IPH_HDR_LENGTH() */ - ctrl |= V_LSO_IPHDR_LEN(IPH_HDR_LENGTH(p) / 4); - /* LINTED: E_BAD_PTR_CAST_ALIGN for IPH_HDR_LENGTH() */ - p += IPH_HDR_LENGTH(p); ctrl |= V_LSO_TCPHDR_LEN(TCP_HDR_LENGTH((tcph_t *)p) / 4); lso->lso_ctrl = cpu_to_be32(ctrl); |