From patchwork Fri Mar 29 08:28:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13610344 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 741F563BF for ; Fri, 29 Mar 2024 08:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711700940; cv=none; b=p5Tgf3YcOylfF13yzFhDFfdHOxAt0mU0X+FTJpJ+FIpZ6BR1ZS4p1diGHhigRnRRj/vEk/hub3PIu6ZyXbxoEWhHK8L4KXf8Z3D0eiCx9Hg1VMUDA3TyJg2vSaXIyfbmY8d1R6/JlqdbyrPhjcto/NOiHUYOeZ0z7tx26tt8cBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711700940; c=relaxed/simple; bh=RQPxMvBYHIyv/Z2PhyXGdx336liJQSNR0+PnKub8rls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jauh1iG+8nrlZ5RBwOFoL+RN8EPD7BhvYu7jawBIvfKV8W1FV8hH45XaaMVU4WMiSd+FOvlcM6S+KAyL7k8s8AipwdJE3CZ/uxmc2fD+TX6FKgvnJ+OhDo5r1YhqIHK5aGVmsqUF4YT49nknUlytyv7VI7IxEPX6qRDYlLATtKM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NOFiDmbz; arc=none smtp.client-ip=209.85.167.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NOFiDmbz" Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3c3f7259bbcso3917b6e.0 for ; Fri, 29 Mar 2024 01:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711700937; x=1712305737; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LcW0b9cmvjU+oQ3Sf479izV870s0snA3M4JZt9csdVI=; b=NOFiDmbz+RzwQmrV8gSt2kOnRb/83FCfCsgfThtbQ2kP5mh9dzlQuPVOreCJN/0Yc7 oAz5OVMBuTnw/wMZDFCzkzHmtKKVu0EP0hrMMDw1k11l7eBO7pBvSjFIlPGlJS40BUWh YjB0UfKL/tCm1X/EAyKDtrYoQn1LCOKj9xGU0fXGA9lwTDlgeSVBm45/uMq7IXIQC7+Q OMD3y7MWS9652iIwE9H5l4ed3NuVac7zfxeuTJ8zoJ1FPw2rrB1PIdE6r9O/WzDjvHPq kFf3HzekmUmABZYh5tqfn2Fz9nZJfZ114sKGumtzyLVs1lWsDWIN+HzfWnxYVsdma/kC +r5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711700937; x=1712305737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LcW0b9cmvjU+oQ3Sf479izV870s0snA3M4JZt9csdVI=; b=UoE5TUE2KceFMPzpRh4kuWb3yzGZfRSOqxrN0VPWKYBq20KAkTRHq8EjV8WiL204m0 n5eVRaAqnMIOxyxdIs1dbs+fI6Qse1TIw/5GILGIBDC7dT5+sNB5I8nL6Bz+kkHGVSFC 2gJjs/KKCkhl1Y6MAPWhBqHo2iYqyUFxzw4cqKOTns6GMM8BaB78s3mxhzU3FHAFzmjx 95tukbzIZaBuuvD394+XiR4tSxw/+1pM9pWcF2UsFoOWDVqlW95dukbpnKTAP0ScP9Xw wa8HpOD8goPKyYo+D5lPQUmvK1fZb4i5Xwu2O8cSv7NO7T8iN6gs9FXSqi9u2rnEayB7 JgNA== X-Gm-Message-State: AOJu0YwDrw8agvuGsSzv6vt9/V2kXmz0ixrgGseZfhekgZ+BGz6jSSTp OrGC4bSQXVFzdXpdFSRyKD8g82ml0PimoMS+LiBOY4EXKk0fmVI23OrInqc3ORnBykUW X-Google-Smtp-Source: AGHT+IH5PG7QzLbJvZbySzi8WotLj6SX+FIOp0akpcf9MSUW0J2QIZlp7/cII6D6tThPZEpF6h9nQQ== X-Received: by 2002:a05:6808:1649:b0:3c3:dbf0:174a with SMTP id az9-20020a056808164900b003c3dbf0174amr1711462oib.10.1711700937026; Fri, 29 Mar 2024 01:28:57 -0700 (PDT) Received: from Laptop-X1.redhat.com ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id b12-20020a056a000a8c00b006e5a915a9e7sm2656020pfl.10.2024.03.29.01.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 01:28:56 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Donald Hunter , Jiri Pirko , Jacob Keller , Stanislav Fomichev , Hangbin Liu Subject: [PATCHv3 net-next 1/4] Documentation: netlink: add a YAML spec for team Date: Fri, 29 Mar 2024 16:28:44 +0800 Message-ID: <20240329082847.1902685-2-liuhangbin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329082847.1902685-1-liuhangbin@gmail.com> References: <20240329082847.1902685-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add a YAML specification for team. Signed-off-by: Hangbin Liu --- Documentation/netlink/specs/team.yaml | 206 ++++++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 207 insertions(+) create mode 100644 Documentation/netlink/specs/team.yaml diff --git a/Documentation/netlink/specs/team.yaml b/Documentation/netlink/specs/team.yaml new file mode 100644 index 000000000000..907f54c1f2e3 --- /dev/null +++ b/Documentation/netlink/specs/team.yaml @@ -0,0 +1,206 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) + +name: team + +protocol: genetlink-legacy + +doc: | + Network team device driver. + +c-family-name: team-genl-name +c-version-name: team-genl-version +kernel-policy: global +uapi-header: linux/if_team.h + +definitions: + - + name: string-max-len + type: const + value: 32 + - + name: genl-change-event-mc-grp-name + type: const + value: change_event + +attribute-sets: + - + name: team + doc: + The team nested layout of get/set msg looks like + [TEAM_ATTR_LIST_OPTION] + [TEAM_ATTR_ITEM_OPTION] + [TEAM_ATTR_OPTION_*], ... + [TEAM_ATTR_ITEM_OPTION] + [TEAM_ATTR_OPTION_*], ... + ... + [TEAM_ATTR_LIST_PORT] + [TEAM_ATTR_ITEM_PORT] + [TEAM_ATTR_PORT_*], ... + [TEAM_ATTR_ITEM_PORT] + [TEAM_ATTR_PORT_*], ... + ... + name-prefix: team-attr- + attributes: + - + name: unspec + type: unused + value: 0 + - + name: team-ifindex + type: u32 + - + name: list-option + type: nest + nested-attributes: item-option + - + name: list-port + type: nest + nested-attributes: item-port + - + name: item-option + name-prefix: team-attr-item- + attr-cnt-name: __team-attr-item-option-max + attr-max-name: team-attr-item-option-max + attributes: + - + name: option-unspec + type: unused + value: 0 + - + name: option + type: nest + nested-attributes: attr-option + - + name: attr-option + name-prefix: team-attr-option- + attributes: + - + name: unspec + type: unused + value: 0 + - + name: name + type: string + checks: + max-len: string-max-len + unterminated-ok: true + - + name: changed + type: flag + - + name: type + type: u8 + - + name: data + type: binary + - + name: removed + type: flag + - + name: port-ifindex + type: u32 + doc: for per-port options + - + name: array-index + type: u32 + doc: for array options + - + name: item-port + name-prefix: team-attr-item- + attr-cnt-name: __team-attr-item-port-max + attr-max-name: team-attr-item-port-max + attributes: + - + name: port-unspec + type: unused + value: 0 + - + name: port + type: nest + nested-attributes: attr-port + - + name: attr-port + name-prefix: team-attr-port- + attributes: + - + name: unspec + type: unused + value: 0 + - + name: ifindex + type: u32 + - + name: changed + type: flag + - + name: linkup + type: flag + - + name: speed + type: u32 + - + name: duplex + type: u8 + - + name: removed + type: flag + +operations: + list: + - + name: noop + doc: No operation + value: 0 + attribute-set: team + dont-validate: [ strict ] + + do: + # Actually it only reply the team netlink family + reply: + attributes: + - team-ifindex + + - + name: options-set + doc: Set team options + attribute-set: team + dont-validate: [ strict ] + flags: [ admin-perm ] + + do: + request: &option_attrs + attributes: + - team-ifindex + - list-option + reply: *option_attrs + + - + name: options-get + doc: Get team options info + attribute-set: team + dont-validate: [ strict ] + flags: [ admin-perm ] + + do: + request: + attributes: + - team-ifindex + reply: *option_attrs + + - + name: port-list-get + doc: Get team ports info + attribute-set: team + dont-validate: [ strict ] + flags: [ admin-perm ] + + do: + request: + attributes: + - team-ifindex + reply: &port_attrs + attributes: + - team-ifindex + - list-port + - item-port + - attr-port diff --git a/MAINTAINERS b/MAINTAINERS index 6a233e1a3cf2..909c2c531d8e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21665,6 +21665,7 @@ TEAM DRIVER M: Jiri Pirko L: netdev@vger.kernel.org S: Supported +F: Documentation/netlink/specs/team.yaml F: drivers/net/team/ F: include/linux/if_team.h F: include/uapi/linux/if_team.h From patchwork Fri Mar 29 08:28:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13610345 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CE524E1DC for ; Fri, 29 Mar 2024 08:29:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711700942; cv=none; b=g2MrxUyoBTeWAHeRbnPuWsL+WDSO+6ajxbm2u0O2MdvRZ1VdXOhimVIz8SCveMe3kdSaJMl//WmhduDJJaI38FMJgmf+YApsFjIsYR8JuYe/mzVJutTQQt3YY0Lq1oFbCa8PFwrZFlVrWXTWKOY+3y4DREZME1dkP58C3OVZgdE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711700942; c=relaxed/simple; bh=H4TEqdUVbh8I+Omh2NGLbbmus6qQx/nnFb3BZD9dHsw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HrS2cJ5vr5X5Y4SmLwsswnqfHfnibThMLQa3cw8AaujN5b5xwnYSkYbmAfRq91btWMLxYf4NRgl4qO52WR/773jR6SG2AFH94x6/ZA/7rSoRvX2m9TH4EpwIcycHEXqBR38F3GU3h9U4BdsVjQxGM9H5+l4gT5YTK6JYzXMrRBs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lJ7w7TE1; arc=none smtp.client-ip=209.85.167.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lJ7w7TE1" Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3c396fec63aso687004b6e.0 for ; Fri, 29 Mar 2024 01:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711700940; x=1712305740; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qDj/WIGUGuQbjJfn4pkBI2FIlOuEIDvQborRQXjGDFE=; b=lJ7w7TE1zBjvO/TwQMOkookeU+1naG53crgJHGu+szwXDxadRY190GAVtaz3ZpJ5aq kOpsOmMuSfIaLcTDAyb79YvPLgxyeuujZla2RCMn1gmpIhXyvC/nNWLZ5F0QJl9+1Vz5 fAdi+uGxqni46jXsMM8wxGAoy83wsfb7xSFUDFQQiPd+plV7y5kak14OPvfbtng72Eqd ZsMYouYiOt7zwMotL549r/2R1GCagFd0j82K0S0mJV/BwBPnaFx37Wjc+k0c/IE6T3C6 rQC+EWGfqeBWexdjE55sOkq8X2YgqQirCaOUSEIzgBxaGRzNjVDM691nhpWlit7tI/sK V8Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711700940; x=1712305740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qDj/WIGUGuQbjJfn4pkBI2FIlOuEIDvQborRQXjGDFE=; b=VqOU3OWV+XzJuRzeQl+Kl5dTNevJZBE45ddEkIlPnfybFWE+mUn2au8bWIAKOBuDda vSbpndq3dvJKln/vcwF/FDpOWR398rZL6vXRPEcH3Yg1//OECGcGaVX4awjImJq0Qpy3 FIKR/ykxG9aj/4ENNckMZ/+TJsyFLpBrgw6k+pRLXyfSTFCvR3de+Gb/AZlUU0ZUzwgH qBGpzWKB2Fnsn0i8lRDduriYi4QFA/X5BRcnuiyOLl+sRU5BvlReGd7OiDHSuQEqaTZX ejEQNWL2z6/MB1z1fuCMUwNCW2vZQn34sbWCVzW5OoOTkRhqUgmAKX7Kr0uaSkwMhTT0 /asg== X-Gm-Message-State: AOJu0Yw26GokxMlrhKWXMTMbtXiEtHmtPh3p34x2nvdLMynkoPE38lmr AhuAKhrRaRAqZ7xKXv6bmShdqfamtta8ElRm1YwxYVK4kTdkqsTEzRrYP/4JZpQeyeDa X-Google-Smtp-Source: AGHT+IGhT9m1Uv7hItTGBa8XANLkom25bTWMu0oDcv7ApqjiR+GrUZI108ItY0f44DyWMnPCmu/swg== X-Received: by 2002:a05:6808:320b:b0:3c3:d80c:ee5f with SMTP id cb11-20020a056808320b00b003c3d80cee5fmr2110317oib.51.1711700939913; Fri, 29 Mar 2024 01:28:59 -0700 (PDT) Received: from Laptop-X1.redhat.com ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id b12-20020a056a000a8c00b006e5a915a9e7sm2656020pfl.10.2024.03.29.01.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 01:28:59 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Donald Hunter , Jiri Pirko , Jacob Keller , Stanislav Fomichev , Hangbin Liu Subject: [PATCHv3 net-next 2/4] net: team: rename team to team_core for linking Date: Fri, 29 Mar 2024 16:28:45 +0800 Message-ID: <20240329082847.1902685-3-liuhangbin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329082847.1902685-1-liuhangbin@gmail.com> References: <20240329082847.1902685-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Similar with commit 08d323234d10 ("net: fou: rename the source for linking"), We'll need to link two objects together to form the team module. This means the source can't be called team, the build system expects team.o to be the combined object. Signed-off-by: Hangbin Liu --- Documentation/netlink/specs/team.yaml | 2 -- drivers/net/team/Makefile | 1 + drivers/net/team/{team.c => team_core.c} | 0 3 files changed, 1 insertion(+), 2 deletions(-) rename drivers/net/team/{team.c => team_core.c} (100%) diff --git a/Documentation/netlink/specs/team.yaml b/Documentation/netlink/specs/team.yaml index 907f54c1f2e3..c13529e011c9 100644 --- a/Documentation/netlink/specs/team.yaml +++ b/Documentation/netlink/specs/team.yaml @@ -202,5 +202,3 @@ operations: attributes: - team-ifindex - list-port - - item-port - - attr-port diff --git a/drivers/net/team/Makefile b/drivers/net/team/Makefile index f582d81a5091..244db32c1060 100644 --- a/drivers/net/team/Makefile +++ b/drivers/net/team/Makefile @@ -3,6 +3,7 @@ # Makefile for the network team driver # +team-y:= team_core.o obj-$(CONFIG_NET_TEAM) += team.o obj-$(CONFIG_NET_TEAM_MODE_BROADCAST) += team_mode_broadcast.o obj-$(CONFIG_NET_TEAM_MODE_ROUNDROBIN) += team_mode_roundrobin.o diff --git a/drivers/net/team/team.c b/drivers/net/team/team_core.c similarity index 100% rename from drivers/net/team/team.c rename to drivers/net/team/team_core.c From patchwork Fri Mar 29 08:28:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13610346 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24CD64B5DA for ; Fri, 29 Mar 2024 08:29:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711700945; cv=none; b=b5WRxhJZqcw3zE70iBNfwWIW7I7lZRJI0uoOo2Y7ckYAo6bhztppiA/ypLSx4HZ9ABuOrFvG0YIvne9sXCbJO4lf2J23nMEQwwp8c4ZJQr1sQXKs5UdPNed/aVS+87O+r/y/R0cQ9gEKPax9BskXhys2gKxUbwcY1Azv5tIEMdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711700945; c=relaxed/simple; bh=ayuNtYmOonxJJhCSFnbY4iMnsMPNOYu4/QaCZ83whmU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P5zZufTvSwEkxnOf5dcUEjPvrsOk/emKcW7XLFOvvi3MObJ7XKny10Pki+GuWEUPa/rZg+vng64rMkzdDgtfeAe2XlYSMr5jiHsQQDEhV6C8zp+DFNOU9/+PsRqZx1bcS/ETA0WNLpQ797tjZSP8nTi1DSPZ15sea5ClmJIXYjo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=THf9a8p6; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="THf9a8p6" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6e8f51d0bf0so1533129b3a.3 for ; Fri, 29 Mar 2024 01:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711700943; x=1712305743; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b7wUQzch9TpmqK/jHmUx1ulUaYYDSMvEbaUArRlwZbg=; b=THf9a8p6m76BEZj1PZiQtPKsJveg9inkkH5cKIlojD9Ff738aeR0j9K4TCl2NEjKLP V/7jQVId4Ra8OKUE/rZLoe8/EVsx/UI4ttTyKMc7c/v5EEVb9ByPL/gvaOOuqsD5inzq ZRY1sR/ik8vif0SqsqZsLzbQLMo4G/XbO/pcq3MbF/wexXS3VH3va9cJov/1ookj/qis coVNKgPwd2MDdqX2qGLmAXFj+oRGLcQ2jxkrerg1+atJLSawmyAqmg/zIyrLm61WI24B xIHHGOS4UMPpV658I3hxyBvetsI0j7XXF9/hywB8rclgf1AWBTn0W1sRY8SImxs6WgIM +0XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711700943; x=1712305743; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b7wUQzch9TpmqK/jHmUx1ulUaYYDSMvEbaUArRlwZbg=; b=CY+P1s8k6PYBakHJxfBjB6grn3P/XA+BWG9APK0hGWnQHN7PPu5PXmB5MCqCFEE8Y5 lqZgSsMoYT/fwKU3EXWHN902qD4MaUEESzRQqKx6549acDnD1sCVgnuCPalZr5Kxzz/Q jN17U8Xj0i3kxdb4+tNRyebT8o3WFcfwXy9nEbRXTjJ86dRFjbIXjzDMsbdnsp481YFy nZxq2KHCtz9gtFY3EmRL8M9fVmRd7Z9ddRuOJSJIHlQhwWVlisIU8Nf1hgHBDLREnUXU GNIdOi6YciLZ+nabNkGXVHpYHWjgofHKzshOLqMvdJg3UiRyysQGGoGdZrBxJya8b+B9 F8Ew== X-Gm-Message-State: AOJu0YyPVReudvqpfX+cwO7KkT6BBT8lMioukWl4U1T//z4LFyG0QI8l /69Zj6HZyhNA+R03yEvLNEjI7Lpek04Q7t6HfWntJhtAg9RnU5bkbq+fHSVa004bJTXA X-Google-Smtp-Source: AGHT+IHMNS811Q+LNNAeKD5LJPlqGKZLzh359X0Jt5+23lghpvEGQaT68ScPsMG+fy2jpLvNjkOFJw== X-Received: by 2002:a05:6a00:9387:b0:6e9:38d0:5019 with SMTP id ka7-20020a056a00938700b006e938d05019mr1728520pfb.0.1711700943005; Fri, 29 Mar 2024 01:29:03 -0700 (PDT) Received: from Laptop-X1.redhat.com ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id b12-20020a056a000a8c00b006e5a915a9e7sm2656020pfl.10.2024.03.29.01.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 01:29:02 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Donald Hunter , Jiri Pirko , Jacob Keller , Stanislav Fomichev , Hangbin Liu Subject: [PATCHv3 net-next 3/4] net: team: use policy generated by YAML spec Date: Fri, 29 Mar 2024 16:28:46 +0800 Message-ID: <20240329082847.1902685-4-liuhangbin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329082847.1902685-1-liuhangbin@gmail.com> References: <20240329082847.1902685-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org generated with: $ ./tools/net/ynl/ynl-gen-c.py --mode kernel \ > --spec Documentation/netlink/specs/team.yaml --source \ > -o drivers/net/team/team_nl.c $ ./tools/net/ynl/ynl-gen-c.py --mode kernel \ > --spec Documentation/netlink/specs/team.yaml --header \ > -o drivers/net/team/team_nl.h The TEAM_ATTR_LIST_PORT in team_nl_policy is removed as it is only in the port list reply attributes. Signed-off-by: Hangbin Liu --- drivers/net/team/Makefile | 2 +- drivers/net/team/team_core.c | 63 ++++++------------------------------ drivers/net/team/team_nl.c | 59 +++++++++++++++++++++++++++++++++ drivers/net/team/team_nl.h | 29 +++++++++++++++++ 4 files changed, 98 insertions(+), 55 deletions(-) create mode 100644 drivers/net/team/team_nl.c create mode 100644 drivers/net/team/team_nl.h diff --git a/drivers/net/team/Makefile b/drivers/net/team/Makefile index 244db32c1060..7a5aa20d286b 100644 --- a/drivers/net/team/Makefile +++ b/drivers/net/team/Makefile @@ -3,7 +3,7 @@ # Makefile for the network team driver # -team-y:= team_core.o +team-y:= team_core.o team_nl.o obj-$(CONFIG_NET_TEAM) += team.o obj-$(CONFIG_NET_TEAM_MODE_BROADCAST) += team_mode_broadcast.o obj-$(CONFIG_NET_TEAM_MODE_ROUNDROBIN) += team_mode_roundrobin.o diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c index 0a44bbdcfb7b..4e3c8d404957 100644 --- a/drivers/net/team/team_core.c +++ b/drivers/net/team/team_core.c @@ -27,6 +27,8 @@ #include #include +#include "team_nl.h" + #define DRV_NAME "team" @@ -2254,28 +2256,7 @@ static struct rtnl_link_ops team_link_ops __read_mostly = { static struct genl_family team_nl_family; -static const struct nla_policy team_nl_policy[TEAM_ATTR_MAX + 1] = { - [TEAM_ATTR_UNSPEC] = { .type = NLA_UNSPEC, }, - [TEAM_ATTR_TEAM_IFINDEX] = { .type = NLA_U32 }, - [TEAM_ATTR_LIST_OPTION] = { .type = NLA_NESTED }, - [TEAM_ATTR_LIST_PORT] = { .type = NLA_NESTED }, -}; - -static const struct nla_policy -team_nl_option_policy[TEAM_ATTR_OPTION_MAX + 1] = { - [TEAM_ATTR_OPTION_UNSPEC] = { .type = NLA_UNSPEC, }, - [TEAM_ATTR_OPTION_NAME] = { - .type = NLA_STRING, - .len = TEAM_STRING_MAX_LEN, - }, - [TEAM_ATTR_OPTION_CHANGED] = { .type = NLA_FLAG }, - [TEAM_ATTR_OPTION_TYPE] = { .type = NLA_U8 }, - [TEAM_ATTR_OPTION_DATA] = { .type = NLA_BINARY }, - [TEAM_ATTR_OPTION_PORT_IFINDEX] = { .type = NLA_U32 }, - [TEAM_ATTR_OPTION_ARRAY_INDEX] = { .type = NLA_U32 }, -}; - -static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) +int team_nl_noop_doit(struct sk_buff *skb, struct genl_info *info) { struct sk_buff *msg; void *hdr; @@ -2513,7 +2494,7 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq, return err; } -static int team_nl_cmd_options_get(struct sk_buff *skb, struct genl_info *info) +int team_nl_options_get_doit(struct sk_buff *skb, struct genl_info *info) { struct team *team; struct team_option_inst *opt_inst; @@ -2538,7 +2519,7 @@ static int team_nl_cmd_options_get(struct sk_buff *skb, struct genl_info *info) static int team_nl_send_event_options_get(struct team *team, struct list_head *sel_opt_inst_list); -static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) +int team_nl_options_set_doit(struct sk_buff *skb, struct genl_info *info) { struct team *team; int err = 0; @@ -2579,7 +2560,7 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) err = nla_parse_nested_deprecated(opt_attrs, TEAM_ATTR_OPTION_MAX, nl_option, - team_nl_option_policy, + team_attr_option_nl_policy, info->extack); if (err) goto team_put; @@ -2802,8 +2783,8 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq, return err; } -static int team_nl_cmd_port_list_get(struct sk_buff *skb, - struct genl_info *info) +int team_nl_port_list_get_doit(struct sk_buff *skb, + struct genl_info *info) { struct team *team; int err; @@ -2820,32 +2801,6 @@ static int team_nl_cmd_port_list_get(struct sk_buff *skb, return err; } -static const struct genl_small_ops team_nl_ops[] = { - { - .cmd = TEAM_CMD_NOOP, - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .doit = team_nl_cmd_noop, - }, - { - .cmd = TEAM_CMD_OPTIONS_SET, - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .doit = team_nl_cmd_options_set, - .flags = GENL_ADMIN_PERM, - }, - { - .cmd = TEAM_CMD_OPTIONS_GET, - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .doit = team_nl_cmd_options_get, - .flags = GENL_ADMIN_PERM, - }, - { - .cmd = TEAM_CMD_PORT_LIST_GET, - .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .doit = team_nl_cmd_port_list_get, - .flags = GENL_ADMIN_PERM, - }, -}; - static const struct genl_multicast_group team_nl_mcgrps[] = { { .name = TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME, }, }; @@ -2853,7 +2808,7 @@ static const struct genl_multicast_group team_nl_mcgrps[] = { static struct genl_family team_nl_family __ro_after_init = { .name = TEAM_GENL_NAME, .version = TEAM_GENL_VERSION, - .maxattr = TEAM_ATTR_MAX, + .maxattr = ARRAY_SIZE(team_nl_policy), .policy = team_nl_policy, .netnsok = true, .module = THIS_MODULE, diff --git a/drivers/net/team/team_nl.c b/drivers/net/team/team_nl.c new file mode 100644 index 000000000000..208424ab78f5 --- /dev/null +++ b/drivers/net/team/team_nl.c @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/team.yaml */ +/* YNL-GEN kernel source */ + +#include +#include + +#include "team_nl.h" + +#include + +/* Common nested types */ +const struct nla_policy team_attr_option_nl_policy[TEAM_ATTR_OPTION_ARRAY_INDEX + 1] = { + [TEAM_ATTR_OPTION_NAME] = { .type = NLA_STRING, .len = TEAM_STRING_MAX_LEN, }, + [TEAM_ATTR_OPTION_CHANGED] = { .type = NLA_FLAG, }, + [TEAM_ATTR_OPTION_TYPE] = { .type = NLA_U8, }, + [TEAM_ATTR_OPTION_DATA] = { .type = NLA_BINARY, }, + [TEAM_ATTR_OPTION_REMOVED] = { .type = NLA_FLAG, }, + [TEAM_ATTR_OPTION_PORT_IFINDEX] = { .type = NLA_U32, }, + [TEAM_ATTR_OPTION_ARRAY_INDEX] = { .type = NLA_U32, }, +}; + +const struct nla_policy team_item_option_nl_policy[TEAM_ATTR_ITEM_OPTION + 1] = { + [TEAM_ATTR_ITEM_OPTION] = NLA_POLICY_NESTED(team_attr_option_nl_policy), +}; + +/* Global operation policy for team */ +const struct nla_policy team_nl_policy[TEAM_ATTR_LIST_OPTION + 1] = { + [TEAM_ATTR_TEAM_IFINDEX] = { .type = NLA_U32, }, + [TEAM_ATTR_LIST_OPTION] = NLA_POLICY_NESTED(team_item_option_nl_policy), +}; + +/* Ops table for team */ +const struct genl_small_ops team_nl_ops[4] = { + { + .cmd = TEAM_CMD_NOOP, + .validate = GENL_DONT_VALIDATE_STRICT, + .doit = team_nl_noop_doit, + }, + { + .cmd = TEAM_CMD_OPTIONS_SET, + .validate = GENL_DONT_VALIDATE_STRICT, + .doit = team_nl_options_set_doit, + .flags = GENL_ADMIN_PERM, + }, + { + .cmd = TEAM_CMD_OPTIONS_GET, + .validate = GENL_DONT_VALIDATE_STRICT, + .doit = team_nl_options_get_doit, + .flags = GENL_ADMIN_PERM, + }, + { + .cmd = TEAM_CMD_PORT_LIST_GET, + .validate = GENL_DONT_VALIDATE_STRICT, + .doit = team_nl_port_list_get_doit, + .flags = GENL_ADMIN_PERM, + }, +}; diff --git a/drivers/net/team/team_nl.h b/drivers/net/team/team_nl.h new file mode 100644 index 000000000000..c9ec1b22ac4d --- /dev/null +++ b/drivers/net/team/team_nl.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/team.yaml */ +/* YNL-GEN kernel header */ + +#ifndef _LINUX_TEAM_GEN_H +#define _LINUX_TEAM_GEN_H + +#include +#include + +#include + +/* Common nested types */ +extern const struct nla_policy team_attr_option_nl_policy[TEAM_ATTR_OPTION_ARRAY_INDEX + 1]; +extern const struct nla_policy team_item_option_nl_policy[TEAM_ATTR_ITEM_OPTION + 1]; + +/* Global operation policy for team */ +extern const struct nla_policy team_nl_policy[TEAM_ATTR_LIST_OPTION + 1]; + +/* Ops table for team */ +extern const struct genl_small_ops team_nl_ops[4]; + +int team_nl_noop_doit(struct sk_buff *skb, struct genl_info *info); +int team_nl_options_set_doit(struct sk_buff *skb, struct genl_info *info); +int team_nl_options_get_doit(struct sk_buff *skb, struct genl_info *info); +int team_nl_port_list_get_doit(struct sk_buff *skb, struct genl_info *info); + +#endif /* _LINUX_TEAM_GEN_H */ From patchwork Fri Mar 29 08:28:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13610347 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2F804D9E4 for ; Fri, 29 Mar 2024 08:29:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711700949; cv=none; b=H5yNUyNBVMXilMug6GBYbrK5z6egBo4iRucU512MbHc26IJfFy2rrxxLY9MO/EGVbP7+tlh53U6bEccOHNpW3x39usiMjKXu8hVCYjO2WfFX4PxkUNS8XpKZ5GR+v13r0Hg7bfLS073OkRfCiLj6oUuLCkPqeEtMStG1rp7b5Xc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711700949; c=relaxed/simple; bh=ku8YzMn9QMy7xB2oEL6yj+qh7mh+oEzbTYBRUdDchNQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cmiDIrW/f77MtwFFdwMq2RgLZIHb3et+j6uScV7dNOIWjj3iJW2wii52GJela7IVFILpwn2Y7sSOAcXv643QX9ObDVTPdDLdSiKduKOxHSrUv6ZdpQIhRCqqZb1Ov9d5pRYDbJeXBOvRwh2j8Zk9onaS/QlFvG90AOFeUpfCEEw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DgiAzp3B; arc=none smtp.client-ip=209.85.219.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DgiAzp3B" Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-dd161eb03afso1776387276.0 for ; Fri, 29 Mar 2024 01:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711700946; x=1712305746; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rXt+e70s18vvmZvnfHoG/leNZ6ipUAeaM1qUbwNwWzI=; b=DgiAzp3BGGZFTDkUqXLPIJ/DhOriXlVfXuMvMooIGpuncjuSBxLH4FmliUtxvS4Izc ItJpizu3648U8gn8YoNLJfGG+vh/IVp64GvnIDEso85ze/vDYkY32K7inok4uUz1a6vX bDGeD/yTBRjctdrg5o8n6vvUT7PD/Ulx0mgk+07RdBt1D+AW0RDbHbkTJ1pG2RyePKBG qTFHl2nFqBg3sbyRV13bqMJ0Ct3u+BGlf64KglLukZMDf34O/NZECzME+xploCwLFG27 yk56LqQktgePyQYmpiXMQwR/uAIZu60pLZFH8OWM+lypU8tbylLH4D5S2B9Kl/RtwNh2 gp9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711700946; x=1712305746; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rXt+e70s18vvmZvnfHoG/leNZ6ipUAeaM1qUbwNwWzI=; b=mUiEDGcD+m/pRsrT+bKXdmPx47AeN+YHvVlulF65ixr4oVbJfkzJsl6pL+jBhNwyx3 Nr5ao+2VZuVkPkFbGkw7aMCfTHyU20jj31tk/4AlHoWlbNWA7vPtNM2ixlyrGJJKb1bu l4CdEcGyZF+b1kYquHyUDrDCE3pXSuK2gRuaMYzquPAXgYzZY2GFuzHs+z26dYR6bX7Y kOP71Vn+L2h+FepbUKFhXMi97n7e5tygYhHD5KaawvGOFVmljnFXw3XiKIr1TiVw5g0y EMwgtuTkOZp/99srOp/chOMJytEo3F2mvt7URleh5jF1gXw88uLZyXf9m+5EDygIOovq owGg== X-Gm-Message-State: AOJu0YytL1wjuXhJr/MijeKC/iNJ7PQ5egIM0pij2ef6+/dOv2ND9s36 eE423qeenVwDE71rH31YTaGkIM9PjH4LKkfw4YJ1sb9pRjwHX2h1BDM33yw3DnZfhxDF X-Google-Smtp-Source: AGHT+IGgCxsLIbjx6d9hVV8K74ijBPDLZ1KPeodxZsXMOCmQhhSDTxfM3tdV6mJdE8Wq8L+slU5vbQ== X-Received: by 2002:a25:6f89:0:b0:dc7:465d:c06d with SMTP id k131-20020a256f89000000b00dc7465dc06dmr1549516ybc.28.1711700946296; Fri, 29 Mar 2024 01:29:06 -0700 (PDT) Received: from Laptop-X1.redhat.com ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id b12-20020a056a000a8c00b006e5a915a9e7sm2656020pfl.10.2024.03.29.01.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 01:29:05 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Donald Hunter , Jiri Pirko , Jacob Keller , Stanislav Fomichev , Hangbin Liu Subject: [PATCHv3 net-next 4/4] uapi: team: use header file generated from YAML spec Date: Fri, 29 Mar 2024 16:28:47 +0800 Message-ID: <20240329082847.1902685-5-liuhangbin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329082847.1902685-1-liuhangbin@gmail.com> References: <20240329082847.1902685-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org generated with: $ ./tools/net/ynl/ynl-gen-c.py --mode uapi \ > --spec Documentation/netlink/specs/team.yaml \ > --header -o include/uapi/linux/if_team.h Signed-off-by: Hangbin Liu --- include/uapi/linux/if_team.h | 116 +++++++++++++---------------------- 1 file changed, 43 insertions(+), 73 deletions(-) diff --git a/include/uapi/linux/if_team.h b/include/uapi/linux/if_team.h index 13c61fecb78b..a5c06243a435 100644 --- a/include/uapi/linux/if_team.h +++ b/include/uapi/linux/if_team.h @@ -1,108 +1,78 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* - * include/linux/if_team.h - Network team device driver header - * Copyright (c) 2011 Jiri Pirko - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/team.yaml */ +/* YNL-GEN uapi header */ -#ifndef _UAPI_LINUX_IF_TEAM_H_ -#define _UAPI_LINUX_IF_TEAM_H_ +#ifndef _UAPI_LINUX_IF_TEAM_H +#define _UAPI_LINUX_IF_TEAM_H +#define TEAM_GENL_NAME "team" +#define TEAM_GENL_VERSION 1 -#define TEAM_STRING_MAX_LEN 32 - -/********************************** - * NETLINK_GENERIC netlink family. - **********************************/ - -enum { - TEAM_CMD_NOOP, - TEAM_CMD_OPTIONS_SET, - TEAM_CMD_OPTIONS_GET, - TEAM_CMD_PORT_LIST_GET, - - __TEAM_CMD_MAX, - TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1), -}; +#define TEAM_STRING_MAX_LEN 32 +#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event" enum { TEAM_ATTR_UNSPEC, - TEAM_ATTR_TEAM_IFINDEX, /* u32 */ - TEAM_ATTR_LIST_OPTION, /* nest */ - TEAM_ATTR_LIST_PORT, /* nest */ + TEAM_ATTR_TEAM_IFINDEX, + TEAM_ATTR_LIST_OPTION, + TEAM_ATTR_LIST_PORT, __TEAM_ATTR_MAX, - TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1, + TEAM_ATTR_MAX = (__TEAM_ATTR_MAX - 1) }; -/* Nested layout of get/set msg: - * - * [TEAM_ATTR_LIST_OPTION] - * [TEAM_ATTR_ITEM_OPTION] - * [TEAM_ATTR_OPTION_*], ... - * [TEAM_ATTR_ITEM_OPTION] - * [TEAM_ATTR_OPTION_*], ... - * ... - * [TEAM_ATTR_LIST_PORT] - * [TEAM_ATTR_ITEM_PORT] - * [TEAM_ATTR_PORT_*], ... - * [TEAM_ATTR_ITEM_PORT] - * [TEAM_ATTR_PORT_*], ... - * ... - */ - enum { TEAM_ATTR_ITEM_OPTION_UNSPEC, - TEAM_ATTR_ITEM_OPTION, /* nest */ + TEAM_ATTR_ITEM_OPTION, __TEAM_ATTR_ITEM_OPTION_MAX, - TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1, + TEAM_ATTR_ITEM_OPTION_MAX = (__TEAM_ATTR_ITEM_OPTION_MAX - 1) }; enum { TEAM_ATTR_OPTION_UNSPEC, - TEAM_ATTR_OPTION_NAME, /* string */ - TEAM_ATTR_OPTION_CHANGED, /* flag */ - TEAM_ATTR_OPTION_TYPE, /* u8 */ - TEAM_ATTR_OPTION_DATA, /* dynamic */ - TEAM_ATTR_OPTION_REMOVED, /* flag */ - TEAM_ATTR_OPTION_PORT_IFINDEX, /* u32 */ /* for per-port options */ - TEAM_ATTR_OPTION_ARRAY_INDEX, /* u32 */ /* for array options */ + TEAM_ATTR_OPTION_NAME, + TEAM_ATTR_OPTION_CHANGED, + TEAM_ATTR_OPTION_TYPE, + TEAM_ATTR_OPTION_DATA, + TEAM_ATTR_OPTION_REMOVED, + TEAM_ATTR_OPTION_PORT_IFINDEX, + TEAM_ATTR_OPTION_ARRAY_INDEX, __TEAM_ATTR_OPTION_MAX, - TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1, + TEAM_ATTR_OPTION_MAX = (__TEAM_ATTR_OPTION_MAX - 1) }; enum { TEAM_ATTR_ITEM_PORT_UNSPEC, - TEAM_ATTR_ITEM_PORT, /* nest */ + TEAM_ATTR_ITEM_PORT, __TEAM_ATTR_ITEM_PORT_MAX, - TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1, + TEAM_ATTR_ITEM_PORT_MAX = (__TEAM_ATTR_ITEM_PORT_MAX - 1) }; enum { TEAM_ATTR_PORT_UNSPEC, - TEAM_ATTR_PORT_IFINDEX, /* u32 */ - TEAM_ATTR_PORT_CHANGED, /* flag */ - TEAM_ATTR_PORT_LINKUP, /* flag */ - TEAM_ATTR_PORT_SPEED, /* u32 */ - TEAM_ATTR_PORT_DUPLEX, /* u8 */ - TEAM_ATTR_PORT_REMOVED, /* flag */ + TEAM_ATTR_PORT_IFINDEX, + TEAM_ATTR_PORT_CHANGED, + TEAM_ATTR_PORT_LINKUP, + TEAM_ATTR_PORT_SPEED, + TEAM_ATTR_PORT_DUPLEX, + TEAM_ATTR_PORT_REMOVED, __TEAM_ATTR_PORT_MAX, - TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1, + TEAM_ATTR_PORT_MAX = (__TEAM_ATTR_PORT_MAX - 1) }; -/* - * NETLINK_GENERIC related info - */ -#define TEAM_GENL_NAME "team" -#define TEAM_GENL_VERSION 0x1 -#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event" +enum { + TEAM_CMD_NOOP, + TEAM_CMD_OPTIONS_SET, + TEAM_CMD_OPTIONS_GET, + TEAM_CMD_PORT_LIST_GET, + + __TEAM_CMD_MAX, + TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1) +}; -#endif /* _UAPI_LINUX_IF_TEAM_H_ */ +#endif /* _UAPI_LINUX_IF_TEAM_H */