mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <Arun.Ramadoss@microchip.com>
To: <olteanv@gmail.com>, <UNGLinuxDriver@microchip.com>,
	<vivien.didelot@gmail.com>, <andrew@lunn.ch>,
	<f.fainelli@gmail.com>, <kuba@kernel.org>, <edumazet@google.com>,
	<pabeni@redhat.com>, <o.rempel@pengutronix.de>,
	<Woojung.Huh@microchip.com>, <davem@davemloft.net>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<kernel@pengutronix.de>
Subject: Re: [PATCH net-next v2 4/4] net: dsa: microchip: enable EEE support
Date: Fri, 20 Jan 2023 14:25:12 +0000	[thread overview]
Message-ID: <f8eb963ca4ed87e9c3150abdaa97bf956bb77cc3.camel@microchip.com> (raw)
In-Reply-To: <20230120092059.347734-5-o.rempel@pengutronix.de>

Hi Oleksij,

On Fri, 2023-01-20 at 10:20 +0100, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> Some of KSZ9477 family switches provides EEE support. To enable it,
> we
> just need to register set_mac_eee/set_mac_eee handlers and validate
> supported chip version and port.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/net/dsa/microchip/ksz_common.c | 35
> ++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/net/dsa/microchip/ksz_common.c
> b/drivers/net/dsa/microchip/ksz_common.c
> index 5e1e5bd555d2..2f1f71b3be86 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -2645,6 +2645,39 @@ static int ksz_max_mtu(struct dsa_switch *ds,
> int port)
>         return -EOPNOTSUPP;
>  }
> 
> +static int ksz_validate_eee(struct dsa_switch *ds, int port)
> +{
> +       struct ksz_device *dev = ds->priv;
> +
> +       if (!dev->info->internal_phy[port])
> +               return -EOPNOTSUPP;
> +
> +       switch (dev->chip_id) {
> +       case KSZ8563_CHIP_ID:
> +       case KSZ9477_CHIP_ID:
> +       case KSZ9563_CHIP_ID:
> +       case KSZ9567_CHIP_ID:
> +       case KSZ9893_CHIP_ID:
> +       case KSZ9896_CHIP_ID:
> +       case KSZ9897_CHIP_ID:
> +               return 0;
> +       }
> +
> +       return -EOPNOTSUPP;
> +}
> +
> +static int ksz_get_mac_eee(struct dsa_switch *ds, int port,
> +                          struct ethtool_eee *e)
> +{
> +       return ksz_validate_eee(ds, port);
> +}
> +
> +static int ksz_set_mac_eee(struct dsa_switch *ds, int port,
> +                          struct ethtool_eee *e)
> +{
> +       return ksz_validate_eee(ds, port);
> +}
> +

nit: As both set and get function perform the same operation, we can
assign .get_mac_eee and .set_mac_eee to ksz_validate_eee function by
changing its prototype. In future, if any things to be added specific
to get or set, we can separate it to two function.

>  static void ksz_set_xmii(struct ksz_device *dev, int port,
>                          phy_interface_t interface)
>  {
> @@ -3006,6 +3039,8 @@ static const struct dsa_switch_ops
> ksz_switch_ops = {
>         .port_hwtstamp_set      = ksz_hwtstamp_set,
>         .port_txtstamp          = ksz_port_txtstamp,
>         .port_rxtstamp          = ksz_port_rxtstamp,
> +       .get_mac_eee            = ksz_get_mac_eee,
> +       .set_mac_eee            = ksz_set_mac_eee,
>  };
> 
>  struct ksz_device *ksz_switch_alloc(struct device *base, void *priv)
> --
> 2.30.2
> 

      reply	other threads:[~2023-01-20 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20  9:20 [PATCH net-next v2 0/4] net: add EEE support for KSZ9477 switch series Oleksij Rempel
2023-01-20  9:20 ` [PATCH net-next v2 1/4] net: phy: add driver specific get/set_eee support Oleksij Rempel
2023-01-20  9:20 ` [PATCH net-next v2 2/4] net: phy: micrel: add EEE configuration support for KSZ9477 variants of PHYs Oleksij Rempel
2023-01-20 14:30   ` Arun.Ramadoss
2023-01-20  9:20 ` [PATCH net-next v2 3/4] net: phy: micrel: disable 1000Mbit EEE support if 1000Mbit is not supported Oleksij Rempel
2023-01-20  9:20 ` [PATCH net-next v2 4/4] net: dsa: microchip: enable EEE support Oleksij Rempel
2023-01-20 14:25   ` Arun.Ramadoss [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f8eb963ca4ed87e9c3150abdaa97bf956bb77cc3.camel@microchip.com \
    --to=arun.ramadoss@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome