From patchwork Sun Apr 24 12:09:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alaa Mohamed X-Patchwork-Id: 1621509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=JpShRDd1; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmRmN379Gz9s09 for ; Sun, 24 Apr 2022 22:10:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id ADC8060DFF; Sun, 24 Apr 2022 12:10:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hKB_IHnUlYkL; Sun, 24 Apr 2022 12:10:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 8C0DF60E08; Sun, 24 Apr 2022 12:10:09 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 49D5A1BF402 for ; Sun, 24 Apr 2022 12:10:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 46F7D8196A for ; Sun, 24 Apr 2022 12:10:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZTCLoQSL1A2o for ; Sun, 24 Apr 2022 12:10:05 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by smtp1.osuosl.org (Postfix) with ESMTPS id 3E6FD818D7 for ; Sun, 24 Apr 2022 12:10:05 +0000 (UTC) Received: by mail-wr1-x432.google.com with SMTP id w4so17132807wrg.12 for ; Sun, 24 Apr 2022 05:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I0KjIpgEpGIs4Rcz1EDMb7v+ywRUzPgRr1Wdx2LhcoQ=; b=JpShRDd1K+3yyW8TIXsTt7wIzaR6We1AUaCQvjdA3qMFQclqqfa9qSw9TPSrF2B41Q a/xhHMhPJBLyEtGW1SR5LNxMVJW752HklVLCX7yxFH1uIdPoODunnvNr2kPKeboxivdX TJZCtxlaSWe/bi32w7qXaAXmf9JRSqNFDJVr/N8eY3b6ei+muQanMWMoEyy3rzb+qOmx oc3x6j5xGDNhuhfFy+/1WulYfK69sqeclOiSOieV2GeTKd1qGL23NRPTJMYVb+d1vHOf AjTrzoopnTlkZg250yri3NR16A603irB+VMC1j8f/fvD1ED4dBQ3hINC9mBY297Yeb08 CwfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I0KjIpgEpGIs4Rcz1EDMb7v+ywRUzPgRr1Wdx2LhcoQ=; b=1Np1g6oUZUt2UUlmEeYXvI4tWA4Pg//eK7E5MiOEZPVDlLArdBktYzhP5Rf+NcoY+t t9doCmazPQ3TgmyWv+QdJaJRGUZcupyzzs96+UdmnlQ6QakXlKDcN4uWVG8wcVlYM65Y Q/P4twqmhkC2ZDLHJ9Yj93/pLgqrZ3rwpHBZ4z9iNEGtZEMX7/+i+5l7K1FJsVYfoc1K FvtSaSYiC3jRpu2+15sn5xSbrtoubBx45JdLJMePZ5LSwUthr8tfzeqdyWe9+ozruW/u YH0IPR8ans45WIn2qWaL4URWANyVgG0+A6y6BEPv7vdTIyYern+QjhMyay8cbynZLB/E TeXQ== X-Gm-Message-State: AOAM530zURgoE9UlppgvuxAcwG8JObBKdmn9Y1dq9mdedcWM3770SBoc w1X3gyN+v2sSqpwLDTzGaLU= X-Google-Smtp-Source: ABdhPJwUw1ySDEmq0PqHdCAoAGnA5ID6F9MYTG+U/K72N/vzyNdoDaSFaRzqzK2bYgjgVjo16QaZBw== X-Received: by 2002:a5d:474f:0:b0:20a:cb5c:bbd7 with SMTP id o15-20020a5d474f000000b0020acb5cbbd7mr8573031wrs.21.1650802203454; Sun, 24 Apr 2022 05:10:03 -0700 (PDT) Received: from alaa-emad ([197.57.78.84]) by smtp.gmail.com with ESMTPSA id v11-20020a056000144b00b0020a9c02f60dsm6352660wrx.50.2022.04.24.05.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 05:10:02 -0700 (PDT) From: Alaa Mohamed To: netdev@vger.kernel.org Date: Sun, 24 Apr 2022 14:09:44 +0200 Message-Id: X-Mailer: git-send-email 2.36.0 In-Reply-To: References: MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH net-next v3 1/2] rtnetlink: add extack support in fdb del handlers X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: eng.alaamohamedsoliman.am@gmail.com, shshaikh@marvell.com, jdenham@redhat.com, GR-Linux-NIC-Dev@marvell.com, manishc@marvell.com, alexandre.belloni@bootlin.com, outreachy@lists.linux.dev, vladimir.oltean@nxp.com, razor@blackwall.org, bridge@lists.linux-foundation.org, linux-kernel@vger.kernel.org, sbrivio@redhat.com, claudiu.manoil@nxp.com, roopa@nvidia.com, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net, UNGLinuxDriver@microchip.com, intel-wired-lan@lists.osuosl.org Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Add extack support to .ndo_fdb_del in netdevice.h and all related methods. Signed-off-by: Alaa Mohamed --- changes in V3: fix errors reported by checkpatch.pl --- drivers/net/ethernet/intel/ice/ice_main.c | 4 ++-- drivers/net/ethernet/mscc/ocelot_net.c | 4 ++-- drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 2 +- drivers/net/macvlan.c | 2 +- drivers/net/vxlan/vxlan_core.c | 2 +- include/linux/netdevice.h | 2 +- net/bridge/br_fdb.c | 2 +- net/bridge/br_private.h | 2 +- net/core/rtnetlink.c | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) -- 2.36.0 diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index d768925785ca..7b55d8d94803 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -5678,10 +5678,10 @@ ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[], static int ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[], struct net_device *dev, const unsigned char *addr, - __always_unused u16 vid) + __always_unused u16 vid, struct netlink_ext_ack *extack) { int err; - + if (ndm->ndm_state & NUD_PERMANENT) { netdev_err(dev, "FDB only supports static addresses\n"); return -EINVAL; diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c index 247bc105bdd2..e07c64e3159c 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -774,14 +774,14 @@ static int ocelot_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], static int ocelot_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[], struct net_device *dev, - const unsigned char *addr, u16 vid) + const unsigned char *addr, u16 vid, struct netlink_ext_ack *extack) { struct ocelot_port_private *priv = netdev_priv(dev); struct ocelot_port *ocelot_port = &priv->port; struct ocelot *ocelot = ocelot_port->ocelot; int port = priv->chip_port; - return ocelot_fdb_del(ocelot, port, addr, vid, ocelot_port->bridge); + return ocelot_fdb_del(ocelot, port, addr, vid, ocelot_port->bridge, extack); } static int ocelot_port_fdb_dump(struct sk_buff *skb, diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index d320567b2cca..51fa23418f6a 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -368,7 +368,7 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p) static int qlcnic_fdb_del(struct ndmsg *ndm, struct nlattr *tb[], struct net_device *netdev, - const unsigned char *addr, u16 vid) + const unsigned char *addr, u16 vid, struct netlink_ext_ack *extack) { struct qlcnic_adapter *adapter = netdev_priv(netdev); int err = -EOPNOTSUPP; diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 069e8824c264..ffd34d9f7049 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1017,7 +1017,7 @@ static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], static int macvlan_fdb_del(struct ndmsg *ndm, struct nlattr *tb[], struct net_device *dev, - const unsigned char *addr, u16 vid) + const unsigned char *addr, u16 vid, struct netlink_ext_ack *extack) { struct macvlan_dev *vlan = netdev_priv(dev); int err = -EINVAL; diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index de97ff98d36e..cf2f60037340 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -1280,7 +1280,7 @@ int __vxlan_fdb_delete(struct vxlan_dev *vxlan, /* Delete entry (via netlink) */ static int vxlan_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], struct net_device *dev, - const unsigned char *addr, u16 vid) + const unsigned char *addr, u16 vid, struct netlink_ext_ack *extack) { struct vxlan_dev *vxlan = netdev_priv(dev); union vxlan_addr ip; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 28ea4f8269d4..d0d2a8f33c73 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1509,7 +1509,7 @@ struct net_device_ops { struct nlattr *tb[], struct net_device *dev, const unsigned char *addr, - u16 vid); + u16 vid, struct netlink_ext_ack *extack); int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, struct net_device *dev, diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 6ccda68bd473..5bfce2e9a553 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -1110,7 +1110,7 @@ static int __br_fdb_delete(struct net_bridge *br, /* Remove neighbor entry with RTM_DELNEIGH */ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], struct net_device *dev, - const unsigned char *addr, u16 vid) + const unsigned char *addr, u16 vid, struct netlink_ext_ack *extack) { struct net_bridge_vlan_group *vg; struct net_bridge_port *p = NULL; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 18ccc3d5d296..95348c1c9ce5 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -780,7 +780,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source, const unsigned char *addr, u16 vid, unsigned long flags); int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], - struct net_device *dev, const unsigned char *addr, u16 vid); + struct net_device *dev, const unsigned char *addr, u16 vid, struct netlink_ext_ack *extack); int br_fdb_add(struct ndmsg *nlh, struct nlattr *tb[], struct net_device *dev, const unsigned char *addr, u16 vid, u16 nlh_flags, struct netlink_ext_ack *extack); diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 4041b3e2e8ec..99b30ae58a47 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -4223,7 +4223,7 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, const struct net_device_ops *ops = br_dev->netdev_ops; if (ops->ndo_fdb_del) - err = ops->ndo_fdb_del(ndm, tb, dev, addr, vid); + err = ops->ndo_fdb_del(ndm, tb, dev, addr, vid, extack); if (err) goto out; @@ -4235,7 +4235,7 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, if (ndm->ndm_flags & NTF_SELF) { if (dev->netdev_ops->ndo_fdb_del) err = dev->netdev_ops->ndo_fdb_del(ndm, tb, dev, addr, - vid); + vid, extack); else err = ndo_dflt_fdb_del(ndm, tb, dev, addr, vid); From patchwork Sun Apr 24 12:09:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alaa Mohamed X-Patchwork-Id: 1621510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=G1NNAqa9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KmRmT1v6Gz9s09 for ; Sun, 24 Apr 2022 22:10:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DEDF7819F3; Sun, 24 Apr 2022 12:10:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SHSMaMMg5euK; Sun, 24 Apr 2022 12:10:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id D344E819F6; Sun, 24 Apr 2022 12:10:13 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id BA84F1BF402 for ; Sun, 24 Apr 2022 12:10:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B723B818D7 for ; Sun, 24 Apr 2022 12:10:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 41LVQdYCJKMq for ; Sun, 24 Apr 2022 12:10:07 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by smtp1.osuosl.org (Postfix) with ESMTPS id D6C77819F3 for ; Sun, 24 Apr 2022 12:10:06 +0000 (UTC) Received: by mail-wr1-x433.google.com with SMTP id s21so2478367wrb.8 for ; Sun, 24 Apr 2022 05:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kMsrPopqXyKvjj6ADtV/e3/sJqjPNnfQay4OisloMYc=; b=G1NNAqa9Af1R4e+iYq/k9TLDn34NKa+zwVDQ56afqH335EQ42AUrhuX2rB+ybjDpDq /kZYqx7nmUAi0wrUmhwa5TBh5Yqqicn5BVBrolEzH5UsO4R9s/mlbXwvf2YrNebaU6V7 QrzVt/ZDKDEnYpQ5Mo8HhonNLASsrCKROmZ41PoiVdYtcQojB/K4pdoI98hge2gAGwHd nSt77fn9VjDjDmkddV360nPYZxLIzX2Tg84JP3aEclHl73m/8Ei1XWUa9iKGsvVCcTkH LXZT25JCGUlbOfPAtHyEgrGyV1zrhhEUVXbqS7iWfrNrvvz/eBeAg6UV/ai7yXj7dwtD CbaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kMsrPopqXyKvjj6ADtV/e3/sJqjPNnfQay4OisloMYc=; b=ISqGiF0fnQxrh+p8NeNn4B9HEIE28tGtOhbY/o6Na++r4SVRWOwGAQNd2E7PPI4HPz WiLSHXZACMT8kQW8QjgWobc+TV2kz/4S1bLbWmKnpSfKVsWk7iaclCuwEx/86D/q1aGX +TIq5pq35sDkoBKtW6jF3QwGMHCLcviGJRwm/DcucForW3njSOjUS9h7orjtwnHruk2D ckZg7X3uqgjcsGPtmVWNknHY2etG3KsXJCjPPNlEs9TnlhjXnd/LPvbiXN5ZGzQe1BId 5mjC5C85FdSgkdzAkoxJLwu4wEcB+LAMaxiS4y8w55lN95dm0zJ5hifh1J1YWhfePDo1 99Aw== X-Gm-Message-State: AOAM533JLwX0dQNLfEvHzokmQmKcxugpgUQlVpKoc91D4xuEi8UlkqDL BXv+QZzIZ9uZVmelVWfOrPFTlZeaNQl65A== X-Google-Smtp-Source: ABdhPJzN0XK82EJGnpmBD6Aw/R5DjFt3ttHuCFQExkPKkZ+QNRqdno2HCbWpBsbHz04CrC6TCgyxAA== X-Received: by 2002:a05:6000:156c:b0:20a:8397:6d28 with SMTP id 12-20020a056000156c00b0020a83976d28mr10215309wrz.363.1650802205019; Sun, 24 Apr 2022 05:10:05 -0700 (PDT) Received: from alaa-emad ([197.57.78.84]) by smtp.gmail.com with ESMTPSA id q3-20020adfab03000000b0020ad57b8ddesm3091466wrc.101.2022.04.24.05.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 05:10:04 -0700 (PDT) From: Alaa Mohamed To: netdev@vger.kernel.org Date: Sun, 24 Apr 2022 14:09:45 +0200 Message-Id: <0d09ad611bb78b9113491007955f2211f3a06e82.1650800975.git.eng.alaamohamedsoliman.am@gmail.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: References: MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH net-next v3 2/2] net: vxlan: vxlan_core.c: Add extack support to vxlan_fdb_delete X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: eng.alaamohamedsoliman.am@gmail.com, shshaikh@marvell.com, jdenham@redhat.com, GR-Linux-NIC-Dev@marvell.com, manishc@marvell.com, alexandre.belloni@bootlin.com, outreachy@lists.linux.dev, vladimir.oltean@nxp.com, razor@blackwall.org, bridge@lists.linux-foundation.org, linux-kernel@vger.kernel.org, sbrivio@redhat.com, claudiu.manoil@nxp.com, roopa@nvidia.com, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net, UNGLinuxDriver@microchip.com, intel-wired-lan@lists.osuosl.org Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Add extack to vxlan_fdb_delete and vxlan_fdb_parse Signed-off-by: Alaa Mohamed --- changes in V2: - fix spelling vxlan_fdb_delete - add missing braces - edit error message --- changes in V3: fix errors reported by checkpatch.pl --- drivers/net/vxlan/vxlan_core.c | 36 +++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) -- 2.36.0 diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index cf2f60037340..4e1886655101 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -1129,19 +1129,23 @@ static void vxlan_fdb_dst_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f, static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan, union vxlan_addr *ip, __be16 *port, __be32 *src_vni, - __be32 *vni, u32 *ifindex, u32 *nhid) + __be32 *vni, u32 *ifindex, u32 *nhid, struct netlink_ext_ack *extack) { struct net *net = dev_net(vxlan->dev); int err; if (tb[NDA_NH_ID] && (tb[NDA_DST] || tb[NDA_VNI] || tb[NDA_IFINDEX] || - tb[NDA_PORT])) - return -EINVAL; + tb[NDA_PORT])){ + NL_SET_ERR_MSG(extack, "DST, VNI, ifindex and port are mutually exclusive with NH_ID"); + return -EINVAL; + } if (tb[NDA_DST]) { err = vxlan_nla_get_addr(ip, tb[NDA_DST]); - if (err) + if (err){ + NL_SET_ERR_MSG(extack, "Unsupported address family"); return err; + } } else { union vxlan_addr *remote = &vxlan->default_dst.remote_ip; @@ -1157,24 +1161,30 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan, } if (tb[NDA_PORT]) { - if (nla_len(tb[NDA_PORT]) != sizeof(__be16)) + if (nla_len(tb[NDA_PORT]) != sizeof(__be16)){ + NL_SET_ERR_MSG(extack, "Invalid vxlan port"); return -EINVAL; + } *port = nla_get_be16(tb[NDA_PORT]); } else { *port = vxlan->cfg.dst_port; } if (tb[NDA_VNI]) { - if (nla_len(tb[NDA_VNI]) != sizeof(u32)) + if (nla_len(tb[NDA_VNI]) != sizeof(u32)){ + NL_SET_ERR_MSG(extack, "Invalid vni"); return -EINVAL; + } *vni = cpu_to_be32(nla_get_u32(tb[NDA_VNI])); } else { *vni = vxlan->default_dst.remote_vni; } if (tb[NDA_SRC_VNI]) { - if (nla_len(tb[NDA_SRC_VNI]) != sizeof(u32)) + if (nla_len(tb[NDA_SRC_VNI]) != sizeof(u32)){ + NL_SET_ERR_MSG(extack, "Invalid src vni"); return -EINVAL; + } *src_vni = cpu_to_be32(nla_get_u32(tb[NDA_SRC_VNI])); } else { *src_vni = vxlan->default_dst.remote_vni; @@ -1183,12 +1193,16 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan, if (tb[NDA_IFINDEX]) { struct net_device *tdev; - if (nla_len(tb[NDA_IFINDEX]) != sizeof(u32)) + if (nla_len(tb[NDA_IFINDEX]) != sizeof(u32)){ + NL_SET_ERR_MSG(extack, "Invalid ifindex"); return -EINVAL; + } *ifindex = nla_get_u32(tb[NDA_IFINDEX]); tdev = __dev_get_by_index(net, *ifindex); - if (!tdev) + if (!tdev){ + NL_SET_ERR_MSG(extack,"Device not found"); return -EADDRNOTAVAIL; + } } else { *ifindex = 0; } @@ -1226,7 +1240,7 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], return -EINVAL; err = vxlan_fdb_parse(tb, vxlan, &ip, &port, &src_vni, &vni, &ifindex, - &nhid); + &nhid, extack); if (err) return err; @@ -1291,7 +1305,7 @@ static int vxlan_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], int err; err = vxlan_fdb_parse(tb, vxlan, &ip, &port, &src_vni, &vni, &ifindex, - &nhid); + &nhid, extack); if (err) return err;