From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0044.outbound.protection.outlook.com [104.47.1.44]) by dpdk.org (Postfix) with ESMTP id 6662156A1 for ; Fri, 9 Mar 2018 22:10:52 +0100 (CET) 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=aJkuposNtG3KVSz34ydkCp2u6rAtttOgUvYC0z/AsUw=; b=rhRIyZ2c/ID+oQbvXpTcHl17CIZmNJr1LbyK1aHo+jWSfLfDhZB/Vj6KGkH/0HubKFfVGc9vhCLL+xonoigt2O4HaPfnwk9P5ksRyB3VmahcqftD39JLW8XJ8UWFSFuVEILhaum0MBVc/80cqMYhotDdKu1ptzSt5tCNhcUCnRk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0502MB3883.eurprd05.prod.outlook.com (2603:10a6:7:87::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Fri, 9 Mar 2018 21:10:49 +0000 From: Ophir Munk To: dev@dpdk.org, Pascal Mazon Cc: Thomas Monjalon , Olga Shern , Ophir Munk Date: Fri, 9 Mar 2018 21:10:26 +0000 Message-Id: <1520629826-23055-3-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1520629826-23055-1-git-send-email-ophirmu@mellanox.com> References: <1520629826-23055-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR07CA0199.eurprd07.prod.outlook.com (2603:10a6:802:3f::23) To HE1PR0502MB3883.eurprd05.prod.outlook.com (2603:10a6:7:87::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 42150432-2a51-48a5-2bd6-08d586023cc5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0502MB3883; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3883; 3:+rkio3+nEt7JmdKIVhM5uMbaBc7pQatn/nVW5sEcyciOPMGv65AWcxSQzZqAxx3s8cmddB9RYnTZuG6E7gLAJZDp4DW6ORcW8qB0QMIDfWYyXXos2gK/YpFRjVtmGV2hCjQkk3mKnn2bp3yLc54kZ35rwjgPBC8kBebEW9c3O9QvO/9+7jeBkAqBVLnasJMHJEC730BONGGWZKW5dSInw72cyD60V6BmoHlsK5UbRgOoVOfKsPVLC3zvbpabEjk3; 25:nhfH1CvaSeUV+SBLdZAE6MldhgZIOMhrA4Lh+cBYYXMcihlOhXia2F1J70FNACZhTq4+WAN61QQpqDcePfUyyhZEeXT/0DhZFQKo5c+3GDK9VFfzzOOgWMHFhdOGkmQ2TnmgQy9fes1OCCLBxtkF0T9dpPWPWLrZPbNlpn9Us53xDidxhVbjkW/XA/peY2jfyZ9K0LQjUxSZ08EX29oUmzxNyqyRWS75WfHS9en1x0mYQ3RsIlMe2o0U/5sW6kBs064F5R3iz603GktQoCXA0v8eAREkKzAgLerQKNjBFd1MpLuxwtbyYe+YhJhRRS1d0W2Vw3eJ2orm/rKVWQoeow==; 31:bGUSBUBXtaTFvTrz8Yl21flYa7xooXs1xx95/HFMglSGgRjMoZFMWQWXW85g1auBua3dtRKxUD4wWsr6Qpw7MAn0mcVw4CSUReRaWrfDRZBQ6c4wHk30kuiq5rYO0xP6QzJF4BN+7DrIiMuMRSvGdn12x9X3/iaBUWZBUfwEwTJiCRvs1ih886SfEWGjOStzKZM34jcOmtJHxbnkHmhhgFENDt3nMiXCnyMEbD3AvJY= X-MS-TrafficTypeDiagnostic: HE1PR0502MB3883: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3883; 20:4zK4d5okbwRtYlOB7szCbd2pij2gHz4mHx4NlcwTjOtKmAWQQw/pLNbRuJY/8gKQ3yxyyjVFZlgdEbdn4l+xe+ft/GWMKDOOfvdEOZEx5OKNKiU5lc9v6zZcx911fb7TTDYKU83dsayn3eBt7FsrtDiR2Hib/q/MjVP2DnoLLqBBM31kBp6pdupBUu//e8by0v8l3dffM5AZntcHrri00sTVY8sumG8AQYTJIV34nTT/kZGtH7caXW5a2Z9eSui195tWX7zJzaYBgAxL8Vu2FsuesLgeR2h+yR9obve0fFVFoKzcwp27/QOyBeL8TqQ1SsDoiur2DGH2vYDUd4Qbr5djjscXSQgblq4IaOWq65NttA0oQlBEtdV7GW5+B01kxP1sardzo5Pk+wEjweebn6+7h+G58L54RiwLtpzFXks1fI5Te836PyxoDSpqQJ9BDd7Y/krgfm1gdrsN7MQ0KpOuLM5TUP+s/12/jGO9aJ8814IeipT98HdM7OU0BNho; 4:arND3EKI9wT7nxadxU8bwx4AwBNpya+4HiAg709rES/f+RW0qIStsyCtBA7+1EwM8Yy3ttMQp/beXu8hpH44Meyq6RizhZYn20MNPjfit8y9djLlYasf6CAT3XfZ0PjyfHQMeLc35bpbhvLCQxecbJ4nOcj6lIqLgAv/gIz4bE6dtItFzCeAXWdUMyjXhcPV6sPGHl2vaoi9JZQFyraNq2kUS4qX+SmGqEYCcTyi0V+y5vNMq3Y+hHG+9AOvCPnljhAsonNKhPWTd9KAEJZaHw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231220)(944501244)(52105095)(6055026)(6041310)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:HE1PR0502MB3883; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0502MB3883; X-Forefront-PRVS: 0606BBEB39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(376002)(396003)(346002)(39380400002)(189003)(199004)(7736002)(4326008)(16586007)(3846002)(25786009)(50226002)(106356001)(21086003)(2906002)(36756003)(86362001)(48376002)(16526019)(186003)(54906003)(50466002)(5660300001)(6116002)(53936002)(6666003)(478600001)(26005)(2950100002)(6916009)(68736007)(97736004)(305945005)(105586002)(107886003)(66066001)(81156014)(4720700003)(8676002)(52116002)(7696005)(51416003)(81166006)(76176011)(47776003)(386003)(316002)(69596002)(8936002)(55016002)(33026002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0502MB3883; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0502MB3883; 23:PKK7eW3t7VQ4QzrcxJDXeXuWvggq8H1FG1yCi3B?= =?us-ascii?Q?EUsS8zAoutekjuklXmdrGUqqTzUWNa63/L2jUNGRVjLV7kLCPLv4rqSgBoN1?= =?us-ascii?Q?LInZB44jx8VG8X3Et/lTnwc5fxiZDMeIwdTV7e6fJ6tbFfTQiGX0tsFy5FYx?= =?us-ascii?Q?8kpgOnLzbDGAry5FNVzOO4EKJ1mQo0/M4ai5oT8zzeUfc8VMkSQfy/MWsSwb?= =?us-ascii?Q?idsHHPFHDP+hgJvaloNnNnIpxIoejuDd/1Qx7kGG48dVO6lP2lbOyC85M9ph?= =?us-ascii?Q?d7RWpN41N6G4F1jEiIxzex84QDx7qs4caLrYMo5tgblm0U5i+TBnXoAuTsdu?= =?us-ascii?Q?yHIS1CWkaPXoz7yYAiWWjiwRrpsGxqkjvJlVefnJqisgB96KYE4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jnUutwey1VOsi8iF0oVhK1lnupiTtEjPF2GIpv2+TikFbCMgdJDATJ3SSepc5H6VARDOoW9Rk0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2018 21:10:49.9466 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42150432-2a51-48a5-2bd6-08d586023cc5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3883 Subject: [dpdk-dev] [RFC 2/2] net/tap: implement TAP TSO 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: Fri, 09 Mar 2018 21:10:52 -0000 This commit implements TCP segmentation offload in TAP. Dpdk rte_gso library is used to segment large TCP payloads (e.g. 64K bytes) into smaller MTU size buffers. By supporting TSO offload capability in software a TAP device can be used as a failsafe sub device and be paired with another PCI device which supports TSO capability in HW. For more details on dpdk librte_gso implementation please refer to dpdk documentation. The number of newly generated TSO segments is limited to 64. Signed-off-by: Ophir Munk --- drivers/net/tap/Makefile | 2 +- drivers/net/tap/rte_eth_tap.c | 157 ++++++++++++++++++++++++++++++++---------- drivers/net/tap/rte_eth_tap.h | 4 ++ 3 files changed, 126 insertions(+), 37 deletions(-) diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile index ccc5c5f..3243365 100644 --- a/drivers/net/tap/Makefile +++ b/drivers/net/tap/Makefile @@ -24,7 +24,7 @@ CFLAGS += -I. CFLAGS += $(WERROR_FLAGS) LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash -LDLIBS += -lrte_bus_vdev +LDLIBS += -lrte_bus_vdev -lrte_gso CFLAGS += -DTAP_MAX_QUEUES=$(TAP_MAX_QUEUES) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index f312084..4dda100 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -473,40 +473,37 @@ tap_tx_offload(char *packet, uint64_t ol_flags, unsigned int l2_len, } } -/* Callback to handle sending packets from the tap interface - */ -static uint16_t -pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +static void +tap_mbuf_pool_create(struct rte_mempool **mp) { - struct tx_queue *txq = queue; - uint16_t num_tx = 0; - unsigned long num_tx_bytes = 0; - uint32_t max_size; - int i; + *mp = NULL; /* TODO - create mp */ +} - if (unlikely(nb_pkts == 0)) - return 0; +static inline void +tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs, + struct rte_mbuf **pmbufs, + uint16_t *num_packets, unsigned long *num_tx_bytes) +{ + int i; - 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]; + for (i = 0; i < num_mbufs; i++) { + struct rte_mbuf *mbuf = pmbufs[i]; + struct iovec iovecs[mbuf->nb_segs + 2]; struct tun_pi pi = { .flags = 0 }; struct rte_mbuf *seg = mbuf; char m_copy[mbuf->data_len]; int n; int j; - int k; /* first index in iovecs for copying segments */ + int k; /* current index in iovecs for copying segments */ uint16_t l234_len; /* length of layers 2,3,4 headers */ uint16_t seg_len; /* length of first segment */ + uint16_t nb_segs; - /* stats.errs will be incremented */ - if (rte_pktmbuf_pkt_len(mbuf) > max_size) - break; - - iovecs[0].iov_base = π - iovecs[0].iov_len = sizeof(pi); - k = 1; + 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 || @@ -523,39 +520,99 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) /* To change checksums, work on a * copy of l2, l3 l4 headers. */ - rte_memcpy(m_copy, rte_pktmbuf_mtod(mbuf, void *), - l234_len); + rte_memcpy(m_copy, + rte_pktmbuf_mtod(mbuf, void *), l234_len); tap_tx_offload(m_copy, mbuf->ol_flags, mbuf->l2_len, mbuf->l3_len); - iovecs[1].iov_base = m_copy; - iovecs[1].iov_len = l234_len; + iovecs[k].iov_base = m_copy; + iovecs[k].iov_len = l234_len; k++; + /* Adjust data pointer beyond l2, l3, l4 headers. * If this segment becomes empty - skip it */ if (seg_len > l234_len) { - rte_pktmbuf_adj(mbuf, l234_len); - } else { - seg = seg->next; - mbuf->nb_segs--; + iovecs[k].iov_len = seg_len - l234_len; + iovecs[k].iov_base = + rte_pktmbuf_mtod(seg, char *) + + l234_len; + k++; + } else { /* seg_len == l234_len */ + nb_segs--; } + + seg = seg->next; } - for (j = k; j <= mbuf->nb_segs; j++) { + 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 *); seg = seg->next; } /* copy the tx frame data */ - n = writev(txq->fd, iovecs, mbuf->nb_segs + 1); + n = writev(txq->fd, iovecs, j); if (n <= 0) break; + (*num_packets)++; + (*num_tx_bytes) += rte_pktmbuf_pkt_len(mbuf); + } +} +/* Callback to handle sending packets from the tap interface + */ +static uint16_t +pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +{ + struct tx_queue *txq = queue; + uint16_t num_tx = 0; + uint16_t num_packets = 0; + unsigned long num_tx_bytes = 0; + uint32_t max_size; + int i; + uint64_t tso; + int ret; + + if (unlikely(nb_pkts == 0)) + return 0; + + struct rte_mbuf *gso_mbufs[MAX_GSO_MBUFS]; + max_size = *txq->mtu + (ETHER_HDR_LEN + ETHER_CRC_LEN + 4); + for (i = 0; i < nb_pkts; i++) { + struct rte_mbuf *mbuf_in = bufs[num_tx]; + struct rte_mbuf **mbuf; + uint16_t num_mbufs; + + tso = mbuf_in->ol_flags & PKT_TX_TCP_SEG; + if (tso) { + struct rte_gso_ctx *gso_ctx = &txq->gso_ctx; + /* gso size is calculated without ETHER_CRC_LEN */ + gso_ctx->gso_size = *txq->mtu + ETHER_HDR_LEN; + ret = rte_gso_segment(mbuf_in, /* packet to segment */ + gso_ctx, /* gso control block */ + (struct rte_mbuf **)&gso_mbufs, /* out mbufs */ + RTE_DIM(gso_mbufs)); /* max tso mbufs */ + + /* ret contains the number of new created mbufs */ + if (ret < 0) + break; + + mbuf = gso_mbufs; + num_mbufs = ret; + } else { + /* stats.errs will be incremented */ + if (rte_pktmbuf_pkt_len(mbuf_in) > max_size) + break; + + mbuf = &mbuf_in; + num_mbufs = 1; + } + + tap_write_mbufs(txq, num_mbufs, mbuf, + &num_packets, &num_tx_bytes); num_tx++; - num_tx_bytes += mbuf->pkt_len; - rte_pktmbuf_free(mbuf); + rte_pktmbuf_free(mbuf_in); } - txq->stats.opackets += num_tx; + txq->stats.opackets += num_packets; txq->stats.errs += nb_pkts - num_tx; txq->stats.obytes += num_tx_bytes; @@ -996,11 +1053,35 @@ tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) } static int +tap_init_gso_ctx(struct tx_queue *tx) +{ + uint32_t gso_types; + + /* Create private mbuf pool with 128 bytes size + * use this pool for both direct and indirect mbufs + */ + struct rte_mempool *mp; /* Mempool for TX/GSO packets */ + tap_mbuf_pool_create(&mp); /* tx->mp or maybe embedded in gso_ctx */ + + /* initialize GSO context */ + gso_types = DEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO; + tx->gso_ctx.direct_pool = mp; + tx->gso_ctx.indirect_pool = mp; + tx->gso_ctx.gso_types = gso_types; + tx->gso_ctx.gso_size = ETHER_MAX_LEN - ETHER_CRC_LEN; + tx->gso_ctx.flag = 0; + + return 0; +} + +static int tap_setup_queue(struct rte_eth_dev *dev, struct pmd_internals *internals, uint16_t qid, int is_rx) { + int ret; int *fd; int *other_fd; const char *dir; @@ -1048,6 +1129,10 @@ tap_setup_queue(struct rte_eth_dev *dev, tx->mtu = &dev->data->mtu; rx->rxmode = &dev->data->dev_conf.rxmode; + ret = tap_init_gso_ctx(tx); + if (ret) + return -1; + return *fd; } diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h index 53a506a..65da5f8 100644 --- a/drivers/net/tap/rte_eth_tap.h +++ b/drivers/net/tap/rte_eth_tap.h @@ -15,6 +15,7 @@ #include #include +#include #ifdef IFF_MULTI_QUEUE #define RTE_PMD_TAP_MAX_QUEUES TAP_MAX_QUEUES @@ -22,6 +23,8 @@ #define RTE_PMD_TAP_MAX_QUEUES 1 #endif +#define MAX_GSO_MBUFS 64 + struct pkt_stats { uint64_t opackets; /* Number of output packets */ uint64_t ipackets; /* Number of input packets */ @@ -50,6 +53,7 @@ struct tx_queue { uint16_t *mtu; /* Pointer to MTU from dev_data */ uint16_t csum:1; /* Enable checksum offloading */ struct pkt_stats stats; /* Stats for this TX queue */ + struct rte_gso_ctx gso_ctx; /* GSO context */ }; struct pmd_internals { -- 2.7.4