From patchwork Thu Mar 30 08:17:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Yerramneni X-Patchwork-Id: 1763086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=sH+1dICk; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=JmypByK4; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PnGWG2J7Yz1yYx for ; Thu, 30 Mar 2023 19:17:46 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2CB1B41F9A; Thu, 30 Mar 2023 08:17:43 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2CB1B41F9A Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=sH+1dICk; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=JmypByK4 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lYYodegShiak; Thu, 30 Mar 2023 08:17:41 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 69D6041ED9; Thu, 30 Mar 2023 08:17:40 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 69D6041ED9 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 25367C0036; Thu, 30 Mar 2023 08:17:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id CB947C002F for ; Thu, 30 Mar 2023 08:17:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A099F842AC for ; Thu, 30 Mar 2023 08:17:38 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A099F842AC Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=sH+1dICk; dkim=pass (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=JmypByK4 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GtJxwYZCd0ji for ; Thu, 30 Mar 2023 08:17:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org BE0AC841B5 Received: from mx0a-002c1b01.pphosted.com (mx0a-002c1b01.pphosted.com [148.163.151.68]) by smtp1.osuosl.org (Postfix) with ESMTPS id BE0AC841B5 for ; Thu, 30 Mar 2023 08:17:36 +0000 (UTC) Received: from pps.filterd (m0127838.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32U6MgXi018196; Thu, 30 Mar 2023 01:17:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=aDHYmQ+Ta1HYR4bLlkduiC+j+gbByeUbVcMSC3tziw8=; b=sH+1dICkn2v8a120wLQCxOylmW8WmWLmZzc/z1uY9621Cyw7Lj9Db1XRwsSHbmYM2ftH 3GchW7Zo8rQcO/GU87A7i+cfsIDr3pvU8zIwbDxHmytPvPjrn5YHY0Kj1lVbJ9/1aBYv aRuxrhdYFZtEeQY53zxn/5aRy2HYaV5a2ViLDS27kq022KGFWIBM23xEzgGUrb0hvaWp CYDAMHweZrYLeSAWy7u1DIZqOgBcP8Pa9y9FCo8XSz7HkpDh54wqeJXO78jl7O1hqBZ3 vcHi8xeoWB6ySmdEOQKwj2F28UY9JdTQ3C1Xqijt+MJky1CI50iMe2Oq7qu3Pbr6JV+3 pQ== Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3pj0h0sw92-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Mar 2023 01:17:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BDvi9kP+5muIOzW6PVy2H3vOcvcKlSGd9pX8O+wWRvQNb7TAjmo3SiFvZ+BQ6ex/lTbbQ5sn/AxtCWNq0tuQLET1qGmQ59jBFiwWVYAEgUrvbp5KYHkPqHqxS0+wrLyShQf7v5KxL1o5Tzlb7b1CH48nS5KizU6Ra+IkcsAWvhmkOCZ4h/aVSoYSfp1spOO0O4OkUuSo+rm2tIv/jP21PxelycJiHDHrmwAfQSCchPg9xdLY8e321Vf4zCKmV2yGSy+DeYOXUCdEoWZPVBP6gKBhv9ZsFbR01J5sMGyrIw3vhZHz6wqT6M4WXHho5TNhY/hSBBraNvSotrn1G28URQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aDHYmQ+Ta1HYR4bLlkduiC+j+gbByeUbVcMSC3tziw8=; b=NC3VA5SnPsGaBAUYN9pDxrGrGEWrQ2Vz0k65ghrVTlH+MKSyi+RVgbphH2bGCPjJYdyXoRZN2DruWBpx9kbFcdSqP9yj6pni7iSY7m+BqW9c9HKiO81ZE2FJAVQ5wMi5LM+/RELCtfiK7H2znGLWtx8fEz6JikxWnpQAQhVOvISZFN1cHOHV95Zd7/WwfhWnUt3vmINKLkn4qDsIVZsVwDszD+tm83TelJnucLN97q1eC4GpmqRV8HZaVZdCwFI0PdLgACx1U5+elVP+DfXJ5fa5Fr25XXB/EYM36G7MZTLDt7AlXg830C4HsN7oBK8xO/qU556zkuGfnDqFdBFiAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aDHYmQ+Ta1HYR4bLlkduiC+j+gbByeUbVcMSC3tziw8=; b=JmypByK4WCUSe2cIfpM2RHA6zUcRngwQCNg7+0slt5TjBLwMxq+8n00NKSF6/xGUNgTaRdpJVyhs90iACfDlS/IxyD/K5kWsLRb2bNmPwDGP2aTK1zDsIr8v13/VFLz1uhhP31NXBoqdKt67osegknsJi+duo9IvhTOuE8WBoYPSx9Y9XefCjkSjm1v++ysJtMQAuaDa2M2T6rQpVQVb1yc2G0Q7gcRYIrNSvNVe2Oh+6G860s9qfBh/CSqIBetFkXwJ6Me/nsSIpMXVhtWYWa7EF5fgprIK8Zx2a+ayOK1un8QEo95ImExlpwZwC8klRBCmDoZrTOLwcjtuT5gfHw== Received: from PH0PR02MB7799.namprd02.prod.outlook.com (2603:10b6:510:5d::22) by BY5PR02MB7028.namprd02.prod.outlook.com (2603:10b6:a03:233::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.33; Thu, 30 Mar 2023 08:17:30 +0000 Received: from PH0PR02MB7799.namprd02.prod.outlook.com ([fe80::126e:88bd:97e7:66b3]) by PH0PR02MB7799.namprd02.prod.outlook.com ([fe80::126e:88bd:97e7:66b3%5]) with mapi id 15.20.6222.035; Thu, 30 Mar 2023 08:17:30 +0000 From: Naveen Yerramneni To: dev@openvswitch.org Date: Thu, 30 Mar 2023 08:17:18 +0000 Message-Id: <20230330081718.196496-1-naveen.yerramneni@nutanix.com> X-Mailer: git-send-email 2.22.3 X-ClientProxiedBy: MN2PR01CA0054.prod.exchangelabs.com (2603:10b6:208:23f::23) To PH0PR02MB7799.namprd02.prod.outlook.com (2603:10b6:510:5d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR02MB7799:EE_|BY5PR02MB7028:EE_ X-MS-Office365-Filtering-Correlation-Id: 64c659d2-c39c-45af-8782-08db30f73498 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eE+NFUT8Zb7TOI8fPqiMj9oGS04HZFzSODxyLpS1umni4g2nWgIB2cuVEWXIPnb5esGxihaEri2nped94I3j/YkRnOqlHB5tWe/zhmPezAYBRKu84KLwaF5fhV1vOSC6nj74cuA6BZ3stFvjIuGCyYr34jLUupayAM3J1UrUPYZAZEcb4qiYvYE4tRBvBX9nCy87rXfMd+d17AWPx3XVvfrSJADFCOwpbgpjcHNxJeFodfb5/5cqG2THacl1McUqu9CQf9HYIJ0V039zORA/ersbJJqjSGQF9k6PrQ0n/vcbG7lvXVjyt5XhpaszpWSP6aBclJIX3BN2/e/yhCiT02yj8XPvdFz4B9NWJGRMxR2dOD4LF/+RsmXtYYoYTtYNo+uKKPfujIEsNzzjkZ5ZTuvShymrO0sLKdTudXtc7P09pF60pHEUGjZk6fadaW6XdK+FYy4l7A0tkiuOtluEe4e3agRZzCgncrrylzFz5tdwa774Qjtu9TN/mrU37EvnnSRaTJWl6ywEeM4vi5rhIH2kVvHW/CfgdLlZlAn1p7flZTHt+EolDM3lqJxcflwgYZDDcAoL2akayv1JEGBIm4Ofg1r5I1er4OvOo/qgmsW3bDAdrsw62zX6UA1aqWfXGHeZIH/wYetOib7u4rKKuhe7yRkvg7iYGjno4UqVbFI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR02MB7799.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(346002)(396003)(376002)(39850400004)(366004)(451199021)(2906002)(38100700002)(38350700002)(44832011)(30864003)(52116002)(41300700001)(66556008)(316002)(66476007)(8676002)(36756003)(66946007)(6916009)(54906003)(6486002)(5660300002)(4326008)(478600001)(8936002)(2616005)(186003)(6666004)(26005)(6506007)(1076003)(86362001)(83380400001)(6512007)(21314003)(505234007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ik9XOuPn4F6iibzl/snZVy7kCF/bK9f2zclIO27F6CcSyxA4GD8fan4IoWP6F08En4oT7mLpNJQO3OuB0+IhmNHXKulClTpJCkeFCZ0f3FZvO6wnyNsdMH/mEogfPddFV35hqeQrA6tuvyvUexE8XAHhz2tdU9EyFHTJSt+kTU67oNRuMVjzNHhPK+cGeEjJNB6dJwM0+6KMEQEFcuePw0I8GBO1grFCBX6dqpAFv74Pxioav37hLf4FU93x5+VYN0tduuNz2QAoqERx2xobGtnvpAw9mYj+O8bwmf96NBw+uSRUpyfHYrg14MP8o+I0Q51PwhaHJK6ixS4moKlMxWffyLpg39lBPubgXaBIZRrOequ/+WJOdOhiSVX4FiOQHc5lslXBFb5seKAJXyZGT4on7WKjHPLSsDHLwbG4Cmmk4uqvwXWEXu/nDmCEKUT9WYovxctRc7P9Q3d31xkkhWRz65sgdu3YzFRriWwUd0GSfTs5UAoBOXe4liU+MPEPBMK5i+YZ/qxDBdp0XpEeZ9ZqaFoIHK7b4U7sTceLx7ppZSymi1tHy5j/Fwbo6XC80lznj28movn2BHBVbGpLPwSWFDmfUYukhdN4OCkNKaQy12480BUo/rJ38dX5cQ9LqzvGewdwI/Wa8uShIuz0UmeZ/tVX2p1nudmhms+X+WwDN3qtJcTabMilY9WSDal+763w+Qncn5NO3wA2Y6uNW46uODq/XfU23PYIIehYa9OxeDT7vUE5OnVqn5PsZGqybNnPK4TJKwFMcZE58D9A8kJE5XsLIpCPHqNfNEfQlWSlQhpOM8RMt82Ccf2UTneYtxoKn23Ha8yLcX3N0uClG7iqrnWnpQHlZFmjfHrorcpiwMVuSUrjiB5vbZibdAmWgORGkvx5f4jo/jxP1KKdVPzwEpph4GHa2MPs+ofXTjsa6QO8KdfVvTWfAXbxnlBdRNV4m8r+m31Vy59JP8sy5pb4f1KU3yoR1Ud0pHy0OO0z9F7MyGVSyIPAa/rGAvfj9JSvvRUQGZl0owqUWGkylKq8JXWh8PTfoDifMKm3qsjpWsoyzQwIIZ2lirFYyM4FH/k7Wyfj/+DIJrTc++HKOx9GB/SRRpZcf9JysJnn4olRHmZhBu9VTJJk2mz1k5prfD0Z1kz/UY3KlucSIeUS05rzgIKxnHQdnUm4+RFuCLYJ8dfugOIefbfv6frzRZD+m6F2pkWk1JvuK74nYvF4ITqlq/H2paYvJhXnNQrzH/iRgXjm/bwz5k23Ne0srgPz2llKHwLY7eaJPDoNEct5rTmPPzeVmnblhPwUuJTnDejBCk9g/nrXmxzB0pD4wWzn7A7f0tV9M0ozl2P8OLSadXFLAGIwO+rQ2cSvQcHRW3g0tnF8m5ZAGJOTvtUI71RrelrFgJISRO8XCe9EU2w5rQKWepxj/c5tN735h6dpzUL0zlIdh+pMFbrihCFv1kU6rhbhAXXUrRTmi29bHqbj66gpxYqeBfAtXALaF7aBY5BMnWh10IvtdUtSDKpncoIjK/7XrhNG3IhwYWo4rMNb+Ccfb6TMT/F8uIrVhbaTIJzGgkmGV+XKmhBlJaOQaoj+fqlzzpnx2mZP4Br1cV17aImfjwMmgO2SrNrHUdOuB6k= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64c659d2-c39c-45af-8782-08db30f73498 X-MS-Exchange-CrossTenant-AuthSource: PH0PR02MB7799.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 08:17:30.3545 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7ocJl8QtpT6IO/W9hWFhVLatSHXFLGS/KXLFD8da1Df8VOAa4AAAHswvlVYvOeSI2u+PAgc8pbYjgKVP9XxulD67cfCiqHL46cff+/tzmTg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB7028 X-Proofpoint-GUID: lpp0d_m1DqmcPbNKvCKSBTMbAr0Mi9KB X-Proofpoint-ORIG-GUID: lpp0d_m1DqmcPbNKvCKSBTMbAr0Mi9KB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-30_03,2023-03-30_01,2023-02-09_01 X-Proofpoint-Spam-Reason: safe Cc: Simon Horman Subject: [ovs-dev] [PATCH v4] OpenFlow: Add extn to set conntrack entries limit per zone. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add OpenFlow extn to set conntrack entries limit per zone. This extn will be used in future to set the zone level limit for drop zones used by OVN. Signed-off-by: Naveen Yerramneni Reviewed-by: Simon Horman Signed-off-by: Naveen Yerramneni > Reviewed-by: Simon Horman > --- Notes: v1 -> v2 - Fix memory leak and added logs v2 -> v3 - Addressed nits v3 -> v4 - Updated change description NEWS | 2 ++ include/openflow/nicira-ext.h | 10 ++++++++++ include/openvswitch/ofp-msgs.h | 4 ++++ lib/ofp-bundle.c | 1 + lib/ofp-print.c | 11 +++++++++++ lib/rconn.c | 1 + ofproto/ofproto-dpif.c | 21 +++++++++++++++++++++ ofproto/ofproto-provider.h | 4 ++++ ofproto/ofproto.c | 25 +++++++++++++++++++++++++ tests/ofp-print.at | 10 ++++++++++ tests/ovs-ofctl.at | 12 ++++++++++++ utilities/ovs-ofctl.8.in | 5 +++++ utilities/ovs-ofctl.c | 34 ++++++++++++++++++++++++++++++++++ 13 files changed, 140 insertions(+) diff --git a/NEWS b/NEWS index fe6055a27..f6ae60856 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,8 @@ v3.1.0 - xx xxx xxxx - OpenFlow: * New OpenFlow extension NXT_CT_FLUSH to flush connections matching the specified fields. + * New OpenFlow extension NXT_CT_SET_ZONE_LIMIT to set conntrack table + limit at zone level. - ovs-ctl: * New option '--dump-hugepages' to include hugepages in core dumps. This can assist with postmortem analysis involving DPDK, but may also produce diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h index 768775898..0f93ea21c 100644 --- a/include/openflow/nicira-ext.h +++ b/include/openflow/nicira-ext.h @@ -1101,4 +1101,14 @@ struct nx_ct_flush { }; OFP_ASSERT(sizeof(struct nx_ct_flush) == 8); +/* NXT_CT_SET_ZONE_LIMIT. + * + * Sets connection tracking table zone limit. */ +struct nx_ct_zone_limit { + uint8_t zero[2]; /* Must be zero. */ + ovs_be16 zone_id; /* Connection tracking zone. */ + ovs_be32 limit; /* Drop limit. */ +}; +OFP_ASSERT(sizeof(struct nx_ct_zone_limit) == 8); + #endif /* openflow/nicira-ext.h */ diff --git a/include/openvswitch/ofp-msgs.h b/include/openvswitch/ofp-msgs.h index 708427fc0..a9518557e 100644 --- a/include/openvswitch/ofp-msgs.h +++ b/include/openvswitch/ofp-msgs.h @@ -518,6 +518,9 @@ enum ofpraw { /* NXT 1.0+ (32): struct nx_ct_flush, uint8_t[8][]. */ OFPRAW_NXT_CT_FLUSH, + /* NXT 1.0+ (35): struct nx_ct_zone_limit. */ + OFPRAW_NXT_CT_SET_ZONE_LIMIT, + /* NXST 1.0+ (3): void. */ OFPRAW_NXST_IPFIX_BRIDGE_REQUEST, @@ -776,6 +779,7 @@ enum ofptype { OFPTYPE_IPFIX_FLOW_STATS_REPLY, /* OFPRAW_NXST_IPFIX_FLOW_REPLY */ OFPTYPE_CT_FLUSH_ZONE, /* OFPRAW_NXT_CT_FLUSH_ZONE. */ OFPTYPE_CT_FLUSH, /* OFPRAW_NXT_CT_FLUSH. */ + OFPTYPE_CT_SET_ZONE_LIMIT, /* OFPRAW_NXT_CT_SET_ZONE_LIMIT. */ /* Flow monitor extension. */ OFPTYPE_FLOW_MONITOR_CANCEL, /* OFPRAW_NXT_FLOW_MONITOR_CANCEL. diff --git a/lib/ofp-bundle.c b/lib/ofp-bundle.c index 941a8370e..3ed1f30d8 100644 --- a/lib/ofp-bundle.c +++ b/lib/ofp-bundle.c @@ -293,6 +293,7 @@ ofputil_is_bundlable(enum ofptype type) case OFPTYPE_IPFIX_FLOW_STATS_REPLY: case OFPTYPE_CT_FLUSH_ZONE: case OFPTYPE_CT_FLUSH: + case OFPTYPE_CT_SET_ZONE_LIMIT: break; } diff --git a/lib/ofp-print.c b/lib/ofp-print.c index 874079b84..8a64b72c0 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -967,6 +967,15 @@ ofp_print_nxt_ct_flush(struct ds *string, const struct ofp_header *oh) return 0; } +static enum ofperr +ofp_print_nxt_ct_set_zone_limit(struct ds *string, + const struct nx_ct_zone_limit *nzl) +{ + ds_put_format(string, " zone_id=%"PRIu16, ntohs(nzl->zone_id)); + ds_put_format(string, " limit=%"PRIu32, ntohl(nzl->limit)); + return 0; +} + static enum ofperr ofp_to_string__(const struct ofp_header *oh, const struct ofputil_port_map *port_map, @@ -1204,6 +1213,8 @@ ofp_to_string__(const struct ofp_header *oh, return ofp_print_nxt_ct_flush_zone(string, ofpmsg_body(oh)); case OFPTYPE_CT_FLUSH: return ofp_print_nxt_ct_flush(string, oh); + case OFPTYPE_CT_SET_ZONE_LIMIT: + return ofp_print_nxt_ct_set_zone_limit(string, ofpmsg_body(oh)); } return 0; diff --git a/lib/rconn.c b/lib/rconn.c index 4afa21515..91c982d98 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -1427,6 +1427,7 @@ is_admitted_msg(const struct ofpbuf *b) case OFPTYPE_IPFIX_FLOW_STATS_REPLY: case OFPTYPE_CT_FLUSH_ZONE: case OFPTYPE_CT_FLUSH: + case OFPTYPE_CT_SET_ZONE_LIMIT: default: return true; } diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index f87e27a8c..b0a66ef10 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -5631,6 +5631,26 @@ ct_del_zone_timeout_policy(const char *datapath_type, uint16_t zone_id) } } +static void +ct_set_zone_limit(const struct ofproto *ofproto_, const uint16_t zone_id, + const uint32_t limit) +{ + struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_); + struct ovs_list zone_limits = OVS_LIST_INITIALIZER(&zone_limits); + + ct_dpif_push_zone_limit(&zone_limits, zone_id, limit, 0); + int err = ct_dpif_set_limits(ofproto->backer->dpif, NULL, &zone_limits); + if (err) { + VLOG_ERR_RL(&rl, "failed to set zone limit id=%"PRIu16", " + "limit=%"PRIu32" (%s)", zone_id, limit, + ovs_strerror(err)); + } else { + VLOG_DBG("configured zone limit for zone=%"PRIu16", limit=%"PRIu32"", + zone_id, limit); + } + ct_dpif_free_zone_limits(&zone_limits); +} + static void get_datapath_cap(const char *datapath_type, struct smap *cap) { @@ -6920,4 +6940,5 @@ const struct ofproto_class ofproto_dpif_class = { ct_flush, /* ct_flush */ ct_set_zone_timeout_policy, ct_del_zone_timeout_policy, + ct_set_zone_limit, /* ct_set_zone_limit */ }; diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index a84ddc1d0..c66623637 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -1916,6 +1916,10 @@ struct ofproto_class { /* Deletes the timeout policy associated with 'zone' in datapath type * 'dp_type'. */ void (*ct_del_zone_timeout_policy)(const char *dp_type, uint16_t zone); + + /* Sets conntrack zone limit */ + void (*ct_set_zone_limit)(const struct ofproto *, const uint16_t zone, + const uint32_t limit); }; extern const struct ofproto_class ofproto_dpif_class; diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index e4a1bee76..e8e884937 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -966,6 +966,28 @@ handle_nxt_ct_flush(struct ofconn *ofconn, const struct ofp_header *oh) return 0; } +static enum ofperr +handle_nxt_ct_set_zone_limit(struct ofconn *ofconn, + const struct ofp_header *oh) +{ + struct ofproto *ofproto = ofconn_get_ofproto(ofconn); + const struct nx_ct_zone_limit *nzl = ofpmsg_body(oh); + + if (!is_all_zeros(nzl->zero, sizeof nzl->zero)) { + return OFPERR_NXBRC_MUST_BE_ZERO; + } + + uint16_t zone_id = ntohs(nzl->zone_id); + uint32_t limit = ntohl(nzl->limit); + if (ofproto->ofproto_class->ct_set_zone_limit) { + ofproto->ofproto_class->ct_set_zone_limit(ofproto, zone_id, limit); + } else { + return EOPNOTSUPP; + } + + return 0; +} + void ofproto_set_flow_restore_wait(bool flow_restore_wait_db) { @@ -8814,6 +8836,9 @@ handle_single_part_openflow(struct ofconn *ofconn, const struct ofp_header *oh, case OFPTYPE_CT_FLUSH: return handle_nxt_ct_flush(ofconn, oh); + case OFPTYPE_CT_SET_ZONE_LIMIT: + return handle_nxt_ct_set_zone_limit(ofconn, oh); + case OFPTYPE_HELLO: case OFPTYPE_ERROR: case OFPTYPE_FEATURES_REPLY: diff --git a/tests/ofp-print.at b/tests/ofp-print.at index 14aa55416..5c45e1ec6 100644 --- a/tests/ofp-print.at +++ b/tests/ofp-print.at @@ -4181,3 +4181,13 @@ AT_CHECK([ovs-ofctl ofp-print "\ 00 00 00 14 00 00 00 00 00 00 00 00 00 00 ff ff 0a 0a 00 02 00 00 00 00 \ " | grep -q OFPBPC_BAD_VALUE], [0]) AT_CLEANUP + +AT_SETUP([NXT_CT_SET_ZONE_LIMIT]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 18 00 00 00 03 00 00 23 20 00 00 00 23 \ +00 00 00 12 00 01 86 a0 \ +"], [0], [dnl +NXT_CT_SET_ZONE_LIMIT (xid=0x3): zone_id=18 limit=100000 +]) +AT_CLEANUP diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 8531b2e2e..8a17d3609 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -3309,3 +3309,15 @@ AT_CHECK([grep -q "ct_dpif|DBG|.*ct_flush: " ovs-vswitchd.log]) OVS_VSWITCHD_STOP AT_CLEANUP + + +AT_SETUP([ovs-ofctl ct-set-zone-limit]) +OVS_VSWITCHD_START + +AT_CHECK([ovs-appctl vlog/set ct_dpif:dbg]) +AT_CHECK([ovs-ofctl ct-set-zone-limit br0 1 200000]) + +OVS_WAIT_UNTIL([grep -q "ofproto_dpif|DBG|.*zone=1.*limit=200000" ovs-vswitchd.log]) +AT_CHECK([grep -q "ofproto_dpif|DBG|.*zone=1.*limit=200000" ovs-vswitchd.log]) +OVS_VSWITCHD_STOP +AT_CLEANUP diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in index 0a611b2ee..8a6d5a3db 100644 --- a/utilities/ovs-ofctl.8.in +++ b/utilities/ovs-ofctl.8.in @@ -326,6 +326,11 @@ An example of an IPv6 TCP \fIct-[orig|reply]-tuple\fR: .IP This command uses an Open vSwitch extension that is only in Open vSwitch 3.1 and later. +.IP "\fBct\-set\-zone\-limit \fIswitch zone limit\fR +Set the connection tracking entries limit in \fIzone\fR on \fIswitch\fR. +.IP +This command uses an Open vSwitch extension that is only in Open +vSwitch 3.1 and later. . .SS "OpenFlow Switch Flow Table Commands" . diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index eabec18a3..1464827bb 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -489,6 +489,8 @@ usage(void) " ct-flush SWITCH [ZONE] [CT_ORIG_TUPLE [CT_REPLY_TUPLE]]\n" " flush conntrack entries specified\n" " by CT_ORIG/REPLY_TUPLE and ZONE\n" + " ct-set-zone-limit SWITCH ZONE LIMIT set conntrack entries\n" + " limit for the ZONE\n" "\nFor OpenFlow switches and controllers:\n" " probe TARGET probe whether TARGET is up\n" " ping TARGET [N] latency of N-byte echos\n" @@ -3098,6 +3100,35 @@ ofctl_ct_flush(struct ovs_cmdl_context *ctx) vconn_close(vconn); } +static void +ofctl_ct_set_zone_limit(struct ovs_cmdl_context *ctx) +{ + uint16_t zone_id; + uint32_t limit; + + char *error = str_to_u16(ctx->argv[2], "zone_id", &zone_id); + if (error) { + ovs_fatal(0, "%s", error); + } + error = str_to_u32(ctx->argv[3], &limit); + if (error) { + ovs_fatal(0, "%s", error); + } + + struct vconn *vconn; + open_vconn(ctx->argv[1], &vconn); + enum ofp_version version = vconn_get_version(vconn); + + struct ofpbuf *msg = ofpraw_alloc(OFPRAW_NXT_CT_SET_ZONE_LIMIT, version, + 0); + struct nx_ct_zone_limit *nzl = ofpbuf_put_zeros(msg, sizeof *nzl); + nzl->zone_id = htons(zone_id); + nzl->limit = htonl(limit); + + transact_noreply(vconn, msg); + vconn_close(vconn); +} + static void ofctl_dump_ipfix_flow(struct ovs_cmdl_context *ctx) { @@ -5114,6 +5145,9 @@ static const struct ovs_cmdl_command all_commands[] = { { "ct-flush", "switch [zone=N] [ct-orig-tuple [ct-reply-tuple]]", 1, 4, ofctl_ct_flush, OVS_RO }, + { "ct-set-zone-limit", "switch zone limit", + 3, 3, ofctl_ct_set_zone_limit, OVS_RO }, + { "ofp-parse", "file", 1, 1, ofctl_ofp_parse, OVS_RW }, { "ofp-parse-pcap", "pcap",