netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Arun.Ramadoss@microchip.com
Cc: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	Woojung.Huh@microchip.com, pabeni@redhat.com,
	edumazet@google.com, f.fainelli@gmail.com, kuba@kernel.org,
	kernel@pengutronix.de, dsahern@kernel.org, san@skov.dk,
	willemb@google.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, horms@kernel.org,
	UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next v4 5/9] net: dsa: microchip: add support for different DCB app configurations
Date: Tue, 9 Apr 2024 06:31:50 +0200	[thread overview]
Message-ID: <ZhTEtmcvubthMXmB@pengutronix.de> (raw)
In-Reply-To: <40d90a28d95bff48f352a3aaf81df2b1a6133cc7.camel@microchip.com>

Hi Arun,

On Mon, Apr 08, 2024 at 04:10:15PM +0000, Arun.Ramadoss@microchip.com wrote:
> > +int ksz_port_get_default_prio(struct dsa_switch *ds, int port)
> > +{
> > +       struct ksz_device *dev = ds->priv;
> > +       int ret, reg, shift;
> > +       u8 data, mask;
> > +
> > +       ksz_get_defult_port_prio_reg(dev, &reg, &mask, &shift);
> > +
> > +       ret = ksz_pread8(dev, port, reg, &data);
> > +       if (ret)
> > +               return ret;
> > +
> > +       return (data & mask) >> shift;
> 
> I assume we can use retrun FIELD_GET(mask, data), since mask is GENMASK
> format. 
> 
> > 
> > +int ksz_port_set_default_prio(struct dsa_switch *ds, int port, u8
> > prio)
> > prio)
> > +{
> > +       struct ksz_device *dev = ds->priv;
> > +       int reg, shift;
> > +       u8 mask;
> > +
> > +       if (prio >= dev->info->num_tx_queues)
> > +               return -EINVAL;
> > +
> > +       ksz_get_defult_port_prio_reg(dev, &reg, &mask, &shift);
> > +
> > +       return ksz_prmw8(dev, port, reg, mask, (prio << shift) &
> > mask);
> 
> FIELD_PREP(mask, prio)

Sadly, FIELD_GET() and FIELD_PREP() do not work with dynamic masks.

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2024-04-09  4:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08  7:47 [PATCH net-next v4 0/9] Enhanced DCB and DSCP Support for KSZ Switches Oleksij Rempel
2024-04-08  7:47 ` [PATCH net-next v4 1/9] net: dsa: add support for DCB get/set apptrust configuration Oleksij Rempel
2024-04-08  7:47 ` [PATCH net-next v4 2/9] net: dsa: microchip: add IPV information support Oleksij Rempel
2024-04-08  7:47 ` [PATCH net-next v4 3/9] net: add IEEE 802.1q specific helpers Oleksij Rempel
2024-04-08  7:47 ` [PATCH net-next v4 4/9] net: dsa: microchip: add multi queue support for KSZ88X3 variants Oleksij Rempel
2024-04-08  7:47 ` [PATCH net-next v4 5/9] net: dsa: microchip: add support for different DCB app configurations Oleksij Rempel
2024-04-08 16:10   ` Arun.Ramadoss
2024-04-09  4:31     ` Oleksij Rempel [this message]
2024-04-08  7:47 ` [PATCH net-next v4 6/9] net: dsa: microchip: dcb: add special handling for KSZ88X3 family Oleksij Rempel
2024-04-08 16:26   ` Arun.Ramadoss
2024-04-09  8:02     ` Oleksij Rempel
2024-04-08  7:47 ` [PATCH net-next v4 7/9] net: dsa: microchip: enable ETS support for KSZ989X variants Oleksij Rempel
2024-04-08  7:47 ` [PATCH net-next v4 8/9] net: dsa: microchip: init predictable IPV to queue mapping for all non KSZ8xxx variants Oleksij Rempel
2024-04-08 15:54   ` Arun.Ramadoss
2024-04-08  7:47 ` [PATCH net-next v4 9/9] net: dsa: microchip: let DCB code do PCP and DSCP policy configuration Oleksij Rempel
2024-04-08 15:55   ` Arun.Ramadoss

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=ZhTEtmcvubthMXmB@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=Arun.Ramadoss@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=horms@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=san@skov.dk \
    --cc=willemb@google.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;
as well as URLs for NNTP newsgroup(s).