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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZhTEtmcvubthMXmB@pengutronix.de>
Date: Tue, 9 Apr 2024 06:31:50 +0200
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: Arun.Ramadoss@...rochip.com
Cc: andrew@...n.ch, olteanv@...il.com, davem@...emloft.net,
	Woojung.Huh@...rochip.com, pabeni@...hat.com, edumazet@...gle.com,
	f.fainelli@...il.com, kuba@...nel.org, kernel@...gutronix.de,
	dsahern@...nel.org, san@...v.dk, willemb@...gle.com,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	horms@...nel.org, UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH net-next v4 5/9] net: dsa: microchip: add support for
 different DCB app configurations

Hi Arun,

On Mon, Apr 08, 2024 at 04:10:15PM +0000, Arun.Ramadoss@...rochip.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 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ