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:   Sat, 10 Jul 2021 23:36:51 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Colin Foster <colin.foster@...advantage.com>
Cc:     andrew@...n.ch, vivien.didelot@...il.com, f.fainelli@...il.com,
        davem@...emloft.net, kuba@...nel.org, robh+dt@...nel.org,
        claudiu.manoil@....com, alexandre.belloni@...tlin.com,
        UNGLinuxDriver@...rochip.com, linux@...linux.org.uk,
        netdev@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2 net-next 6/8] net: mscc: ocelot: expose ocelot wm
 functions

On Sat, Jul 10, 2021 at 12:26:00PM -0700, Colin Foster wrote:
> diff --git a/drivers/net/ethernet/mscc/ocelot_wm.c b/drivers/net/ethernet/mscc/ocelot_wm.c
> new file mode 100644
> index 000000000000..f9a11a6a059d
> --- /dev/null
> +++ b/drivers/net/ethernet/mscc/ocelot_wm.c
> @@ -0,0 +1,40 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
> +/*
> + * Microsemi Ocelot Switch driver
> + *
> + * Copyright (c) 2017 Microsemi Corporation
> + */
> +
> +#include "ocelot.h"
> +
> +/* Watermark encode
> + * Bit 8:   Unit; 0:1, 1:16
> + * Bit 7-0: Value to be multiplied with unit
> + */
> +u16 ocelot_wm_enc(u16 value)
> +{
> +	WARN_ON(value >= 16 * BIT(8));
> +
> +	if (value >= BIT(8))
> +		return BIT(8) | (value / 16);
> +
> +	return value;
> +}
> +EXPORT_SYMBOL(ocelot_wm_enc);
> +
> +u16 ocelot_wm_dec(u16 wm)
> +{
> +	if (wm & BIT(8))
> +		return (wm & GENMASK(7, 0)) * 16;
> +
> +	return wm;
> +}
> +EXPORT_SYMBOL(ocelot_wm_dec);
> +
> +void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse)
> +{
> +	*inuse = (val & GENMASK(23, 12)) >> 12;
> +	*maxuse = val & GENMASK(11, 0);
> +}
> +EXPORT_SYMBOL(ocelot_wm_stat);
> +

Do not use blank lines at the end of files, 'git am' will complain that
the patches are whitespace damaged.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ