Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1743269pxv; Sat, 10 Jul 2021 13:48:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKogre1MC45sHqnaoTA6uiDI9mGpPyEPZQ276KGts6xjT6ztVL+TO2iakpDyUXfPL7v0Qn X-Received: by 2002:a17:906:6047:: with SMTP id p7mr44487451ejj.206.1625950122128; Sat, 10 Jul 2021 13:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625950122; cv=none; d=google.com; s=arc-20160816; b=hfz0+jiSl72u3NCkzRF7crZpE0tXF7ao+yb8v8UNJJ1NHql7sOBeftssNy4sCAD2KB +fTWcwLWYUEMCQ0FKdu3gcXazDDJArGsKvW+O4tgaq7UiOAWzrg6mzOS93W8W4m8OtOn 4BvLYaX0Es0ykICfxtjeuU4MbOSYiV4ghXy07fi3uV73bOI1bdUR1BM0D1soY8s37PwT alEiSuFam/vdot6kxGF0W1rM1SI4WonpdVnR4lwjCsGJStvwaN2ndvDq4k/2FRNNkd/Y kKIFzz8Kp2Hpa3fTAdvfjmSskIN60rKjBYiOrPcoNy5OGxykOCcfys12xRtVSVdSYryT wk3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wZoGYVD7fTRgT5wK85r18uGGhTvztJHkjBILIZcXG6E=; b=u87407pwcsGJwXCAY3Bq9LAVGIFri3mPvMaePaPNaxl0qXBVeSefJNVZF415/v2YfA BTmd3S2aZSVvBnAtKlJAmYiEU1l7HKDkcKjDagoq1unC7NogDOf/owz7eAZMviPmzFYg LjNJzYQafKPliVgKnA79q4Xh3/ulXD53hIsu6J8UwdTz2OkjbuSPzsN5V+xRJyt2yFvu RxXpA4PjbWCedlLuXmR4qJbEcQQWYzMxZcRQ+zf/W7UOG8MHpcai3XEJSRzCOPKekVY3 2ruuRIyQrnimAIA8HFO+rHYpWgDhuuCIqY8UYb+Q/AhNWh0brCXxgw2aDjnja3PzPJ7S TZug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rFVjdPrr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si13651613ejt.504.2021.07.10.13.48.19; Sat, 10 Jul 2021 13:48:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rFVjdPrr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230432AbhGJUjl (ORCPT + 99 others); Sat, 10 Jul 2021 16:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbhGJUjk (ORCPT ); Sat, 10 Jul 2021 16:39:40 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8C2C0613DD; Sat, 10 Jul 2021 13:36:54 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id h8so6596513eds.4; Sat, 10 Jul 2021 13:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wZoGYVD7fTRgT5wK85r18uGGhTvztJHkjBILIZcXG6E=; b=rFVjdPrrtWXdT5OYdHE4ylW0nw/S5d/5nOY8DphMOtDdBXiVRWNPtzb+bT9Ez/+LrF YOzoRSK1k9dHtcYyMrcOLgRny7EM+yO93h4zefRI4f875e2S5aJcbDSm0tzt1ZuFXEEn yPsSKBJaHpNeMR1Js7wVAudwCN8j9w9lI1P7icduRSosX+gCn0ZI1/OOmg7+xvs7WIkE LmKAT269cz3CI2EKMFm1oA0yIL8lpGQZRYYBkGv1eDbfLcv5EwJfimQuxcTG/QyC3SoA cH+stPXWw0vbV87YIYO+R6r13B9uJLK4IHB7bhpJeG0LjW/27pUJlbNu6rsEmtPPK1Ku o7dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wZoGYVD7fTRgT5wK85r18uGGhTvztJHkjBILIZcXG6E=; b=ogG/u1nscI9A3QlxOn5gqSpo9I2YkbsrZAba8KI15ZTcIikYh2RG0GGZcRNj24e82/ nViRoavBpgPFBwhpKz1OlMh09sBf9TkwzejNt5qhNci8vQRJ5Jtibm/qDtoj14ZfEJA4 9rTW2S2z4ENw42QjGf6kZ3AJg96KkjLAa2umjIjrO9NxnkcwDGmaXTcK6KD/aohp8Vu0 devJt6Yai9LnOI9LLuqwZ1qeY0PA6SO1AfdbnoO2kvZkf5ALTWuA+YZvWKvjGp9OeGNl HTKXae3JYh6DuE+Bmk3O08Q74GTKLIA64ibon0fXxuRgThDkOorDcPJfuucuLA7J8hAq hx7A== X-Gm-Message-State: AOAM530xAC0D6k/3NN0zzMxRbz70k9zwccaVOLwgiRe3mFqv7zCMvHlT s0W7KknEztXV9WOjCBtbTWs= X-Received: by 2002:a05:6402:430f:: with SMTP id m15mr43679851edc.113.1625949413505; Sat, 10 Jul 2021 13:36:53 -0700 (PDT) Received: from skbuf ([82.76.66.29]) by smtp.gmail.com with ESMTPSA id u4sm4124207eje.81.2021.07.10.13.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jul 2021 13:36:53 -0700 (PDT) Date: Sat, 10 Jul 2021 23:36:51 +0300 From: Vladimir Oltean To: Colin Foster Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org, claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 net-next 6/8] net: mscc: ocelot: expose ocelot wm functions Message-ID: <20210710203651.k76teuhovyob52wq@skbuf> References: <20210710192602.2186370-1-colin.foster@in-advantage.com> <20210710192602.2186370-7-colin.foster@in-advantage.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210710192602.2186370-7-colin.foster@in-advantage.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.