From patchwork Mon Feb 11 19:09:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1040094 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="odBBgn09"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ywNW4sKjz9sDr for ; Tue, 12 Feb 2019 06:10:35 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387732AbfBKTKa (ORCPT ); Mon, 11 Feb 2019 14:10:30 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34015 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732529AbfBKTKa (ORCPT ); Mon, 11 Feb 2019 14:10:30 -0500 Received: by mail-pl1-f195.google.com with SMTP id w4so13486plz.1; Mon, 11 Feb 2019 11:10:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=whP2T31Mi9yk1nJwoFJ9GEi1TFBKA5bW2oJpYvjtFLM=; b=odBBgn09m3CSnwo8BpV1ZdwyoKxI6zXAcmYOB8E4WV7RseuMKFb18n+ySxPrTjrPJj jPp4ldQaw1Y+bwbAjjrlxfz0SZ/Gx/NB8Hbc63u7sbDu5eM8lRZ6cxtsD5tNpBp19Kcr t6lZv/miLHHY+V39TLgtGoX3ODSqvThlZKj4dT8d6QygKkHan9ASiGq+EZqXirWbVdOc JoiCDJnWPXW3TyBfzTGIYKoTMU742ZAr6K4X9iEacCF0B6pkKS3pCxvsv7P56TaUgNZM u9zzXJyoI3UOBSXBuM2uvAwIh0+WhE6+53TvC30R8DSN2cnj/O72hHsFO6dkZE3Xc4sH q60g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=whP2T31Mi9yk1nJwoFJ9GEi1TFBKA5bW2oJpYvjtFLM=; b=E5mAma+kxBCQR+8Ehb0Vv+leHJtegi3ZJTeUmVTp9hKP5V6TZvs+d8crUeFixQ9BLL BUN/2ScrM0h1U8T03wUANkCZIHRAaaPobtc/D3ejG9AVutgHMdP04RtVj3Eja2wBqeN3 GjNdwFiLxwr10hFitYebb3/5GA1rHxu0uFeq7J88H8wTI3lleprMjjS+mmrsb92YUTDQ dCZAwvlZiWQyUyvrhsGBT1pBWCN6VTc7a7iP5YSbiZotcihjlPe0S99cKewB9X0wTsc9 IH5hALTB7Eh+2/18VTbRrzv8fH9T8/NSkn7HSp2nyfdk+tvCJl67l1T4+8tlL1VNHIiG A2/w== X-Gm-Message-State: AHQUAubAACiAvrTIWzNuixoy359h1X/LETP9MtWErJQ7uH5j546SlUpN XJdDHxAlcEnxzfvH9oCBPrOPEMUk X-Google-Smtp-Source: AHgI3IaVDXMVGBh5If1b9vC3yvgsG4rGOdR6dSN+b5jt4kyZqz6TzjbAEL3yzAUjsXclkGtTr6+UGw== X-Received: by 2002:a17:902:27a8:: with SMTP id d37mr39370965plb.182.1549912228883; Mon, 11 Feb 2019 11:10:28 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.10.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:28 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 1/9] Documentation: networking: switchdev: Update port parent ID section Date: Mon, 11 Feb 2019 11:09:53 -0800 Message-Id: <20190211191001.8623-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Update the section about switchdev drivers having to implement a switchdev_port_attr_get() function to return SWITCHDEV_ATTR_ID_PORT_PARENT_ID since that is no longer valid after commit bccb30254a4a ("net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID"). Fixes: bccb30254a4a ("net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID") Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli Reviewed-by: Ido Schimmel --- Documentation/networking/switchdev.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt index f3244d87512a..ea90243340a9 100644 --- a/Documentation/networking/switchdev.txt +++ b/Documentation/networking/switchdev.txt @@ -92,11 +92,11 @@ device. Switch ID ^^^^^^^^^ -The switchdev driver must implement the switchdev op switchdev_port_attr_get -for SWITCHDEV_ATTR_ID_PORT_PARENT_ID for each port netdev, returning the same -physical ID for each port of a switch. The ID must be unique between switches -on the same system. The ID does not need to be unique between switches on -different systems. +The switchdev driver must implement the net_device operation +ndo_get_port_parent_id for each port netdev, returning the same physical ID for +each port of a switch. The ID must be unique between switches on the same +system. The ID does not need to be unique between switches on different +systems. The switch ID is used to locate ports on a switch and to know if aggregated ports belong to the same switch. From patchwork Mon Feb 11 19:09:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1040095 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UC/FN7nY"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ywNf2XBdz9s7h for ; Tue, 12 Feb 2019 06:10:42 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387762AbfBKTKh (ORCPT ); Mon, 11 Feb 2019 14:10:37 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40386 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732529AbfBKTKf (ORCPT ); Mon, 11 Feb 2019 14:10:35 -0500 Received: by mail-pf1-f195.google.com with SMTP id h1so2891453pfo.7; Mon, 11 Feb 2019 11:10:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2TQc99j/xHrKOFnE+nfQwNzSxZGkG/IjAxlRWq4f6Ew=; b=UC/FN7nYUt5SLhrVGm+dMaAZddTvHcQDwacXtOw9g9xBib3psxbYw1TYGAzg/p6EHM bNLZzaL1SNVlowFmGRjaEgfpO/qJa0i7SpIiFHlVdaibhTPTf0hQhNuH6LM2u9pa4azD FLALeGlCJ5f64onaBXMphCeJA8BDC3C2sg8q57g7aYEODj72+LsyLjevWhrOl1lv9CZA z/OStEDk6smZyJprJUGk1fPRW6LfL0W207QWuBmgz43GdZsKw/2rVMpWp/fqmkfK2hf4 2sBmzxGnZNAO7e3jOZR6qX4xPabXrZE86twMMUrtekLGostZkHztBCFXD0XkazVc4tJR 2Qxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2TQc99j/xHrKOFnE+nfQwNzSxZGkG/IjAxlRWq4f6Ew=; b=NtZapNiwJbsx1noFVjNPFxmcnbrpA3ev9Kwh5YkaagNXrDg0igZwPRHWuZXEEgYHPo 6eT0Rgd62F9vintR3FcZllBtPehBx0ubXwtpmvZX5pure3ltHKoY+qxZ1KeY1ne8nA+z EEK3vZ3enhREAZkt3d5BpWS8asbCZm+du/aWtDxJd32iE4T+PFepJwVkG83uAO3WShfd DndTjNJdAz1fnDUVo+UpmTf7Nl5GrxjMA2cK6xgjc08aGH2GvqqcNeOVrEhIugGjKiZa Rni9Tu/PlbRBiF+745QgpaBNZVAGfu8EzqcxUqJ6wVB1Bu6Vc63uZwINcuIDmQBb6hSu VPBw== X-Gm-Message-State: AHQUAubyRtjxn3xIoF90a6wfSQiTXSPYZLTe+tEYKSrFwtMATPqyDJdw rZN/6GUF74oyJhwFasLH7afghaVe X-Google-Smtp-Source: AHgI3IbdoZFkJrjjZqJA6ku3KFTYjK+9ZG5mbsiP6k/Z1tiEFuEq3QX8qyOfCxfpm7HydkWiJMjiOg== X-Received: by 2002:a63:534c:: with SMTP id t12mr18925680pgl.205.1549912234461; Mon, 11 Feb 2019 11:10:34 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.10.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:33 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 2/9] switchdev: Add SWITCHDEV_PORT_ATTR_SET, SWITCHDEV_PORT_ATTR_GET Date: Mon, 11 Feb 2019 11:09:54 -0800 Message-Id: <20190211191001.8623-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In preparation for allowing switchdev enabled drivers to veto specific attribute settings from within the context of the caller, introduce a new switchdev notifier type for port attributes. Suggested-by: Ido Schimmel Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- include/net/switchdev.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 5e87b54c5dc5..b8becabbef38 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -143,6 +143,9 @@ enum switchdev_notifier_type { SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE, SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE, SWITCHDEV_VXLAN_FDB_OFFLOADED, + + SWITCHDEV_PORT_ATTR_SET, /* Blocking. */ + SWITCHDEV_PORT_ATTR_GET, /* Blocking. */ }; struct switchdev_notifier_info { @@ -165,6 +168,13 @@ struct switchdev_notifier_port_obj_info { bool handled; }; +struct switchdev_notifier_port_attr_info { + struct switchdev_notifier_info info; /* must be first */ + struct switchdev_attr *attr; + struct switchdev_trans *trans; + bool handled; +}; + static inline struct net_device * switchdev_notifier_info_to_dev(const struct switchdev_notifier_info *info) { From patchwork Mon Feb 11 19:09:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1040096 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OUA1fDbK"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ywNg1Y9kz9sDr for ; Tue, 12 Feb 2019 06:10:43 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387787AbfBKTKl (ORCPT ); Mon, 11 Feb 2019 14:10:41 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:43499 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732529AbfBKTKk (ORCPT ); Mon, 11 Feb 2019 14:10:40 -0500 Received: by mail-pl1-f196.google.com with SMTP id f90so5500399plb.10; Mon, 11 Feb 2019 11:10:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bcLXrvybRxvEpRiDWi/DGfWF7hfDDl3K/0VgbGIyK88=; b=OUA1fDbKWOlIw6c+sWhOFHCM49ft0PxF5Fh7j/6krgbsrXP2V5Bi0pkEfrE8OBSkbB UpMWf+GXGgm6DBnt73I7sX4cpb28DRCmRUoqiT9b4Jk879+3mWJCEMg1jgToaAracHOJ 0KQfVQ/nhHpqsStdlQiPFvwJ1A4OgE7V6Xu0wmc2RuEomd78io3O4Ha608P3pR8DfeGj VaBu1hXJ9LVf95/ClrRbDE+3iqq//vBFyleOIy07uxpTEGKAi2MW7H+25SNXb5SYYLuf 0rtx1JUPUHMM0/mGmCJzBa0b6f8GnzkuSo2zfJJKpxn7RzlzaPDMo8IWkS5lp1b9JFZ9 5Lmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bcLXrvybRxvEpRiDWi/DGfWF7hfDDl3K/0VgbGIyK88=; b=ik9puLNijiiwoOYoUsGHz5Ww6eGqUJPfJwef687ke0LQXX3kwPdw2mnsz+tEBFy+yY AcD0fQsg1kZajLreBR4AMcwlAiUmS6sC82dtsBrvKzmQuA+De//JgOJSDrTQ7agVIwQz +ltODo1AncCNHkd+kFEGv/QANZpoEQOlGXmAD15gmGhvcNBOXNEBf3+2GRFetTzyOAyZ L5QCI6T3nvFDDKtLTTnuZ2ZTN0ipI4IUXCxu/OycQZm9jpCvX46Q/9Gt3VLvjKOEq3QJ 9pATQ57kukpcSohen/Jfkn++KApMQrgpSR1HX9HvoqXAHaO74U1dqmaTXrJEJSS6TnOa caXg== X-Gm-Message-State: AHQUAubWMFqDgt0d3xCJdp+KCn2IgjGF8EYlel3lr/ekHOUZPzDB8+yt fCE6iytLYze13zZN8kg3+0LSfHL5 X-Google-Smtp-Source: AHgI3IafEEQYU+vr6b1WmVV/fyI6apUNCNhqFoyTzQa0MChwbbTiA2wCWPgVuOdFyInHPbXkoB7oNw== X-Received: by 2002:a17:902:c23:: with SMTP id 32mr22750767pls.183.1549912239291; Mon, 11 Feb 2019 11:10:39 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.10.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:38 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 3/9] rocker: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Mon, 11 Feb 2019 11:09:55 -0800 Message-Id: <20190211191001.8623-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare rocker to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing rocker_port_attr_{set,get} calls. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/net/ethernet/rocker/rocker_main.c | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 66f72f8c46e5..9a8fe49e32b6 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2835,6 +2835,27 @@ rocker_switchdev_port_obj_event(unsigned long event, struct net_device *netdev, return notifier_from_errno(err); } +static int +rocker_switchdev_port_attr_event(unsigned long event, struct net_device *netdev, + struct switchdev_notifier_port_attr_info + *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = rocker_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = rocker_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int rocker_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -2847,6 +2868,9 @@ static int rocker_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: case SWITCHDEV_PORT_OBJ_DEL: return rocker_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: /* fall through */ + case SWITCHDEV_PORT_ATTR_GET: + return rocker_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; From patchwork Mon Feb 11 19:09:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1040097 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uVqy4Nkv"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ywNq1LW2z9s7h for ; Tue, 12 Feb 2019 06:10:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387818AbfBKTKq (ORCPT ); Mon, 11 Feb 2019 14:10:46 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:44828 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732529AbfBKTKp (ORCPT ); Mon, 11 Feb 2019 14:10:45 -0500 Received: by mail-pl1-f193.google.com with SMTP id p4so5720220plq.11; Mon, 11 Feb 2019 11:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KF6AlsLZoN04sGHp2NFAD11lVXn/Fy4kJgdzP9H47YA=; b=uVqy4Nkvmt3Zd+BDUCRaRjJyPd3UW3yj9gXDuzghFhNImFuBE6egjrdFsKy87mlK2F kwpYWQM++R81qfhI/4V0qq5Pa3YbZduQr6WQE8dm5pCfTwetPj6a+hhUNqsfukLjC1pQ u7/V8AsYn4VxnD8BsnzWjP8C9bfH8Tm+JsIAnsIHpMkPcpGhsgrcFhFCd98Udov6Gm9Q EHkcWRRe0Chx0ZUsujD+UkWORgMJmzIHRWLgMdRAvzgsbTW4vWSOm/Cbk2wohPIU9NAr hIssQAGhcSEAsZ6rL39eVeiwGuKUIV6ELb6cJuHKQnKENVqiNZspJhEPKPkg6Nhf2/V7 tjSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KF6AlsLZoN04sGHp2NFAD11lVXn/Fy4kJgdzP9H47YA=; b=KKsyVnJ7ehbhc59IPZv8z6/PTDtobylStRnUuOc0QGe457TARipfNkrsk2jrxrO5WC /jMcGY7jaPbLLSt5drRLm2zMZu5OBQdAPle78pv7PwGaeuUTKdkr6mJeJsWX6FN16Jwx 5iVx+GH6fZQ3Esz318rbVsPF/vdUE7XWgPWYxjeDZYNCo43mHuYi1XEtAYtvfb7L3pDZ PpGnp+Q2EdhA8fP6aTQeNpxOqnOYTUtfI/VRPE37pATZnmlNPwtB+vrQgoCPURfv/PYM Hpzo8ZysLNJJXO19uvKOtZjwoFikq8ROiWV2PpIw69+kFEovuAqzqKKmQpBY6BrI7VrO 0icQ== X-Gm-Message-State: AHQUAuYgijZfF2U7Y6wccSwgEEwaQ7OoOregH6HzyEumLtolLMqOoQSM oG4zpQtSJ28g9z7M4tv/AJknrrfn X-Google-Smtp-Source: AHgI3Ibxos7bufAZTYDQyfYe9rJzA3QByVByFGfqC5P8tWwEsSiXvdJoSlEH0EFpCESeirH/XqjhvQ== X-Received: by 2002:a17:902:bd0b:: with SMTP id p11mr39081096pls.259.1549912243989; Mon, 11 Feb 2019 11:10:43 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.10.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:43 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 4/9] mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Mon, 11 Feb 2019 11:09:56 -0800 Message-Id: <20190211191001.8623-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare mlxsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing mlxsw_sp_port_attr_{set,get} calls. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- .../mellanox/mlxsw/spectrum_switchdev.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 95e37de3e48f..88d4994309a7 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -3443,6 +3443,26 @@ mlxsw_sp_switchdev_handle_vxlan_obj_del(struct net_device *vxlan_dev, } } +static int +mlxsw_sp_switchdev_port_attr_event(unsigned long event, struct net_device *dev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = mlxsw_sp_port_attr_set(dev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = mlxsw_sp_port_attr_get(dev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -3466,6 +3486,9 @@ static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused, mlxsw_sp_port_dev_check, mlxsw_sp_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: /* fall through */ + case SWITCHDEV_PORT_ATTR_GET: + return mlxsw_sp_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; From patchwork Mon Feb 11 19:09:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1040098 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MVlbH4dz"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ywNv2tRnz9s7h for ; Tue, 12 Feb 2019 06:10:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387862AbfBKTKu (ORCPT ); Mon, 11 Feb 2019 14:10:50 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:42422 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387839AbfBKTKt (ORCPT ); Mon, 11 Feb 2019 14:10:49 -0500 Received: by mail-pl1-f196.google.com with SMTP id s1so5721539plp.9; Mon, 11 Feb 2019 11:10:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gHKxFom+TS/uF5v75rmvzWOuknaksPpVihcsZQowL1A=; b=MVlbH4dzntI3IR9RVcIK2FK8xRxzeOeNb27b9kw5jLskOwT1wRIwWxZRbtILQhYpJW ANUTedMB3lzTaedxha+8Yeh/5jB8x5sRGrS15zyaUzv/2vXgLajWhJw2CG/5hOCv33jv DfPe4aBGANyQubzxw2DNkITnX/a9ezGDmDRFfG9JAj21wkM8zI7vS6XvPlGbwMKLOaL2 dsvLtiZSUaFmPVT3gzZllCliRN6ptrgNR1M+MQMXHjnkHAInZLuj9FRNBB8DL5RQ39Zj w8RSbGA15xJoCRXcfBaTJ2ogmtA/m9d9Ad0m8LN635J5Pb2ekspQec6ORBQJRUaQWhiu FqVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gHKxFom+TS/uF5v75rmvzWOuknaksPpVihcsZQowL1A=; b=pLo5q2dNn5uMmHtxbaaPNgKSYnyKmE64rlvgQf7RVFCdIw8wR4H8lKUiHO6oP3e7j6 k3eUjdobcWa7LlkzA/isw2ybTWoG3bknO0O5AmUETkhgN3hl9kaMRSsqYsEJY0jsuJt8 54dUQA4yXCerHnAdrL9bbKxqdAkRkzh8UB8wInQ0wwt4NiesY/wdv/PXrjom0aQFCGDs mc3/NZIAZuR/jzhANsLQwXzr0a4XGyKNdDw036O0ir7pIL51ZvaT6/UEWIO6Dp97M2gs pu24fINQ2qJDeaeDHxpX4zt6C/MD1Cy0MXzHsvzUIgpf9jxFrk3GHYnWTRwpy0a/eG6v 8CXA== X-Gm-Message-State: AHQUAuYUI/6+LmljJxVKm1LMj9GtLxCZXOF49bLckRcq33NTqfg23oUG oDmNBQRH5yG4RPjUJ/AaZcrjSHBd X-Google-Smtp-Source: AHgI3IZRxgnj4A54FpZk15/tXm5N61F4aLsHNizx+1Qy8u7RNKrQFRbeshBD9KwPBrYwgKHgc8Jb7Q== X-Received: by 2002:a17:902:6a4:: with SMTP id 33mr38282056plh.99.1549912248637; Mon, 11 Feb 2019 11:10:48 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.10.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:47 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 5/9] net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Mon, 11 Feb 2019 11:09:57 -0800 Message-Id: <20190211191001.8623-6-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare ocelot to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing ocelot_port_attr_{set,get} calls. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 195306d05bcd..2708809713ed 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1582,6 +1582,24 @@ struct notifier_block ocelot_netdevice_nb __read_mostly = { }; EXPORT_SYMBOL(ocelot_netdevice_nb); +static int +ocelot_switchdev_port_attr_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = ocelot_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int ocelot_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1600,6 +1618,9 @@ static int ocelot_switchdev_blocking_event(struct notifier_block *unused, ocelot_netdevice_dev_check, ocelot_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: /* fall through */ + case SWITCHDEV_PORT_ATTR_GET: + return ocelot_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; From patchwork Mon Feb 11 19:09:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1040099 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="spoQsBYL"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ywP04X3Fz9sCh for ; Tue, 12 Feb 2019 06:11:00 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387896AbfBKTKz (ORCPT ); Mon, 11 Feb 2019 14:10:55 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37967 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732003AbfBKTKy (ORCPT ); Mon, 11 Feb 2019 14:10:54 -0500 Received: by mail-pf1-f196.google.com with SMTP id q1so3932pfi.5; Mon, 11 Feb 2019 11:10:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PtphDvmR0qKeN+UBu36HCt3kNK/VogT0oyGt8UI1w80=; b=spoQsBYLruAe2gNmZRBItcN0oBivyr230rVfYZef/4xvMbtFpvaXVMAExm23wgPjBb xaDR0Cds6Oir/q543dy+ipROwGpyQVbzhKEb0X0lGkd8anKb4DILSpbj3S/HtHO+1lyU 1tuX1SiZdXw/flJUVgymW2hj80PRENHW2afbomAb+h3o2chkqtxkxYGDd2BSa9mguiNg ApMUNKE5oMhNb9RUaCXvbLVZMCaufsMn2EUqgMVtbiFN0Pv6kAg/Yd4T0sNsM7it1rYx O4ARjF6WzumFJdLbv7WJhIeZCmd9pgntejakNtJyZcYU3BW8V6iIJ/OLz5SsvYmOU6ey bvdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PtphDvmR0qKeN+UBu36HCt3kNK/VogT0oyGt8UI1w80=; b=i+wnPWxv/e3Wu/pw1U4gcdMyuipq2GQdJkBk7/VVtM9O+Mu+iwZyUjXGE+qNtm1Qmo yQ+NlFAeT//eJsTEZNQqSFXYZe3QRU4kNy1xeTkphNr0KIevoGVj7hmMkbVSFeCD71w7 J8uWXX99oCgUbSLGXHnPhaU8SHJnYAnBHlU9FqAxAVOObX2YSPJT3IpOPSWvfQNbctkQ rBHfskgB6wB3Dl11tsQp1qWbtfvZXp9jLxWz4VTLamV+eQ07h6raW7HrnbMOTzK+5BFW EdNkJS68fq81fRRcdtN3xqfXB8wsUKsazirrYtkkMf2jHJB3E4RUKaXlX8Y9S9c4Ac5r 4wVA== X-Gm-Message-State: AHQUAuZSWlWFMX5a9Nn2c7demIz08sHgMlBY74P5S6KiHcIefcGkmYAl ioGFeJRicceaAp06Yi0tnzV9Fu+z X-Google-Smtp-Source: AHgI3IZiDFGGoA6/CFFNyBEGs+nk4D0ltjldTClH6j/AfwsjfEVXKPb8Pr+uDdMTLUiMkMeEu0fBgw== X-Received: by 2002:a63:4e05:: with SMTP id c5mr3409661pgb.393.1549912253454; Mon, 11 Feb 2019 11:10:53 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.10.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:52 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 6/9] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Mon, 11 Feb 2019 11:09:58 -0800 Message-Id: <20190211191001.8623-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare ethsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing swdev_port_attr_{set,get} calls. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index e559f4c25cf7..7c77fb43233e 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1111,6 +1111,27 @@ ethsw_switchdev_port_obj_event(unsigned long event, struct net_device *netdev, return notifier_from_errno(err); } +static int +ethsw_switchdev_port_attr_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = swdev_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = swdev_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int port_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1123,6 +1144,9 @@ static int port_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return ethsw_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: /* fall through */ + case SWITCHDEV_PORT_ATTR_GET: + return ethsw_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; From patchwork Mon Feb 11 19:09:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1040105 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="t8yCDwGf"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ywPV6f4Lz9s7h for ; Tue, 12 Feb 2019 06:11:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387924AbfBKTLB (ORCPT ); Mon, 11 Feb 2019 14:11:01 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34252 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732003AbfBKTK7 (ORCPT ); Mon, 11 Feb 2019 14:10:59 -0500 Received: by mail-pf1-f193.google.com with SMTP id j18so15229pfe.1; Mon, 11 Feb 2019 11:10:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QPgFt5j6UGQb+YmlyjgIvSlCGoFlyBm2NR9++YJ/iss=; b=t8yCDwGfisKuIVMD1tXN+vqj45cMlPM2XmC78pl355j/537+oBFV3mapZqnNmlg+k0 NoQUOCWfKGYPJch0bYxXfo+Hz5T3OVDjUs2iddTX7edc76wz/hicWpluIMn6uawBRSak EQuAcpqirdfhYdYb5oNPA/UGHWlEtp0DJbdMuI7v2K7uQTMWoB+Sm68latHf5turkcFg lc8i5Bkaa53IUazdHwY0vsMTqr7bnj8xGVtnwfC9OTtL50ilvBaudJ+Xg8gTKarKtGT1 eota6GzH3QYlXbdcpLi1M3zZSKNX0Cy/s6jJG7HWiTgQMnJ2/IcOaV8SjvnTUu0zE2tY WdGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QPgFt5j6UGQb+YmlyjgIvSlCGoFlyBm2NR9++YJ/iss=; b=Hm3hVUasBDawC8Et+HGCyRpDEQN0gE2pgDmOmAffef1Vt5IJapKxZvGlHLikvxQDkD rNeVMhVuaiE+TFCk1U3KTB9E4cnNEmBPJjcm9ECTWYT55YU63JG7RXO0ul+5DdWueKrO 8irZJ84Wnt4k8zNBZ5qETNUrGTQ9DQ6jKTG+FtoaRbELb4uqrUGa9AC+ftzcuH1aIvGI 2cgmOSKQbx3jEaOxJuEbUuwr+RSx6I1I5g46EH9SzjJ4ryGSWTIBN1xGwma4kqj/UPc2 JdhjYtMGzf8sB7arFqtPqefoackst8S5trlX2eUmSgxIHXwY5NYBwgcZ/kKJXLXBPyAP cz5A== X-Gm-Message-State: AHQUAualiViVChEvR+bICYj8l1NltrwQG+a6wKZ6qpzvzkLQxgPMz6lP +FPHx4+pUS7FB6nF0QUBqFMpkfGF X-Google-Smtp-Source: AHgI3IbzF9ES1nHxpxd9zZbML0Iess69DcezcjTNdVCNN8jZ4EAmJAJMimDCm+WnfBvme3z75hjLHQ== X-Received: by 2002:a62:6e07:: with SMTP id j7mr39117095pfc.135.1549912258113; Mon, 11 Feb 2019 11:10:58 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.10.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:10:57 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 7/9] net: dsa: Handle SWITCHDEV_PORT_ATTR_GET/SET Date: Mon, 11 Feb 2019 11:09:59 -0800 Message-Id: <20190211191001.8623-8-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Following patches will change the way we communicate getting or setting a port's attribute and use a blocking notifier to perform those tasks. Prepare DSA to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing dsa_slave_port_attr_{set,get} calls. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- net/dsa/slave.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 2e5e7c04821b..66c6c353f4f7 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1558,6 +1558,27 @@ dsa_slave_switchdev_port_obj_event(unsigned long event, return notifier_from_errno(err); } +static int +dsa_slave_switchdev_port_attr_event(unsigned long event, + struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err = -EOPNOTSUPP; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = dsa_slave_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + break; + case SWITCHDEV_PORT_ATTR_GET: + err = dsa_slave_port_attr_get(netdev, port_attr_info->attr); + break; + } + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1570,6 +1591,9 @@ static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return dsa_slave_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: /* fall through */ + case SWITCHDEV_PORT_ATTR_GET: + return dsa_slave_switchdev_port_attr_event(event, dev, ptr); } return NOTIFY_DONE; From patchwork Mon Feb 11 19:10:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1040104 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="blyiAXcE"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ywPT0szGz9sCh for ; Tue, 12 Feb 2019 06:11:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388008AbfBKTLT (ORCPT ); Mon, 11 Feb 2019 14:11:19 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:43529 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732003AbfBKTLE (ORCPT ); Mon, 11 Feb 2019 14:11:04 -0500 Received: by mail-pl1-f196.google.com with SMTP id f90so5500857plb.10; Mon, 11 Feb 2019 11:11:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=v/u+Kp7GgYlDbKFbh6YAwMSm2Elg7F9P+dQ3wMoaKCw=; b=blyiAXcEzoAiAtY/XQPfKGkZIrnOlkb8ifQ0jwBIbvvfYB5VkNIeaeq7HUgA5tR70u seLRGL98vrh88Z1yHu9EAnnXw5uVNZgZDwP8olBqXT+JIKtT5ROdaarj9fAjLZrhkkDS UfSGI+XHx4h8qUbCdEd/+38zFc5uQaWj6lhgYIua1P2/c6tejO7UNpoBU1gYxU0ZPMtt EdwIQBCNtb8+FQSoOUYtaQFqFIED13BJWkjHHVKFfGWMNI2m0vDzgTxc8JPWAA+Z2yRK s+qobnnwW9SKAjJXZn5W9v9hwVWO68K4AwOgUDswNiwisa5bjbwTXj1Hrh1qdeTWle5F v9YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v/u+Kp7GgYlDbKFbh6YAwMSm2Elg7F9P+dQ3wMoaKCw=; b=WSHgIfj+/TmnojUHnlG0XM+bnQGZmLaBY4KQdrs+GoMwMIHzqR10y6/Ell6ef+wphl afz3Cz3qXg4ekWeIG81Pil22MDKfvVAkx9798s4uwcodP/A4c6zP5VlRH5MurluPlLQu aseJe09bq0j2K33Xq3UyKNK4N+vnanLLnBWFI1iBabbtnIHpA9pCqZg2YnhgocH4sDkF TRHYnjtcz0mFoLuoMSDA51IqyWTR6Z3IyG76qiVr/mTK0dTg03pYakFRMgDMozaOqMYA z204Js5aGl/59OYMR2UH0YEY9tgV5WsEtSplK7IUBRZnF/YajFyy3cnmX+Mpgft0hafz K05w== X-Gm-Message-State: AHQUAuZEY0/CMxSZeDae7iK446S/I5yb+I6s/xmLpSX3jiMdEcRRJGC6 /PiGtF2Vqi/00srpBAK4isBGmI8l X-Google-Smtp-Source: AHgI3IbDoMH/38BmZxDFiDtNqXOZxfWY567eX/3dciKqeGqin9Wjtarx4yU5h4+C6bSGbYu5WUIIGA== X-Received: by 2002:a17:902:27a8:: with SMTP id d37mr39373804plb.182.1549912263106; Mon, 11 Feb 2019 11:11:03 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.10.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:11:02 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 8/9] net: switchdev: Replace port attr get/set SDO with a notification Date: Mon, 11 Feb 2019 11:10:00 -0800 Message-Id: <20190211191001.8623-9-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Drop switchdev_ops.switchdev_port_attr_get and _set. Drop the uses of this field from all clients, which were migrated to use switchdev notification in the previous patches. Add a new function switchdev_port_attr_notify() that sends the switchdev notifications SWITCHDEV_PORT_ATTR_GET and _SET. Update switchdev_port_attr_get() to dispatch to this new function. Drop __switchdev_port_attr_set() and update switchdev_port_attr_set() likewise. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- net/switchdev/switchdev.c | 107 +++++++++++++------------------------- 1 file changed, 37 insertions(+), 70 deletions(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 7e1357db33d7..8fc3db2179f5 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -174,81 +174,31 @@ static int switchdev_deferred_enqueue(struct net_device *dev, return 0; } -/** - * switchdev_port_attr_get - Get port attribute - * - * @dev: port device - * @attr: attribute to get - */ -int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr) +static int switchdev_port_attr_notify(enum switchdev_notifier_type nt, + struct net_device *dev, + struct switchdev_attr *attr, + struct switchdev_trans *trans) { - const struct switchdev_ops *ops = dev->switchdev_ops; - struct net_device *lower_dev; - struct list_head *iter; - struct switchdev_attr first = { - .id = SWITCHDEV_ATTR_ID_UNDEFINED - }; - int err = -EOPNOTSUPP; + int err; + int rc; - if (ops && ops->switchdev_port_attr_get) - return ops->switchdev_port_attr_get(dev, attr); + struct switchdev_notifier_port_attr_info attr_info = { + .attr = attr, + .trans = trans, + .handled = false, + }; - if (attr->flags & SWITCHDEV_F_NO_RECURSE) + rc = call_switchdev_blocking_notifiers(nt, dev, &attr_info.info, NULL); + err = notifier_to_errno(rc); + if (err) { + WARN_ON(!attr_info.handled); return err; - - /* Switch device port(s) may be stacked under - * bond/team/vlan dev, so recurse down to get attr on - * each port. Return -ENODATA if attr values don't - * compare across ports. - */ - - netdev_for_each_lower_dev(dev, lower_dev, iter) { - err = switchdev_port_attr_get(lower_dev, attr); - if (err) - break; - if (first.id == SWITCHDEV_ATTR_ID_UNDEFINED) - first = *attr; - else if (memcmp(&first, attr, sizeof(*attr))) - return -ENODATA; - } - - return err; -} -EXPORT_SYMBOL_GPL(switchdev_port_attr_get); - -static int __switchdev_port_attr_set(struct net_device *dev, - const struct switchdev_attr *attr, - struct switchdev_trans *trans) -{ - const struct switchdev_ops *ops = dev->switchdev_ops; - struct net_device *lower_dev; - struct list_head *iter; - int err = -EOPNOTSUPP; - - if (ops && ops->switchdev_port_attr_set) { - err = ops->switchdev_port_attr_set(dev, attr, trans); - goto done; - } - - if (attr->flags & SWITCHDEV_F_NO_RECURSE) - goto done; - - /* Switch device port(s) may be stacked under - * bond/team/vlan dev, so recurse down to set attr on - * each port. - */ - - netdev_for_each_lower_dev(dev, lower_dev, iter) { - err = __switchdev_port_attr_set(lower_dev, attr, trans); - if (err) - break; } -done: - if (err == -EOPNOTSUPP && attr->flags & SWITCHDEV_F_SKIP_EOPNOTSUPP) - err = 0; + if (!attr_info.handled) + return -EOPNOTSUPP; - return err; + return 0; } static int switchdev_port_attr_set_now(struct net_device *dev, @@ -267,7 +217,9 @@ static int switchdev_port_attr_set_now(struct net_device *dev, */ trans.ph_prepare = true; - err = __switchdev_port_attr_set(dev, attr, &trans); + err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET, + dev, (struct switchdev_attr *)attr, + &trans); if (err) { /* Prepare phase failed: abort the transaction. Any * resources reserved in the prepare phase are @@ -286,7 +238,9 @@ static int switchdev_port_attr_set_now(struct net_device *dev, */ trans.ph_prepare = false; - err = __switchdev_port_attr_set(dev, attr, &trans); + err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET, + dev, (struct switchdev_attr *)attr, + &trans); WARN(err, "%s: Commit of attribute (id=%d) failed.\n", dev->name, attr->id); switchdev_trans_items_warn_destroy(dev, &trans); @@ -338,6 +292,19 @@ int switchdev_port_attr_set(struct net_device *dev, } EXPORT_SYMBOL_GPL(switchdev_port_attr_set); +/** + * switchdev_port_attr_get - Get port attribute + * + * @dev: port device + * @attr: attribute to get + */ +int switchdev_port_attr_get(struct net_device *dev, struct switchdev_attr *attr) +{ + return switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_GET, dev, + attr, NULL); +} +EXPORT_SYMBOL_GPL(switchdev_port_attr_get); + static size_t switchdev_obj_size(const struct switchdev_obj *obj) { switch (obj->id) { From patchwork Mon Feb 11 19:10:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1040103 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vQhGIbL7"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43ywPJ0VqLz9sCh for ; Tue, 12 Feb 2019 06:11:16 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387979AbfBKTLK (ORCPT ); Mon, 11 Feb 2019 14:11:10 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:37331 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387928AbfBKTLJ (ORCPT ); Mon, 11 Feb 2019 14:11:09 -0500 Received: by mail-pl1-f194.google.com with SMTP id b5so5561plr.4; Mon, 11 Feb 2019 11:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H1+HaPC+RDQ7Hf6AkrEO0q3vBnmPihvjrvc1H7LBVkM=; b=vQhGIbL794frBcHb1jlXwfd5GP+9Z30Ja8S5bu65m4NA3wXSzLd80mvZHZosLNAd9x cbfH+WNeMhjCQnqOHCyViFFV4it6HnZ3wVdHms2njDPa+GFh2dSm4O9p7D/YpJB90NHI NvaVwDzT2uV+CsBRevK2s7GKYnsvCHi8kbNw3XVOIsVYVtYYbBqjhEdAvaVuTpgwXLy7 UXvtchcBUNVSWAMEpztpBuGoe6lYvB/nwhjSIWcR960IO+n/6h1Xh/NUKksiIw+OWEAK aX5qIYxFyo1B/5sU23jLaP2Op/y/BTv9thQYfSguMiUy9KmG1lKRcoDK56SYIL2CLmlH MNsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H1+HaPC+RDQ7Hf6AkrEO0q3vBnmPihvjrvc1H7LBVkM=; b=rupA1V54w1lzCkmLI2sGbpkCnbfqpr835hafbilPkaNAgTE1CFu673OwtlMT7QNU0X UZXvLoxJoEdiOk8poo948eWsNeEf3grhAGWJuVPksTu7qOInQDYBJmVDDvuNh40kVbMI dtsCRBM+5gHfqkCV/J494vcZpQxtyPj140wPit7SrVodkcddMVqYvjmV5wRTuX0r8ZXE IdvPZOb3EtQY1xpRO0d5eHefH5nSILJbOFIzLjZA7JUpJkKtj2uauk/h8R4CUym5Ee0E bn1PoX15bVViGnhNScYLbwB+ntOjdTlM6H0x+QTh7KkUhaCTs5JJmYc4lzKlqDGn2Amr nVeQ== X-Gm-Message-State: AHQUAua3mWbgq15p6eQoOkmfHrZY2ZvbiHUguaCvzyV1B27Nw2nQ4GqI gz3jQUtXgs0KAK7Yjf96r5xgQnBI X-Google-Smtp-Source: AHgI3IZ5ouK348krWFXJjRYHN8yct/EtFxC4PKHW1NgQ7TajP657JlbOBKLvDgsZlFxtJPeMCF8j5w== X-Received: by 2002:a17:902:8f8d:: with SMTP id z13mr26082335plo.95.1549912268266; Mon, 11 Feb 2019 11:11:08 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.11.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:11:07 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 9/9] net: Remove switchdev_ops Date: Mon, 11 Feb 2019 11:10:01 -0800 Message-Id: <20190211191001.8623-10-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that we have converted all possible callers to using a switchdev notifier for attributes we do not have a need for implementing switchdev_ops anymore, and this can be removed from all drivers the net_device structure. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 12 ------------ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 -- .../mellanox/mlxsw/spectrum_switchdev.c | 13 ------------- drivers/net/ethernet/mscc/ocelot.c | 5 ----- drivers/net/ethernet/rocker/rocker_main.c | 6 ------ drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 6 ------ include/linux/netdevice.h | 3 --- include/net/switchdev.h | 18 ------------------ net/dsa/slave.c | 6 ------ 9 files changed, 71 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 7c9745cecbbd..619965abab43 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3220,7 +3220,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, } mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan; - mlxsw_sp_port_switchdev_init(mlxsw_sp_port); mlxsw_sp->ports[local_port] = mlxsw_sp_port; err = register_netdev(dev); if (err) { @@ -3237,7 +3236,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, err_register_netdev: mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan); err_port_vlan_create: err_port_pvid_set: @@ -3280,7 +3278,6 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port) mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp); unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true); mlxsw_sp_port_nve_fini(mlxsw_sp_port); mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); @@ -4001,12 +3998,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, goto err_span_init; } - err = mlxsw_sp_switchdev_init(mlxsw_sp); - if (err) { - dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize switchdev\n"); - goto err_switchdev_init; - } - err = mlxsw_sp_counter_pool_init(mlxsw_sp); if (err) { dev_err(mlxsw_sp->bus_info->dev, "Failed to init counter pool\n"); @@ -4077,8 +4068,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, err_afa_init: mlxsw_sp_counter_pool_fini(mlxsw_sp); err_counter_pool_init: - mlxsw_sp_switchdev_fini(mlxsw_sp); -err_switchdev_init: mlxsw_sp_span_fini(mlxsw_sp); err_span_init: mlxsw_sp_lag_fini(mlxsw_sp); @@ -4141,7 +4130,6 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core) mlxsw_sp_nve_fini(mlxsw_sp); mlxsw_sp_afa_fini(mlxsw_sp); mlxsw_sp_counter_pool_fini(mlxsw_sp); - mlxsw_sp_switchdev_fini(mlxsw_sp); mlxsw_sp_span_fini(mlxsw_sp); mlxsw_sp_lag_fini(mlxsw_sp); mlxsw_sp_buffers_fini(mlxsw_sp); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index ceebc91f4f1d..82e3e6dc81a1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -375,8 +375,6 @@ u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes); /* spectrum_switchdev.c */ int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp); void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp); -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port); -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port); int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, bool adding); void diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 88d4994309a7..3e2ef69a1d22 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1957,11 +1957,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp, return NULL; } -static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = { - .switchdev_port_attr_get = mlxsw_sp_port_attr_get, - .switchdev_port_attr_set = mlxsw_sp_port_attr_set, -}; - static int mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device, struct mlxsw_sp_bridge_port *bridge_port, @@ -3576,11 +3571,3 @@ void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp) kfree(mlxsw_sp->bridge); } -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port) -{ - mlxsw_sp_port->dev->switchdev_ops = &mlxsw_sp_port_switchdev_ops; -} - -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port) -{ -} diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 2708809713ed..374636e8fcbe 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1324,10 +1324,6 @@ static int ocelot_port_obj_del(struct net_device *dev, return ret; } -static const struct switchdev_ops ocelot_port_switchdev_ops = { - .switchdev_port_attr_set = ocelot_port_attr_set, -}; - static int ocelot_port_bridge_join(struct ocelot_port *ocelot_port, struct net_device *bridge) { @@ -1654,7 +1650,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port, dev->netdev_ops = &ocelot_port_netdev_ops; dev->ethtool_ops = &ocelot_ethtool_ops; - dev->switchdev_ops = &ocelot_port_switchdev_ops; dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS; dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 9a8fe49e32b6..b017543fd196 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2147,11 +2147,6 @@ static int rocker_port_obj_del(struct net_device *dev, return err; } -static const struct switchdev_ops rocker_port_switchdev_ops = { - .switchdev_port_attr_get = rocker_port_attr_get, - .switchdev_port_attr_set = rocker_port_attr_set, -}; - struct rocker_fib_event_work { struct work_struct work; union { @@ -2605,7 +2600,6 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number) rocker_port_dev_addr_init(rocker_port); dev->netdev_ops = &rocker_port_netdev_ops; dev->ethtool_ops = &rocker_port_ethtool_ops; - dev->switchdev_ops = &rocker_port_switchdev_ops; netif_tx_napi_add(dev, &rocker_port->napi_tx, rocker_port_poll_tx, NAPI_POLL_WEIGHT); netif_napi_add(dev, &rocker_port->napi_rx, rocker_port_poll_rx, diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 7c77fb43233e..f4489976a9ac 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -932,11 +932,6 @@ static int swdev_port_obj_del(struct net_device *netdev, return err; } -static const struct switchdev_ops ethsw_port_switchdev_ops = { - .switchdev_port_attr_get = swdev_port_attr_get, - .switchdev_port_attr_set = swdev_port_attr_set, -}; - /* For the moment, only flood setting needs to be updated */ static int port_bridge_join(struct net_device *netdev, struct net_device *upper_dev) @@ -1466,7 +1461,6 @@ static int ethsw_probe_port(struct ethsw_core *ethsw, u16 port_idx) SET_NETDEV_DEV(port_netdev, dev); port_netdev->netdev_ops = ðsw_port_ops; port_netdev->ethtool_ops = ðsw_port_ethtool_ops; - port_netdev->switchdev_ops = ðsw_port_switchdev_ops; /* Set MTU limits */ port_netdev->min_mtu = ETH_MIN_MTU; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1fb733f38a47..a747456b9d23 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1836,9 +1836,6 @@ struct net_device { #endif const struct net_device_ops *netdev_ops; const struct ethtool_ops *ethtool_ops; -#ifdef CONFIG_NET_SWITCHDEV - const struct switchdev_ops *switchdev_ops; -#endif #ifdef CONFIG_NET_L3_MASTER_DEV const struct l3mdev_ops *l3mdev_ops; #endif diff --git a/include/net/switchdev.h b/include/net/switchdev.h index b8becabbef38..e9aa920aba57 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -113,21 +113,6 @@ void *switchdev_trans_item_dequeue(struct switchdev_trans *trans); typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj); -/** - * struct switchdev_ops - switchdev operations - * - * @switchdev_port_attr_get: Get a port attribute (see switchdev_attr). - * - * @switchdev_port_attr_set: Set a port attribute (see switchdev_attr). - */ -struct switchdev_ops { - int (*switchdev_port_attr_get)(struct net_device *dev, - struct switchdev_attr *attr); - int (*switchdev_port_attr_set)(struct net_device *dev, - const struct switchdev_attr *attr, - struct switchdev_trans *trans); -}; - enum switchdev_notifier_type { SWITCHDEV_FDB_ADD_TO_BRIDGE = 1, SWITCHDEV_FDB_DEL_TO_BRIDGE, @@ -229,7 +214,6 @@ int switchdev_handle_port_obj_del(struct net_device *dev, int (*del_cb)(struct net_device *dev, const struct switchdev_obj *obj)); -#define SWITCHDEV_SET_OPS(netdev, ops) ((netdev)->switchdev_ops = (ops)) #else static inline void switchdev_deferred_process(void) @@ -322,8 +306,6 @@ switchdev_handle_port_obj_del(struct net_device *dev, return 0; } -#define SWITCHDEV_SET_OPS(netdev, ops) do {} while (0) - #endif #endif /* _LINUX_SWITCHDEV_H_ */ diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 66c6c353f4f7..3deab965dad9 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1057,11 +1057,6 @@ static const struct net_device_ops dsa_slave_netdev_ops = { .ndo_get_port_parent_id = dsa_slave_get_port_parent_id, }; -static const struct switchdev_ops dsa_slave_switchdev_ops = { - .switchdev_port_attr_get = dsa_slave_port_attr_get, - .switchdev_port_attr_set = dsa_slave_port_attr_set, -}; - static struct device_type dsa_type = { .name = "dsa", }; @@ -1321,7 +1316,6 @@ int dsa_slave_create(struct dsa_port *port) eth_hw_addr_inherit(slave_dev, master); slave_dev->priv_flags |= IFF_NO_QUEUE; slave_dev->netdev_ops = &dsa_slave_netdev_ops; - slave_dev->switchdev_ops = &dsa_slave_switchdev_ops; slave_dev->min_mtu = 0; slave_dev->max_mtu = ETH_MAX_MTU; SET_NETDEV_DEVTYPE(slave_dev, &dsa_type);