From patchwork Mon Mar 2 15:49:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 45292 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 113212149C for ; Mon, 2 Mar 2015 15:50:46 +0000 (UTC) Received: by lbdu10 with SMTP id u10sf24825419lbd.3 for ; Mon, 02 Mar 2015 07:50:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=sANOclVIyX4qpmauedpuxZrWZtxLSrwm+4uZBWSIxYA=; b=B5ddob0cgDylxDV70LDgNL3h3MwNsA5cMkApkH/jE4u5hyQNB2FO+FQjsrjmG1+hgu scr34UcNuPae9oi5T8FwAGa/98Ghted6phGJ2AEKYmfq/JGWCPGIT2ptBrnhU8+qHafP rwPmkhMfzdMoqNGtmdMnuZMu85tbgOLcph2SGdfGVar0t9k+hPOBFChanS8jaff68vUg wDKMrRjpcUcyNViCtmSJ1XwDegEGqRVp4jumBWRlZ+TahMjBcPcT4/gOIwc772DTQhvz v0o8kX3mA5iOG2jRnWprP+bvFlx8fQy4ODOxYjG50FkxLk2lsNbMxYlMpmOeu1aZPAqv CdCg== X-Gm-Message-State: ALoCoQkzW/JFra84wYapAYtRA2vf7/R61VWysSGJB8w5If3icbewj3GQN0GFJUAl3l7wxGaQlUEu X-Received: by 10.180.8.67 with SMTP id p3mr2311706wia.7.1425311445032; Mon, 02 Mar 2015 07:50:45 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.237 with SMTP id r13ls28643lal.74.gmail; Mon, 02 Mar 2015 07:50:44 -0800 (PST) X-Received: by 10.112.215.35 with SMTP id of3mr25016708lbc.101.1425311444867; Mon, 02 Mar 2015 07:50:44 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id bb20si9176198lab.6.2015.03.02.07.50.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 07:50:44 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbdu10 with SMTP id u10so30881358lbd.7 for ; Mon, 02 Mar 2015 07:50:44 -0800 (PST) X-Received: by 10.152.28.5 with SMTP id x5mr24342881lag.112.1425311444770; Mon, 02 Mar 2015 07:50:44 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp5607235lbj; Mon, 2 Mar 2015 07:50:44 -0800 (PST) X-Received: by 10.140.233.84 with SMTP id e81mr54036089qhc.94.1425311443306; Mon, 02 Mar 2015 07:50:43 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id w8si11929327qgd.53.2015.03.02.07.50.41 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Mar 2015 07:50:43 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YSSc8-0006b7-L5; Mon, 02 Mar 2015 15:50:36 +0000 Received: from mail-la0-f49.google.com ([209.85.215.49]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YSSc3-0006b0-6g for lng-odp@lists.linaro.org; Mon, 02 Mar 2015 15:50:31 +0000 Received: by lamq1 with SMTP id q1so8028724lam.9 for ; Mon, 02 Mar 2015 07:50:25 -0800 (PST) X-Received: by 10.152.120.8 with SMTP id ky8mr23867774lab.118.1425311425327; Mon, 02 Mar 2015 07:50:25 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id p7sm2617942lap.18.2015.03.02.07.50.23 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Mar 2015 07:50:24 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 2 Mar 2015 18:49:55 +0300 Message-Id: <1425311395-19488-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 X-Topics: patch Subject: [lng-odp] [PATCHv2] linux-generic: mmap: jumbo frames support X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Support for jumbo frames for linux-generic with unsegmented buffers. Test for pkio is also adjusted to work with 9*1024=9216 bytes packets. https://bugs.linaro.org/show_bug.cgi?id=509 Signed-off-by: Maxim Uvarov --- v2: separate test for jumbo frames. platform/linux-generic/odp_packet_socket.c | 2 +- test/validation/odp_pktio.c | 70 +++++++++++++++++++++++------- test/validation/odp_pktio_run | 4 +- 3 files changed, 57 insertions(+), 19 deletions(-) diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c index 55c212e..4dcb111 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/odp_packet_socket.c @@ -587,7 +587,7 @@ static inline unsigned pkt_mmap_v2_tx(int sock, struct ring *ring, static void mmap_fill_ring(struct ring *ring, unsigned blocks) { ring->req.tp_block_size = getpagesize() << 2; - ring->req.tp_frame_size = TPACKET_ALIGNMENT << 7; + ring->req.tp_frame_size = 9216 + TPACKET_HDRLEN; ring->req.tp_block_nr = blocks; ring->req.tp_frame_nr = ring->req.tp_block_size / diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index 8df367d..8b40c8b 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -15,6 +15,7 @@ #define PKT_BUF_NUM 32 #define PKT_BUF_SIZE 1856 +#define PKT_BUF_JUMBO_SIZE 9216 #define MAX_NUM_IFACES 2 #define TEST_SEQ_INVALID ((uint32_t)~0) #define TEST_SEQ_MAGIC 0x92749451 @@ -33,12 +34,18 @@ typedef struct { odp_queue_t inq; } pktio_info_t; -/** structure of test packet UDP payload */ -typedef struct { - uint32be_t magic; - uint32be_t seq; +/** structure of test jumbo packet UDP payload */ +typedef struct __attribute__((__packed__)) { + struct { + uint32be_t magic; + uint32be_t seq; + } head; + char data[9162]; /* total size of eth packet 9216 */ + uint32be_t magic2; } pkt_test_data_t; +static int test_4_jumbo_pkts; + /** default packet pool */ odp_pool_t default_pkt_pool = ODP_POOL_INVALID; @@ -64,9 +71,15 @@ static int pktio_pkt_set_seq(odp_packet_t pkt) static uint32_t tstseq; size_t l4_off; pkt_test_data_t data; + uint32_t len; - data.magic = TEST_SEQ_MAGIC; - data.seq = tstseq; + data.head.magic = TEST_SEQ_MAGIC; + data.magic2 = TEST_SEQ_MAGIC; + data.head.seq = tstseq; + if (test_4_jumbo_pkts) + len = sizeof(data); + else + len = sizeof(data.head); l4_off = odp_packet_l4_offset(pkt); if (!l4_off) { @@ -75,8 +88,7 @@ static int pktio_pkt_set_seq(odp_packet_t pkt) } odp_packet_copydata_in(pkt, l4_off+ODPH_UDPHDR_LEN, - sizeof(data), &data); - + len, &data); tstseq++; return 0; @@ -85,18 +97,31 @@ static int pktio_pkt_set_seq(odp_packet_t pkt) static uint32_t pktio_pkt_seq(odp_packet_t pkt) { size_t l4_off; + uint32_t seq = TEST_SEQ_INVALID; pkt_test_data_t data; + uint32_t len; l4_off = odp_packet_l4_offset(pkt); - if (l4_off) { - odp_packet_copydata_out(pkt, l4_off+ODPH_UDPHDR_LEN, - sizeof(data), &data); + if (!l4_off) + return TEST_SEQ_INVALID; - if (data.magic == TEST_SEQ_MAGIC) - return data.seq; + if (test_4_jumbo_pkts) + len = sizeof(data); + else + len = sizeof(data.head); + + odp_packet_copydata_out(pkt, l4_off+ODPH_UDPHDR_LEN, + len, &data); + + if (data.head.magic == TEST_SEQ_MAGIC) { + if (test_4_jumbo_pkts && + data.magic2 != TEST_SEQ_MAGIC) + return TEST_SEQ_INVALID; + + seq = data.head.seq; } - return TEST_SEQ_INVALID; + return seq; } static odp_packet_t pktio_create_packet(void) @@ -187,8 +212,14 @@ static int default_pool_create(void) return -1; memset(¶ms, 0, sizeof(params)); - params.pkt.seg_len = PKT_BUF_SIZE; - params.pkt.len = PKT_BUF_SIZE; + if (test_4_jumbo_pkts) { + params.pkt.seg_len = PKT_BUF_JUMBO_SIZE; + params.pkt.len = PKT_BUF_JUMBO_SIZE; + + } else { + params.pkt.seg_len = PKT_BUF_SIZE; + params.pkt.len = PKT_BUF_SIZE; + } params.pkt.num = PKT_BUF_NUM; params.type = ODP_POOL_PACKET; @@ -450,6 +481,12 @@ static void test_odp_pktio_sched_multi(void) pktio_test_txrx(ODP_QUEUE_TYPE_SCHED, 4); } +static void test_odp_pktio_jumbo(void) +{ + test_4_jumbo_pkts = 1; + pktio_test_txrx(ODP_QUEUE_TYPE_SCHED, 4); +} + static void test_odp_pktio_mtu(void) { int ret; @@ -668,6 +705,7 @@ CU_TestInfo pktio_tests[] = { {"pktio poll multi", test_odp_pktio_poll_multi}, {"pktio sched queues", test_odp_pktio_sched_queue}, {"pktio sched multi", test_odp_pktio_sched_multi}, + {"pktio jumbo frames", test_odp_pktio_jumbo}, {"pktio mtu", test_odp_pktio_mtu}, {"pktio promisc mode", test_odp_pktio_promisc}, {"pktio mac", test_odp_pktio_mac}, diff --git a/test/validation/odp_pktio_run b/test/validation/odp_pktio_run index 08288e6..b9d7e3c 100755 --- a/test/validation/odp_pktio_run +++ b/test/validation/odp_pktio_run @@ -56,8 +56,8 @@ setup_env1() echo "pktio: error: unable to create veth pair" exit $TEST_SKIPPED fi - ip link set $IF0 up - ip link set $IF1 up + ip link set $IF0 mtu 9216 up + ip link set $IF1 mtu 9216 up # network needs a little time to come up sleep 1