From patchwork Wed Aug 11 21:09:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Borges de Freitas X-Patchwork-Id: 1516028 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=JxN7xopb; 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GlMrc4CyMz9sXS for ; Thu, 12 Aug 2021 07:09:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B73594059F; Wed, 11 Aug 2021 21:09:15 +0000 (UTC) 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 3aezTu9FFlmT; Wed, 11 Aug 2021 21:09:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id EFE9F405A6; Wed, 11 Aug 2021 21:09:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BE10CC0010; Wed, 11 Aug 2021 21:09:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6F275C000E for ; Wed, 11 Aug 2021 21:09:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5477240343 for ; Wed, 11 Aug 2021 21:09:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uq0HI_ys2wDT for ; Wed, 11 Aug 2021 21:09:07 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by smtp2.osuosl.org (Postfix) with ESMTPS id 1D110400CB for ; Wed, 11 Aug 2021 21:09:07 +0000 (UTC) Received: by mail-wm1-x32e.google.com with SMTP id i10-20020a05600c354ab029025a0f317abfso5410278wmq.3 for ; Wed, 11 Aug 2021 14:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=4aTt0JNUkDDa+6HC0bihY5qY7oMNDcOXs1bw4usADRE=; b=JxN7xopbp+91WL0d2oBvo9jYcfx+a6rFnrcz84hlV9EoRYh8+HxN++E5U6MROiXsKu 1PnBSzUQtG5/gaMdnvO2OKFVirioBVNZhJ4CVv6WiHcIq/c7t+T+CmUV2P+7JE5eSRuZ Kom26i/41DERTmxKi7+g3OYUUeaOennEf87t/hCnZnNTNDwF5JrfCO5RfcLVMYZEHkFV p98jl1sHwT8WVisvweP0RLdIAXrzCWrFoqKxeJgNHh4km21o5+vrPYt+rWrEAD0NXE4S 4Tfd+39x2FpI9H0qZGH+eQqAPB7KIEGSD2OozfOIqMSn07Nz3+zxL7O9okbqpXN/Lz0m UZ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4aTt0JNUkDDa+6HC0bihY5qY7oMNDcOXs1bw4usADRE=; b=QovmZPBf7lb0bo+ZJsc2fUHKDyJYm1DbIj4cx9JAA95QIeV+qwhuB0GF+SHINAc4Rt QIYUVnPtqFpUq6zB49NaHoju7dbyPEVJ6E7/UnBu9a8p7zDs3SmAY8kYuNweU/1UIGdY OB5W4njGR+WYOdeqvIVqaElC5oJl2UMl/vEpXolFDy+T6n2p//7eyPXYo1f/aVRmW89f sh+koQy1I/ZFwlfbPx3tIRBuWApx/4AC/j7ug6HAW/XlOHhAA5ipCZF+aEmxvZsq3ubY 0cqgYdjcuwMOcMvFYOT5b7R54zIHiIFbwDe6Dx5it6lnu5130jYp0iep0Hg+WaUqH0L/ G+yw== X-Gm-Message-State: AOAM5321LLiZgzyQf5VDvjf8iEBE/raN6LGqM5MbccUnEfqk7xusoCvw hV5mVgkZJTSRnN29KWTmJeeXDuckruNikRPy X-Google-Smtp-Source: ABdhPJwQ/YVrGl7ZMXDQtruKoCgEZidALl2WmIOM+TygyCyVxi+OSCiDJLUUM3/HlIVDMXJBSpz/DQ== X-Received: by 2002:a7b:ce8a:: with SMTP id q10mr483457wmj.155.1628716144958; Wed, 11 Aug 2021 14:09:04 -0700 (PDT) Received: from localhost.localdomain (arl-84-90-177-66.netvisao.pt. [84.90.177.66]) by smtp.gmail.com with ESMTPSA id z5sm324911wmi.36.2021.08.11.14.09.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Aug 2021 14:09:04 -0700 (PDT) From: miguelborgesdefreitas@gmail.com X-Google-Original-From: miguel-r-freitas@alticelabs.com To: dev@openvswitch.org Date: Wed, 11 Aug 2021 22:09:03 +0100 Message-Id: <20210811210903.86829-1-miguel-r-freitas@alticelabs.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210809112108.40708-1-miguel-r-freitas@alticelabs.com> References: <20210809112108.40708-1-miguel-r-freitas@alticelabs.com> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH v2] openflow: allow to configure ofp_desc fields on bridge other_config 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" From: Miguel Borges de Freitas Allow to configure all the missing ofp_desc fields (mfr_desc, hw_desc, sw_desc) on the bridge other_config. Default values are still used (Nicira, Inc.; Open vSwitch; current ovs version) if no values are configured. Rationale: SDN controllers such as ONOS make use of the information provided from the switch in the reply to OFPMP_DESC to load SDN controller drivers that define and control the pipeline (i.e. the sequence of tables and what match fields/actions are available in certain tables). Most of these drivers (if not all) are compatible with openvswitch. Some of them, for instance ofdpa-ovs are even designed to emulate physical pipelines (ofdpa) on top of the OVS dataplane. It'd be nice that we could configure those fields on OVS so that the appropriate driver is loaded automatically when ovs attempts to connect to the controller, avoiding driver hot-reload which is prone to cause errors. Signed-off-by: Miguel Borges de Freitas --- ofproto/ofproto.c | 21 +++++++++++++++++++++ ofproto/ofproto.h | 3 +++ vswitchd/bridge.c | 30 +++++++++++++++++------------- vswitchd/vswitch.xml | 21 +++++++++++++++++++++ 4 files changed, 62 insertions(+), 13 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index bd6103b1c..a523f4a67 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -796,6 +796,27 @@ ofproto_set_threads(int n_handlers_, int n_revalidators_) n_handlers = MAX(n_handlers_, 0); } +void +ofproto_set_mfr_desc(struct ofproto *p, const char *mfr_desc) +{ + free(p->mfr_desc); + p->mfr_desc = nullable_xstrdup(mfr_desc); +} + +void +ofproto_set_hw_desc(struct ofproto *p, const char *hw_desc) +{ + free(p->hw_desc); + p->hw_desc = nullable_xstrdup(hw_desc); +} + +void +ofproto_set_sw_desc(struct ofproto *p, const char *sw_desc) +{ + free(p->sw_desc); + p->sw_desc = nullable_xstrdup(sw_desc); +} + void ofproto_set_dp_desc(struct ofproto *p, const char *dp_desc) { diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index b0262da2d..e1e02383d 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -350,6 +350,9 @@ int ofproto_port_set_mcast_snooping(struct ofproto *ofproto, void *aux, void ofproto_set_threads(int n_handlers, int n_revalidators); void ofproto_type_set_config(const char *type, const struct smap *other_config); +void ofproto_set_mfr_desc(struct ofproto *, const char *mfr_desc); +void ofproto_set_hw_desc(struct ofproto *, const char *hw_desc); +void ofproto_set_sw_desc(struct ofproto *, const char *sw_desc); void ofproto_set_dp_desc(struct ofproto *, const char *dp_desc); void ofproto_set_serial_desc(struct ofproto *p, const char *serial_desc); int ofproto_set_snoops(struct ofproto *, const struct sset *snoops); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index cb7c5cb76..ab0b1295d 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -287,8 +287,7 @@ static void bridge_configure_sflow(struct bridge *, int *sflow_bridge_number); static void bridge_configure_ipfix(struct bridge *); static void bridge_configure_spanning_tree(struct bridge *); static void bridge_configure_tables(struct bridge *); -static void bridge_configure_dp_desc(struct bridge *); -static void bridge_configure_serial_desc(struct bridge *); +static void bridge_configure_ofp_desc(struct bridge *); static void bridge_configure_aa(struct bridge *); static void bridge_aa_refresh_queued(struct bridge *); static bool bridge_aa_need_refresh(struct bridge *); @@ -942,8 +941,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg) bridge_configure_ipfix(br); bridge_configure_spanning_tree(br); bridge_configure_tables(br); - bridge_configure_dp_desc(br); - bridge_configure_serial_desc(br); + bridge_configure_ofp_desc(br); bridge_configure_aa(br); } free(managers); @@ -4123,17 +4121,23 @@ bridge_configure_tables(struct bridge *br) } static void -bridge_configure_dp_desc(struct bridge *br) -{ - ofproto_set_dp_desc(br->ofproto, - smap_get(&br->cfg->other_config, "dp-desc")); -} - -static void -bridge_configure_serial_desc(struct bridge *br) -{ +bridge_configure_ofp_desc(struct bridge *br) +{ + /* Manufacturer description */ + ofproto_set_mfr_desc(br->ofproto, + smap_get(&br->cfg->other_config, "mfr-desc")); + /* Hardware description */ + ofproto_set_hw_desc(br->ofproto, + smap_get(&br->cfg->other_config, "hw-desc")); + /* Software description */ + ofproto_set_sw_desc(br->ofproto, + smap_get(&br->cfg->other_config, "sw-desc")); + /* Serial number */ ofproto_set_serial_desc(br->ofproto, smap_get(&br->cfg->other_config, "dp-sn")); + /* DP description */ + ofproto_set_dp_desc(br->ofproto, + smap_get(&br->cfg->other_config, "dp-desc")); } static struct aa_mapping * diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 026b5e2ca..dbe8f8f02 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1309,6 +1309,27 @@ prefix or be exactly 16 hex digits long. May not be all-zero. + + Manufacturer description. Defaults to "Nicira, Inc.". + The value is returned by the switch as a part of reply to OFPMP_DESC + request (ofp_desc). The OpenFlow specification (e.g. 1.3.5) describes + the ofp_desc structure to contaion "NULL terminated ASCII strings". + + + + Hardware description. Defaults to "Open vSwitch". + The value is returned by the switch as a part of reply to OFPMP_DESC + request (ofp_desc). The OpenFlow specification (e.g. 1.3.5) describes + the ofp_desc structure to contaion "NULL terminated ASCII strings". + + + + Software description. Defaults to the current Open vSwitch version. + The value is returned by the switch as a part of reply to OFPMP_DESC + request (ofp_desc). The OpenFlow specification (e.g. 1.3.5) describes + the ofp_desc structure to contaion "NULL terminated ASCII strings". + + Human readable description of datapath. It is a maximum 256 byte-long free-form string to describe the datapath for