From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0073.outbound.protection.outlook.com [104.47.1.73]) by dpdk.org (Postfix) with ESMTP id 3C6392C8 for ; Sun, 22 Apr 2018 13:30:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=C3eO6JA+4q553Jso9m6BRdTNuBkA2EQ186n6Eow7q+I=; b=Er2438HmzixUycXH9yb7dxNOHDeA2v5zznoTyMaEsg2HgtQ8LJ4QKofIdWwa6k/5S9nk2N7ISUh9cDXmPIMLBeMQhMAqYocB/CG8gXTl6nQeFxFE2G+pU2azZflmb7KEh9UKa6CQf5SmkediXnSgL5mRFUhsa17/+JgPaTPMVlI= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR0501MB2311.eurprd05.prod.outlook.com (2603:10a6:4:4c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.13; Sun, 22 Apr 2018 11:30:27 +0000 From: Ophir Munk To: dev@dpdk.org, Pascal Mazon Cc: Thomas Monjalon , Olga Shern , Ophir Munk Date: Sun, 22 Apr 2018 11:30:10 +0000 Message-Id: <1524396611-22391-2-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1524396611-22391-1-git-send-email-ophirmu@mellanox.com> References: <1523313192-18048-3-git-send-email-ophirmu@mellanox.com> <1524396611-22391-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR07CA0022.eurprd07.prod.outlook.com (2603:10a6:7:67::32) To DB6PR0501MB2311.eurprd05.prod.outlook.com (2603:10a6:4:4c::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB6PR0501MB2311; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2311; 3:o6LFeOeXSqy8RsaoIKBVFpS3sJkgq7W4H3teXISmZRo3URqAtJGTTmArFdZ2MaYjweP7axwSQclIsa/fk52gyQCoGxJw18G3jzq2yTmtBVInENC1QqYJErnaPWtZ4J9x/xizUUbNSt+LNK36Tm6TFDuDJrWvIl4vhjAvKHvHkQB5oShn7+DK5tcwDOs7cWV75OonuJmQxeO/4bwITPaBFgx444L0E0rL8oHASF+FIWH79Wi4vCHUWtZO0xCEmZSy; 25:F5Hx+8RB0IqO2bK4P45cTtSurpIuE6pu40iMapru8QV3AG/CrSkDIHzh8npACTQTq6+eXGYYobjGN3Tb52C0e8BkPNHsSoJI0Ezv/a5oMPnak0DCEpyLO3+7bfmXkCpMXK0vJrfBGTWJqL49uGhg9VBM44RI5ugMLQozPcoyq3IGUlqlDWhyR8iu+PIo1kfNNovhm7sEuK6PTp7cWvyZfHModVadtg5Nui9wNBl5jrisIep2s9n2TFTK0a5CbAY0hqk5AeNjgHw4xgITfwtGsedspCN+GLq9qYuFxTayg5H66MXjP1IHo5CR08LIqrUAWUiFYflSQmUW/pjG+LWwXA==; 31:RjSxSfqcSzvTtR29L9a0B9p/YW+qBMsnOczQTU2q03jl0+fwqJ7es7XYwyBBo/EtkrUehH9FTwiW3Y1wvuQvplx6imwJwE+npzbDMFfAKRkavaMW8/kIrLlIOrAwPH947maDESHNXXwaMmVIT3TYMPewFGG5YzjBvtT3ZX1oiblt/i3aDF2lqkqKzjy4w8vycgDoALf93PxcWBk1fW9Uym9o+BJ6GTSQiyRvIn5uY+4= X-MS-TrafficTypeDiagnostic: DB6PR0501MB2311: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2311; 20:6MivejKcDk4KQ1VFtIqbsWVAIej4JOz4ITBfG7tho2o4Zs6Nn+U+jR/gEJujydlUcAsF23+9wgpnMnAYLLQojnX4BK9ZGKrpIE+5o31D156Co82YBuX+m6710BHZQDG23dx069m+54WzMpK4p9zhpxh7ZkwEwPKMf1CpKfW/KryXCz788NBNAcHzQMZrEueo2h+mmpxb9YZ4eYB8YwPb4Q3/UVWKmJG9f/RVnA0osCIawZy2U4eYEWMzQP3N3Z91eXyxPao4nZuuadvVMi32oI7Y87UDIWwqnVwmuvfRHHVdBZxohHpVvxzP6yUMjnS1ech6OdkA7xii2klW2f0SK2mCi7s/LNp+XqXw3sDTnKbXOWs1dVC4doKN2SeT68vmQqvMqP5JZSLirmk+Qmf89CACbEiXlEHMQHSVQjsDlUhDRgxR7Qc7lFGAeDm6c1hGkTVgJEfVQC1HtP5F5UuVHTTmucxhLektZWJ+oQ/eWWiNp8RuqoJQ0Joo3oeXJnCX; 4:r2RWDQr1Am5Bdy/eg+HECJxNlITeqSWd3ibs6MFeEAMthccNW9B4hzHkT0e4VLxNvDH/u0Cgi5tXfrc+x5rAgMnd6lwirlc0lVLWssXTckLu3RmAuSDydajV28e4vgr8ybG6wiUbZdKE5wxt0AEbifOSdYzOrrRv/WRrEgnkYXS6oJqIlBTJjwFC/dyAMVps7HXuX75n7XHMK24lRSkU2VzzZGTga4C1GvRSV1ZZnR86GSWxJgEFEDRUa44hKF4lzVzbpmI4kwuj2QzzD5Smvg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231232)(944501410)(52105095)(93006095)(93001095)(6055026)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:DB6PR0501MB2311; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2311; X-Forefront-PRVS: 0650714AAA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(366004)(396003)(376002)(346002)(305945005)(446003)(50226002)(16586007)(48376002)(54906003)(316002)(66066001)(47776003)(5660300001)(50466002)(26005)(478600001)(86362001)(186003)(36756003)(6916009)(8676002)(16526019)(6666003)(81166006)(4720700003)(25786009)(11346002)(55016002)(53936002)(7696005)(2906002)(3846002)(8936002)(7736002)(2616005)(4326008)(76176011)(52116002)(107886003)(59450400001)(33026002)(6116002)(386003)(956004)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2311; H:mellanox.com; FPR:; SPF:None; LANG:en; MLV:sfv; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0501MB2311; 23:Knvllqo/DLzNHExu7a2O6fyzvFZgtSwDZTKBPFb?= =?us-ascii?Q?3hbCdE/geiiDmYBfKt7axHwt+RnuV3jpAecthY8u7b5pys3srJ+dyFvDf/JP?= =?us-ascii?Q?DA62DAk1tNO0sES1ZgimVYqt4dQjOzxsmt2zGo6bOLcuL716Y2jeRg+d0yG1?= =?us-ascii?Q?+5eWCro4wtjnLQky+PcObtThKKW4XMHA+06nrxgy4zb8AIYSijzRks4ORtzU?= =?us-ascii?Q?zZN91moXlGUVPOP9Ayp/2BuCF+LDcTcjjVIw2awL7142Ywsbt/UI0T8k6V7Q?= =?us-ascii?Q?dZN9sXn6iRjmxxX8fun1VgxZbQoBK4MJDSu72ATqjoqz6WiyWQXx7TDVKgkv?= =?us-ascii?Q?UK8PD5AkXcOLoKBv9Q0XjzxhYosA+hmzLGF7R3HRzDWksO0+JsTtdWFLjRH7?= =?us-ascii?Q?D8ic1E5xpFp43O8pYEo6oTt4pHQNaupcM1v3pc9EKmP+02IpxujskAyCQ0Bs?= =?us-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WyA5HQAksKhNUm/w X-MS-Office365-Filtering-Correlation-Id: 0355c7ef-9e47-465d-40df-08d5a844732c X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2018 11:30:27.4284 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0355c7ef-9e47-465d-40df-08d5a844732c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2311 Subject: [dpdk-dev] [PATCH v2 1/2] net/tap: calculate checksums of multi segs packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Apr 2018 11:30:30 -0000 Prior to this commit IP/UDP/TCP checksum offload calculations were skipped in case of a multi segments packet. This commit enables TAP checksum calculations for multi segments packets. The only restriction is that the first segment must contain headers of layers 3 (IP) and 4 (UDP or TCP) Signed-off-by: Ophir Munk --- drivers/net/tap/rte_eth_tap.c | 154 ++++++++++++++++++++++++++++-------------- 1 file changed, 104 insertions(+), 50 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 66e026f..d77a64f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -436,12 +436,43 @@ tap_txq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) return true; } +/* Finalize l4 checksum calculation */ static void -tap_tx_offload(char *packet, uint64_t ol_flags, unsigned int l2_len, - unsigned int l3_len) +tap_tx_l4_cksum(uint16_t *l4_cksum, uint16_t l4_phdr_cksum, + uint32_t l4_raw_cksum) { - void *l3_hdr = packet + l2_len; + if (l4_cksum) { + uint32_t cksum; + + cksum = __rte_raw_cksum_reduce(l4_raw_cksum); + cksum += l4_phdr_cksum; + + cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff); + cksum = (~cksum) & 0xffff; + if (cksum == 0) + cksum = 0xffff; + *l4_cksum = cksum; + } +} +/* Accumaulate L4 raw checksums */ +static void +tap_tx_l4_add_rcksum(char *l4_data, unsigned int l4_len, uint16_t *l4_cksum, + uint32_t *l4_raw_cksum) +{ + if (l4_cksum == NULL) + return; + + *l4_raw_cksum = __rte_raw_cksum(l4_data, l4_len, *l4_raw_cksum); +} + +/* L3 and L4 pseudo headers checksum offloads */ +static void +tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, + unsigned int l3_len, unsigned int l4_len, uint16_t **l4_cksum, + uint16_t *l4_phdr_cksum, uint32_t *l4_raw_cksum) +{ + void *l3_hdr = packet + l2_len; if (ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_IPV4)) { struct ipv4_hdr *iph = l3_hdr; uint16_t cksum; @@ -451,38 +482,21 @@ tap_tx_offload(char *packet, uint64_t ol_flags, unsigned int l2_len, iph->hdr_checksum = (cksum == 0xffff) ? cksum : ~cksum; } if (ol_flags & PKT_TX_L4_MASK) { - uint16_t l4_len; - uint32_t cksum; - uint16_t *l4_cksum; void *l4_hdr; l4_hdr = packet + l2_len + l3_len; if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) - l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; + *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) - l4_cksum = &((struct tcp_hdr *)l4_hdr)->cksum; + *l4_cksum = &((struct tcp_hdr *)l4_hdr)->cksum; else return; - *l4_cksum = 0; - if (ol_flags & PKT_TX_IPV4) { - struct ipv4_hdr *iph = l3_hdr; - - l4_len = rte_be_to_cpu_16(iph->total_length) - l3_len; - cksum = rte_ipv4_phdr_cksum(l3_hdr, 0); - } else { - struct ipv6_hdr *ip6h = l3_hdr; - - /* payload_len does not include ext headers */ - l4_len = rte_be_to_cpu_16(ip6h->payload_len) - - l3_len + sizeof(struct ipv6_hdr); - cksum = rte_ipv6_phdr_cksum(l3_hdr, 0); - } - cksum += rte_raw_cksum(l4_hdr, l4_len); - cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff); - cksum = (~cksum) & 0xffff; - if (cksum == 0) - cksum = 0xffff; - *l4_cksum = cksum; + **l4_cksum = 0; + if (ol_flags & PKT_TX_IPV4) + *l4_phdr_cksum = rte_ipv4_phdr_cksum(l3_hdr, 0); + else + *l4_phdr_cksum = rte_ipv6_phdr_cksum(l3_hdr, 0); + *l4_raw_cksum = __rte_raw_cksum(l4_hdr, l4_len, 0); } } @@ -503,17 +517,25 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) max_size = *txq->mtu + (ETHER_HDR_LEN + ETHER_CRC_LEN + 4); for (i = 0; i < nb_pkts; i++) { struct rte_mbuf *mbuf = bufs[num_tx]; - struct iovec iovecs[mbuf->nb_segs + 1]; + struct iovec iovecs[mbuf->nb_segs + 2]; struct tun_pi pi = { .flags = 0, .proto = 0x00 }; struct rte_mbuf *seg = mbuf; char m_copy[mbuf->data_len]; + int proto; int n; int j; + int k; /* first index in iovecs for copying segments */ + uint16_t l234_hlen; /* length of layers 2,3,4 headers */ + uint16_t seg_len; /* length of first segment */ + uint16_t nb_segs; + uint16_t *l4_cksum; /* l4 checksum (pseudo header + payload) */ + uint32_t l4_raw_cksum = 0; /* TCP/UDP payload raw checksum */ + uint16_t l4_phdr_cksum = 0; /* TCP/UDP pseudo header checksum */ /* stats.errs will be incremented */ if (rte_pktmbuf_pkt_len(mbuf) > max_size) break; - + l4_cksum = NULL; /* * TUN and TAP are created with IFF_NO_PI disabled. * For TUN PMD this mandatory as fields are used by @@ -525,34 +547,66 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) * value 0x00 is taken for protocol field. */ char *buff_data = rte_pktmbuf_mtod(seg, void *); - j = (*buff_data & 0xf0); - pi.proto = (j == 0x40) ? 0x0008 : - (j == 0x60) ? 0xdd86 : 0x00; - - iovecs[0].iov_base = π - iovecs[0].iov_len = sizeof(pi); - for (j = 1; j <= mbuf->nb_segs; j++) { - iovecs[j].iov_len = rte_pktmbuf_data_len(seg); - iovecs[j].iov_base = - rte_pktmbuf_mtod(seg, void *); - seg = seg->next; - } + proto = (*buff_data & 0xf0); + pi.proto = (proto == 0x40) ? 0x0008 : + (proto == 0x60) ? 0xdd86 : 0x00; + + k = 0; + iovecs[k].iov_base = π + iovecs[k].iov_len = sizeof(pi); + k++; + nb_segs = mbuf->nb_segs; if (txq->csum && ((mbuf->ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_IPV4) || (mbuf->ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM || (mbuf->ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM))) { - /* Support only packets with all data in the same seg */ - if (mbuf->nb_segs > 1) + /* Support only packets with at least layer 4 + * header included in the first segment + */ + seg_len = rte_pktmbuf_data_len(mbuf); + l234_hlen = mbuf->l2_len + mbuf->l3_len + mbuf->l4_len; + if (seg_len < l234_hlen) break; - /* To change checksums, work on a copy of data. */ + + /* To change checksums, work on a + * copy of l2, l3 l4 headers. + */ rte_memcpy(m_copy, rte_pktmbuf_mtod(mbuf, void *), - rte_pktmbuf_data_len(mbuf)); - tap_tx_offload(m_copy, mbuf->ol_flags, - mbuf->l2_len, mbuf->l3_len); - iovecs[1].iov_base = m_copy; + l234_hlen); + tap_tx_l3_cksum(m_copy, mbuf->ol_flags, + mbuf->l2_len, mbuf->l3_len, mbuf->l4_len, + &l4_cksum, &l4_phdr_cksum, + &l4_raw_cksum); + iovecs[k].iov_base = m_copy; + iovecs[k].iov_len = l234_hlen; + k++; + /* Update next iovecs[] beyond l2, l3, l4 headers */ + if (seg_len > l234_hlen) { + iovecs[k].iov_len = seg_len - l234_hlen; + iovecs[k].iov_base = + rte_pktmbuf_mtod(seg, char *) + + l234_hlen; + tap_tx_l4_add_rcksum(iovecs[k].iov_base, + iovecs[k].iov_len, l4_cksum, + &l4_raw_cksum); + k++; + nb_segs++; + } + seg = seg->next; } + for (j = k; j <= nb_segs; j++) { + iovecs[j].iov_len = rte_pktmbuf_data_len(seg); + iovecs[j].iov_base = rte_pktmbuf_mtod(seg, void *); + tap_tx_l4_add_rcksum(iovecs[k].iov_base, + iovecs[k].iov_len, l4_cksum, + &l4_raw_cksum); + seg = seg->next; + } + + tap_tx_l4_cksum(l4_cksum, l4_phdr_cksum, l4_raw_cksum); + /* copy the tx frame data */ - n = writev(txq->fd, iovecs, mbuf->nb_segs + 1); + n = writev(txq->fd, iovecs, j); if (n <= 0) break; -- 2.7.4