lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 01 Dec 2017 10:21:58 -0500
From:   Vivien Didelot <vivien.didelot@...oirfairelinux.com>
To:     Florian Fainelli <f.fainelli@...il.com>, netdev@...r.kernel.org
Cc:     Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        "David S. Miller" <davem@...emloft.net>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] net: dsa: Allow compiling out legacy support

Hi Florian,

Florian Fainelli <f.fainelli@...il.com> writes:

> +#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
>  /* Legacy driver registration */
>  void register_switch_driver(struct dsa_switch_driver *type);
>  void unregister_switch_driver(struct dsa_switch_driver *type);
>  struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);
>  
> +#else
> +static inline void register_switch_driver(struct dsa_switch_driver *type) { }
> +static inline void unregister_switch_driver(struct dsa_switch_driver *type) { }
> +static inline struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev)
> +{
> +	return NULL;
> +}
> +#endif

The .probe dsa_switch_ops is part of the legacy code, we may want to
wrap it in a CONFIG_NET_DSA_LEGACY check as well.

>  struct net_device *dsa_dev_to_net_device(struct device *dev);
>  
>  /* Keep inline for faster access in hot path */
> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
> index 03c3bdf25468..b6ec8e9069e4 100644
> --- a/net/dsa/Kconfig
> +++ b/net/dsa/Kconfig
> @@ -16,6 +16,14 @@ config NET_DSA
>  
>  if NET_DSA
>  
> +config NET_DSA_LEGACY

We need to have it enabled by default, otherwise we'll miss errors when
touching the code shared by both legacy and new bindings.

> +	bool "Support for older platform device and Device Tree registration"
> +	---help---
> +	  Say Y if you want to enable support for the older platform device and
> +	  deprectaed Device Tree binding registration.

          deprecated*

> +
> +	  This feature is scheduled for removal in 4.17.
> +
>  /* legacy.c */
> +#if IS_ENABLED(CONFIG_NET_DSA_LEGACY)
>  int dsa_legacy_register(void);
>  void dsa_legacy_unregister(void);
>  int dsa_legacy_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
> @@ -106,6 +107,28 @@ int dsa_legacy_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
>  int dsa_legacy_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
>  		       struct net_device *dev,
>  		       const unsigned char *addr, u16 vid);

the dsa_legacy_fdb_{add,del} routines are "legacy" in terms of FDB
handling, not in terms of DSA bindings, we must keep them.

> +#else
> +static inline int dsa_legacy_register(void)
> +{
> +	return -ENODEV;
> +}
> +
> +static inline void dsa_legacy_unregister(void) { }
> +static inline int dsa_legacy_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
> +				     struct net_device *dev,
> +				     const unsigned char *addr, u16 vid,
> +				     u16 flags)
> +{
> +	return 0;
> +}
> +
> +static inline int dsa_legacy_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
> +				     struct net_device *dev,
> +				     const unsigned char *addr, u16 vid)
> +{
> +	return 0;
> +}
> +#endif


Thanks,

        Vivien

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ