Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755067AbbFBB3A (ORCPT ); Mon, 1 Jun 2015 21:29:00 -0400 Received: from mail.savoirfairelinux.com ([209.172.62.77]:64414 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754430AbbFBB2C (ORCPT ); Mon, 1 Jun 2015 21:28:02 -0400 From: Vivien Didelot To: netdev@vger.kernel.org Cc: Vivien Didelot , "David S. Miller" , Guenter Roeck , Florian Fainelli , Andrew Lunn , "Scott Feldman" , Jiri Pirko , Jerome Oufella , linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "Chris Healy" Subject: [RFC 1/9] net: dsa: add basic support for switchdev obj Date: Mon, 1 Jun 2015 21:27:42 -0400 Message-Id: <1433208470-25338-2-git-send-email-vivien.didelot@savoirfairelinux.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1433208470-25338-1-git-send-email-vivien.didelot@savoirfairelinux.com> References: <1433208470-25338-1-git-send-email-vivien.didelot@savoirfairelinux.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2046 Lines: 73 This patch adds the switchdev operations to add and delete switchdev objects. This will be necessary to add fdb or VLAN entries. Signed-off-by: Vivien Didelot --- net/dsa/slave.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 04ffad3..cbda00a 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -363,6 +363,43 @@ static int dsa_slave_port_attr_set(struct net_device *dev, return ret; } +static int dsa_slave_port_obj_add(struct net_device *dev, + struct switchdev_obj *obj) +{ + int err; + + /* + * Skip the prepare phase, since currently the DSA drivers don't need to + * allocate any memory for operations and they will not fail to HW + * (unless something horrible goes wrong on the MDIO bus, in which case + * the prepare phase wouldn't have been able to predict anyway). + */ + if (obj->trans != SWITCHDEV_TRANS_COMMIT) + return 0; + + switch (obj->id) { + default: + err = -ENOTSUPP; + break; + } + + return err; +} + +static int dsa_slave_port_obj_del(struct net_device *dev, + struct switchdev_obj *obj) +{ + int err; + + switch (obj->id) { + default: + err = -EOPNOTSUPP; + break; + } + + return err; +} + static int dsa_slave_bridge_port_join(struct net_device *dev, struct net_device *br) { @@ -702,6 +739,8 @@ static const struct net_device_ops dsa_slave_netdev_ops = { 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, + .switchdev_port_obj_add = dsa_slave_port_obj_add, + .switchdev_port_obj_del = dsa_slave_port_obj_del, }; static void dsa_slave_adjust_link(struct net_device *dev) -- 2.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/