From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0087.outbound.protection.outlook.com [104.47.0.87]) by dpdk.org (Postfix) with ESMTP id BAC101B1C1 for ; Sat, 13 Oct 2018 05:24:21 +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:X-MS-Exchange-SenderADCheck; bh=qIaYc4jXyfkQ/A5CF0yc2smuxSmzkJ67gfez5ZuGBCI=; b=Goxe5pQAauiY6U4RDmjmtHT9MPQnLqt3gKn7/iB9L9g8TOXN6i+CR2YKsVXsKZEiSpaWVWHaD3IFcpNnB9Gd9HjuR+arJ2dccyqTJlU1GZDEYvuwd/0Lziv9D+8PhIVkdhSzFxnqhqwxIAAMWpySYvD3oO+MKJtHsB4egwotn4A= Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com (10.168.9.17) by DB6PR0501MB1990.eurprd05.prod.outlook.com (10.168.9.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Sat, 13 Oct 2018 03:24:18 +0000 Received: from DB6PR0501MB2023.eurprd05.prod.outlook.com ([fe80::b1fb:bad3:b5b1:f913]) by DB6PR0501MB2023.eurprd05.prod.outlook.com ([fe80::b1fb:bad3:b5b1:f913%3]) with mapi id 15.20.1228.020; Sat, 13 Oct 2018 03:24:18 +0000 From: Jack Min To: Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" Thread-Topic: [PATCH v5 1/3] ethdev: add generic TTL rewrite actions Thread-Index: AQHUYqQ5UncSgm+Y502bB2au54DcjQ== Date: Sat, 13 Oct 2018 03:24:18 +0000 Message-ID: <20181013032348.26380-2-jackmin@mellanox.com> References: <20181011132641.1000-1-jackmin@mellanox.com> <20181013032348.26380-1-jackmin@mellanox.com> In-Reply-To: <20181013032348.26380-1-jackmin@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HK0PR03CA0012.apcprd03.prod.outlook.com (2603:1096:203:2e::24) To DB6PR0501MB2023.eurprd05.prod.outlook.com (2603:10a6:4:6::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [118.201.220.138] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR0501MB1990; 6:8PWOBPNPhOiiNTaKxlqHIC7tu1CMME3MIzVmApC6tAV6pyYYyRZI40SQ88q6Irpn8qSchN6xrBm5IskUyTFbVWyrYF46fVK86iqnkKM65Vnaa8zWQybYA5k4d1hPiUwjeR0GWKteXa/4A5PTQufbTqE1UMJ4JXgKswzjh7ssnOfHiPE1sR6sdRTTK4MPubOqQoihtnIWk/UGsVlon546VlA0MBjT3Z4KdUqZRx7OiKoGlRdeToxObxyIPnTO0nZSyZayKRfAnRUbT7Vcaow07tZ1BStSG7EsNUkG6tQr3zG6vi3dn7xHWXlm3Y+7s4+aXJeOtuR7/uvbafddZNcXKPPdmiDuHlEBs7Cxc1enVvmnBm9C9WLVRauHfUA+CSlPNIq+AkSo6ywjQstqkJUiJlIot9HfQ009sn4oD5HRVtm/eE4TO2eZcrDv273W3NhjNDK0h9qXkEZi0+mjqRQNfQ==; 5:mGY9j4TgOVjWKWNRHRGeIzKsWFrajzcIgJoQ3iXs5mytMfdI1mQhGXIwxUh6vy5Fxhe1a07QnI9ht+jyAZ8PoPQrnZqb6MplYkNFUWm566CbBFNp/1faAEv9ql7woMmPC6FeIeocEy3DrcZ+UFeuSUrKGlCH0UmQ2FZBzxFLv4w=; 7:P9ckOea8jF/BT0QQrRFQ35AomHyzymHS1gBN+copTK8XZ1cLzBbGim+e50OkLCYpjdBDcfi96QpzkYTaJKGd5rk0HNp8Tuumr9Tpc10Xi+Gmr54v5GCLQrFsAQgiB6Wb7jh3Ksz7/ZgZpiO4V8KttkJwni8as1gocHj4hXIydK/GM7T0jOyF+PC3zZ8azXeEEFLJASicqF3nQ4iZOJ8JOo7LultzpzjnI/71AqRYKCtAzwKXCYADl2svBTcQGySk x-ms-office365-filtering-correlation-id: 605a6666-1caa-47fc-468b-08d630bb5c18 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0501MB1990; x-ms-traffictypediagnostic: DB6PR0501MB1990: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231355)(944501410)(52105095)(10201501046)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991067); SRVR:DB6PR0501MB1990; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB1990; x-forefront-prvs: 082465FB26 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(366004)(39860400002)(136003)(189003)(199004)(5250100002)(25786009)(4326008)(8936002)(66066001)(256004)(68736007)(14454004)(11346002)(2616005)(36756003)(97736004)(6512007)(110136005)(316002)(6486002)(2906002)(71200400001)(6436002)(71190400001)(8676002)(81156014)(106356001)(6116002)(3846002)(478600001)(486006)(305945005)(7736002)(86362001)(81166006)(102836004)(105586002)(2900100001)(1076002)(26005)(186003)(476003)(99286004)(446003)(6506007)(386003)(5660300001)(76176011)(53936002)(52116002)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB1990; H:DB6PR0501MB2023.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: PAjBXkaXPTaeYvKFmwNgDY8etYSmNV+6xEuUeaFlgu6DZAVaBxMAvl5hBYGDc83EuFy/Syf6Adi9he76ZABOGZKAVUzB0aBZTOFg1bEEDJm3cYj175JwVGHvzXyWg3H2xVvNtVG2SLAyWjOmKCK8vuvFpz0FjcY9u83VwXht+B8AL7wnm8e8uWtg/g3IZY3cIX/CXjymnscdHpmUwoBrWkgoDmrtO6QRSBotrXpxFoNvt+mBqmDfdAdNu8ks0tn+wkOcXKLzLxrDpJAajPsqD3dR497OsU67umN5J58OV2tZF5RHGUIru3XfZovm6lWZs+TUUh9/EJuk0BWnqSkMkRRkf12lfgg1QdSsN7mb7sw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 605a6666-1caa-47fc-468b-08d630bb5c18 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Oct 2018 03:24:18.5991 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB1990 Subject: [dpdk-dev] [PATCH v5 1/3] ethdev: add generic TTL rewrite actions 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: Sat, 13 Oct 2018 03:24:22 -0000 rewrite TTL by decrease or just set it directly it's not necessary to check if the final result is zero or not This is slightly different from the one defined by openflow and more generic Signed-off-by: Xiaoyu Min Acked-by: Yongseok Koh --- doc/guides/prog_guide/rte_flow.rst | 30 +++++++++++++++++++++++++++++ lib/librte_ethdev/rte_flow.c | 2 ++ lib/librte_ethdev/rte_flow.h | 31 ++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte= _flow.rst index a5ec441c9..12f3eb794 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2203,6 +2203,36 @@ Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be = returned. | no properties | +---------------+ =20 +Action: ``DEC_TTL`` +^^^^^^^^^^^^^^^^^^^ + +Decrease TTL value. + +.. _table_rte_flow_action_dec_ttl: + +.. table:: DEC_TTL + + +---------------+ + | Field | + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ + | no properties | + +---------------+ + +Action: ``SET_TTL`` +^^^^^^^^^^^^^^^^^^^ + +Assigns a new TTL value. + +.. _table_rte_flow_action_set_ttl: + +.. table:: SET_TTL + + +---------------+--------------------+ + | Field | Value | + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ + | ``ttl_value`` | new TTL value | + +---------------+--------------------+ + Negative types ~~~~~~~~~~~~~~ =20 diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index bc9e719dc..5040c7667 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -136,6 +136,8 @@ static const struct rte_flow_desc_data rte_flow_desc_ac= tion[] =3D { MK_FLOW_ACTION(SET_TP_DST, sizeof(struct rte_flow_action_set_tp)), MK_FLOW_ACTION(MAC_SWAP, 0), + MK_FLOW_ACTION(DEC_TTL, 0), + MK_FLOW_ACTION(SET_TTL, sizeof(struct rte_flow_action_set_ttl)), }; =20 static int diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 68bbf57d0..f102e6939 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1579,6 +1579,26 @@ enum rte_flow_action_type { * No associated configuration structure. */ RTE_FLOW_ACTION_TYPE_MAC_SWAP, + + /** + * Decrease TTL value directly + * + * If flow pattern doesn't define a valid RTE_FLOW_ITEM_TYPE_IPV4, or + * RTE_FLOW_ITEM_TYPE_IPV6, the PMD should return a + * RTE_FLOW_ERROR_TYPE_ACTION error. + */ + RTE_FLOW_ACTION_TYPE_DEC_TTL, + + /** + * Set TTL value + * + * If flow pattern doesn't define a valid RTE_FLOW_ITEM_TYPE_IPV4, or + * RTE_FLOW_ITEM_TYPE_IPV6, the PMD should return a + * RTE_FLOW_ERROR_TYPE_ACTION error. + * + * See struct rte_flow_action_set_ttl + */ + RTE_FLOW_ACTION_TYPE_SET_TTL, }; =20 /** @@ -1987,6 +2007,17 @@ struct rte_flow_action_set_tp { rte_be16_t port; }; =20 +/** + * RTE_FLOW_ACTION_TYPE_SET_TTL + * + * Set the TTL value directly for IPv4 or IPv6 + * The RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6 + * must be present in pattern + */ +struct rte_flow_action_set_ttl { + uint8_t ttl_value; +}; + /* * Definition of a single action. * --=20 2.17.1