From mboxrd@z Thu Jan 1 00:00:00 1970 From: Petr Machata Subject: [PATCH net-next 4/9] net: switchdev: Add extack to struct switchdev_notifier_info Date: Wed, 12 Dec 2018 11:52:14 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Jiri Pirko , Ido Schimmel , "davem@davemloft.net" , "ivecera@redhat.com" To: "netdev@vger.kernel.org" Return-path: Received: from mail-eopbgr40055.outbound.protection.outlook.com ([40.107.4.55]:43412 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727131AbeLLLwd (ORCPT ); Wed, 12 Dec 2018 06:52:33 -0500 In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: In order to pass extack to the drivers that need it, add an extack field to struct switchdev_notifier_info, and an extack argument to the function call_switchdev_blocking_notifiers(). Also add a helper function switchdev_notifier_info_to_extack(). Signed-off-by: Petr Machata Acked-by: Jiri Pirko --- drivers/net/vxlan.c | 1 + include/net/switchdev.h | 13 +++++++++++-- net/switchdev/switchdev.c | 7 +++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index b56ef684ecac..49d4b5854c62 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -364,6 +364,7 @@ static void vxlan_fdb_switchdev_notifier_info(const str= uct vxlan_dev *vxlan, struct switchdev_notifier_vxlan_fdb_info *fdb_info) { fdb_info->info.dev =3D vxlan->dev; + fdb_info->info.extack =3D NULL; fdb_info->remote_ip =3D rd->remote_ip; fdb_info->remote_port =3D rd->remote_port; fdb_info->remote_vni =3D rd->remote_vni; diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 69016305ad58..4facfa6775e8 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -149,6 +149,7 @@ enum switchdev_notifier_type { =20 struct switchdev_notifier_info { struct net_device *dev; + struct netlink_ext_ack *extack; }; =20 struct switchdev_notifier_fdb_info { @@ -172,6 +173,12 @@ switchdev_notifier_info_to_dev(const struct switchdev_= notifier_info *info) return info->dev; } =20 +static inline struct netlink_ext_ack * +switchdev_notifier_info_to_extack(const struct switchdev_notifier_info *in= fo) +{ + return info->extack; +} + #ifdef CONFIG_NET_SWITCHDEV =20 void switchdev_deferred_process(void); @@ -193,7 +200,8 @@ int call_switchdev_notifiers(unsigned long val, struct = net_device *dev, int register_switchdev_blocking_notifier(struct notifier_block *nb); int unregister_switchdev_blocking_notifier(struct notifier_block *nb); int call_switchdev_blocking_notifiers(unsigned long val, struct net_device= *dev, - struct switchdev_notifier_info *info); + struct switchdev_notifier_info *info, + struct netlink_ext_ack *extack); =20 void switchdev_port_fwd_mark_set(struct net_device *dev, struct net_device *group_dev, @@ -278,7 +286,8 @@ unregister_switchdev_blocking_notifier(struct notifier_= block *nb) static inline int call_switchdev_blocking_notifiers(unsigned long val, struct net_device *dev, - struct switchdev_notifier_info *info) + struct switchdev_notifier_info *info, + struct netlink_ext_ack *extack) { return NOTIFY_DONE; } diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index cb20669bf6ce..aa84acfb6632 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -368,7 +368,7 @@ static int switchdev_port_obj_notify(enum switchdev_not= ifier_type nt, .handled =3D false, }; =20 - rc =3D call_switchdev_blocking_notifiers(nt, dev, &obj_info.info); + rc =3D call_switchdev_blocking_notifiers(nt, dev, &obj_info.info, extack)= ; err =3D notifier_to_errno(rc); if (err) { WARN_ON(!obj_info.handled); @@ -559,6 +559,7 @@ int call_switchdev_notifiers(unsigned long val, struct = net_device *dev, struct switchdev_notifier_info *info) { info->dev =3D dev; + info->extack =3D NULL; return atomic_notifier_call_chain(&switchdev_notif_chain, val, info); } EXPORT_SYMBOL_GPL(call_switchdev_notifiers); @@ -580,9 +581,11 @@ int unregister_switchdev_blocking_notifier(struct noti= fier_block *nb) EXPORT_SYMBOL_GPL(unregister_switchdev_blocking_notifier); =20 int call_switchdev_blocking_notifiers(unsigned long val, struct net_device= *dev, - struct switchdev_notifier_info *info) + struct switchdev_notifier_info *info, + struct netlink_ext_ack *extack) { info->dev =3D dev; + info->extack =3D extack; return blocking_notifier_call_chain(&switchdev_blocking_notif_chain, val, info); } --=20 2.4.11