[{"id":1773421,"web_url":"http://patchwork.ozlabs.org/comment/1773421/","msgid":"<501B6CE6-3F3D-4EE1-8BFF-5B7ACD82D45A@vmware.com>","list_archive_url":null,"date":"2017-09-22T10:04:20","subject":"Re: [ovs-dev] [PATCH v5] netdev-dpdk: reset packet_type for reused\n\tdp_packets","submitter":{"id":68212,"url":"http://patchwork.ozlabs.org/api/people/68212/","name":"Darrell Ball","email":"dball@vmware.com"},"content":"I applied the patch to dpdk_merge here\r\n\r\nhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_darball_ovs_commits_dpdk-5Fmerge&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=A2_FCacqbp2moAo3HGFlTuxsjONUGhlN42OBcAuQQ6w&s=b6btPKhgvOFr2GOUYvktND6kaC6jc3fXI-mXfvNgXOU&e=\r\n\r\n\r\nOn 9/11/17, 12:56 AM, \"ovs-dev-bounces@openvswitch.org on behalf of Zoltán Balogh\" <ovs-dev-bounces@openvswitch.org on behalf of zoltan.balogh@ericsson.com> wrote:\r\n\r\n    DPDK uses dp-packet pool for storing received packets. The pool is\r\n    reused by rxq_recv funcions of the DPDK netdevs. The datapath is\r\n    capable to modify the packet_type property of packets. For instance\r\n    when encapsulated L3 packets are received on a ptap gre port.\r\n    In this case the packet_type property of struct dp_packet can be\r\n    modified and later the same dp_packet with the modified packet_type\r\n    can be reused in the rxq_rec function, so it can contain corrupted\r\n    data.\r\n    \r\n    The dp_packet_batch_init_cutlen() in the rxq_recv functions iterates\r\n    over dp_packets and sets their cutlen. So I modified this function\r\n    to set packet_type to Ethernet for the dp_packets as well. I also\r\n    renamed this function because of the added functionality.\r\n    \r\n    The dp_packet_batch_init_cutlen() iterates over batch->count dp_packet.\r\n    Therefore setting of batch->count = nb_rx needs to be done before the\r\n    former function is invoked. This is an additional fix.\r\n    \r\n    Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com>\r\n    Signed-off-by: Laszlo Suru <laszlo.suru@ericsson.com>\r\n    Co-authored-by: Laszlo Suru <laszlo.suru@ericsson.com>\r\n    CC: Jan Scheurich <jan.scheurich@ericsson.com>\r\n    CC: Sugesh Chandran <sugesh.chandran@intel.com>\r\n    CC: Darrell Ball <dlu998@gmail.com>\r\n    ---\r\n     lib/dp-packet.c   | 1 -\r\n     lib/dp-packet.h   | 3 ++-\r\n     lib/netdev-dpdk.c | 7 ++++---\r\n     3 files changed, 6 insertions(+), 5 deletions(-)\r\n    \r\n    diff --git a/lib/dp-packet.c b/lib/dp-packet.c\r\n    index e5d16a6..443c225 100644\r\n    --- a/lib/dp-packet.c\r\n    +++ b/lib/dp-packet.c\r\n    @@ -103,7 +103,6 @@ dp_packet_init_dpdk(struct dp_packet *b, size_t allocated)\r\n     {\r\n         dp_packet_set_allocated(b, allocated);\r\n         b->source = DPBUF_DPDK;\r\n    -    b->packet_type = htonl(PT_ETH);\r\n     }\r\n     \r\n     /* Initializes 'b' as an empty dp_packet with an initial capacity of 'size'\r\n    diff --git a/lib/dp-packet.h b/lib/dp-packet.h\r\n    index 046f3ab..b4b721c 100644\r\n    --- a/lib/dp-packet.h\r\n    +++ b/lib/dp-packet.h\r\n    @@ -805,12 +805,13 @@ dp_packet_delete_batch(struct dp_packet_batch *batch, bool may_steal)\r\n     }\r\n     \r\n     static inline void\r\n    -dp_packet_batch_init_cutlen(struct dp_packet_batch *batch)\r\n    +dp_packet_batch_init_packet_fields(struct dp_packet_batch *batch)\r\n     {\r\n         struct dp_packet *packet;\r\n     \r\n         DP_PACKET_BATCH_FOR_EACH (packet, batch) {\r\n             dp_packet_reset_cutlen(packet);\r\n    +        packet->packet_type = htonl(PT_ETH);\r\n         }\r\n     }\r\n     \r\n    diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c\r\n    index f58e9be..ccccb9a 100644\r\n    --- a/lib/netdev-dpdk.c\r\n    +++ b/lib/netdev-dpdk.c\r\n    @@ -1644,8 +1644,9 @@ netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,\r\n                                              nb_rx, dropped);\r\n         rte_spinlock_unlock(&dev->stats_lock);\r\n     \r\n    -    dp_packet_batch_init_cutlen(batch);\r\n    -    batch->count = (int) nb_rx;\r\n    +    batch->count = nb_rx;\r\n    +    dp_packet_batch_init_packet_fields(batch);\r\n    +\r\n         return 0;\r\n     }\r\n     \r\n    @@ -1684,8 +1685,8 @@ netdev_dpdk_rxq_recv(struct netdev_rxq *rxq, struct dp_packet_batch *batch)\r\n             rte_spinlock_unlock(&dev->stats_lock);\r\n         }\r\n     \r\n    -    dp_packet_batch_init_cutlen(batch);\r\n         batch->count = nb_rx;\r\n    +    dp_packet_batch_init_packet_fields(batch);\r\n     \r\n         return 0;\r\n     }\r\n    -- \r\n    1.9.1\r\n    \r\n    _______________________________________________\r\n    dev mailing list\r\n    dev@openvswitch.org\r\n    https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=mikkQtxEB-CKcT9w1J9VcbwWh2_d17ZEzHLNJ0TkysI&s=tZEt9c3UB5rQfDIbdzn_BMEp2HupOscOgnc3Q6SDJqI&e=","headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=onevmw.onmicrosoft.com\n\theader.i=@onevmw.onmicrosoft.com header.b=\"JdqGnSm5\"; \n\tdkim-atps=neutral","spf=none (sender IP is )\n\tsmtp.mailfrom=dball@vmware.com; "],"Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xz8GP2Njyz9s9Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 20:04:28 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 50F7DB94;\n\tFri, 22 Sep 2017 10:04:25 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 29E998FF\n\tfor <dev@openvswitch.org>; Fri, 22 Sep 2017 10:04:24 +0000 (UTC)","from NAM03-DM3-obe.outbound.protection.outlook.com\n\t(mail-dm3nam03on0048.outbound.protection.outlook.com [104.47.41.48])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6BA38157\n\tfor <dev@openvswitch.org>; Fri, 22 Sep 2017 10:04:23 +0000 (UTC)","from MWHPR05MB3406.namprd05.prod.outlook.com (10.174.175.155) by\n\tMWHPR05MB3408.namprd05.prod.outlook.com (10.174.175.157) with\n\tMicrosoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id\n\t15.20.77.5; Fri, 22 Sep 2017 10:04:20 +0000","from MWHPR05MB3406.namprd05.prod.outlook.com ([10.174.175.155]) by\n\tMWHPR05MB3406.namprd05.prod.outlook.com ([10.174.175.155]) with\n\tmapi id 15.20.0077.007; Fri, 22 Sep 2017 10:04:20 +0000"],"X-Greylist":"whitelisted by SQLgrey-1.7.6","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=onevmw.onmicrosoft.com; s=selector1-vmware-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version;\n\tbh=DAe5FdicpzLmNxxLAmFgJrVEyIpcCGZvC0qR6/YLHaw=;\n\tb=JdqGnSm5c13K1i5GfUQdBpdejIjoTw5eQJCnH7hmFBJoA3plhx+T2GrmcqZ4zN+a1cwlyoFKPMs3JiMAdaK7H+xyKDx1eW5S5ujMqDmQwfQQ7NDFYJ3V/0gJ04ngdZ4S/VzkDigJhWfXbloEfOnVVE20T9thIQ4ghWxD7OKCbj0=","From":"Darrell Ball <dball@vmware.com>","To":"=?utf-8?q?Zolt=C3=A1n_Balogh?= <zoltan.balogh@ericsson.com>,\n\t\"'dev@openvswitch.org'\" <dev@openvswitch.org>","Thread-Topic":"[ovs-dev] [PATCH v5] netdev-dpdk: reset packet_type for reused\n\tdp_packets","Thread-Index":"AQHTM4ooC7CBsEfu5kyT3/45g0EpeQ==","Date":"Fri, 22 Sep 2017 10:04:20 +0000","Message-ID":"<501B6CE6-3F3D-4EE1-8BFF-5B7ACD82D45A@vmware.com>","References":"<AM2PR07MB10426D433D8ED83EDFE072A88A680@AM2PR07MB1042.eurprd07.prod.outlook.com>","In-Reply-To":"<AM2PR07MB10426D433D8ED83EDFE072A88A680@AM2PR07MB1042.eurprd07.prod.outlook.com>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","user-agent":"Microsoft-MacOutlook/f.26.0.170902","x-originating-ip":"[73.162.236.45]","x-ms-publictraffictype":"Email","x-microsoft-exchange-diagnostics":"1; MWHPR05MB3408;\n\t20:QLxbuwVf18+2oLgrEqNKmp+FWa62jpIXpKZ9LDTl/DTYjQGzAc5r+00QrvGBp4wkU1WmU2PCS3Xz5QdoEqH3DUVM587nBFAluKg8L9G7I3BOr3IGTBB3TucwJhV6UV7NW6islG1b2TDBSX/He9sz9jl9sb7yItwJix/zhMLAVrI=","x-ms-exchange-antispam-srfa-diagnostics":"SSOS;","x-ms-office365-filtering-correlation-id":"ad5b61f8-11ff-40e9-3646-08d501a14b6c","x-microsoft-antispam":"UriScan:; BCL:0; PCL:0;\n\tRULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);\n\tSRVR:MWHPR05MB3408; ","x-ms-traffictypediagnostic":"MWHPR05MB3408:","authentication-results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=onevmw.onmicrosoft.com\n\theader.i=@onevmw.onmicrosoft.com header.b=\"JdqGnSm5\"; \n\tdkim-atps=neutral","spf=none (sender IP is )\n\tsmtp.mailfrom=dball@vmware.com; "],"x-exchange-antispam-report-test":"UriScan:(37575265505322)(10436049006162)(216315784871565)(228905959029699);","x-microsoft-antispam-prvs":"<MWHPR05MB3408BCE88912ACD2F44185F9C8670@MWHPR05MB3408.namprd05.prod.outlook.com>","x-exchange-antispam-report-cfa-test":"BCL:0; PCL:0;\n\tRULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123558100)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);\n\tSRVR:MWHPR05MB3408; BCL:0; PCL:0;\n\tRULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);\n\tSRVR:MWHPR05MB3408; ","x-forefront-prvs":"0438F90F17","x-forefront-antispam-report":"SFV:NSPM;\n\tSFS:(10009020)(6009001)(346002)(376002)(199003)(24454002)(377454003)(189002)(3846002)(81156014)(2900100001)(5660300001)(68736007)(229853002)(101416001)(81166006)(110136005)(58126008)(82746002)(76176999)(83506001)(2906002)(54356999)(36756003)(966005)(6436002)(66066001)(105586002)(2950100002)(106356001)(305945005)(97736004)(53546010)(316002)(6246003)(6306002)(6506006)(53936002)(25786009)(50986999)(3660700001)(33656002)(6512007)(3280700002)(86362001)(575784001)(14454004)(6116002)(102836003)(83716003)(8676002)(99286003)(8936002)(7736002)(189998001)(6486002)(478600001)(77096006)(491001);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR05MB3408;\n\tH:MWHPR05MB3406.namprd05.prod.outlook.com; FPR:; SPF:None;\n\tPTR:InfoNoRecords; A:1; MX:1; LANG:en; ","received-spf":"None (protection.outlook.com: vmware.com does not designate\n\tpermitted sender hosts)","spamdiagnosticoutput":"1:99","spamdiagnosticmetadata":"NSPM","Content-ID":"<E3B77443668DC344968DA954D1426839@namprd05.prod.outlook.com>","MIME-Version":"1.0","X-OriginatorOrg":"vmware.com","X-MS-Exchange-CrossTenant-originalarrivaltime":"22 Sep 2017 10:04:20.7663\n\t(UTC)","X-MS-Exchange-CrossTenant-fromentityheader":"Hosted","X-MS-Exchange-CrossTenant-id":"b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"MWHPR05MB3408","X-Spam-Status":"No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tRCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Subject":"Re: [ovs-dev] [PATCH v5] netdev-dpdk: reset packet_type for reused\n\tdp_packets","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"}}]