linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Stelmach <l.stelmach@samsung.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: jim.cromie@gmail.com, "Heiner Kallweit" <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Kukjin Kim" <kgene@kernel.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Russell King" <linux@armlinux.org.uk>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	"Marek Szyprowski" <m.szyprowski@samsung.com>,
	"Bartłomiej Żolnierkiewicz" <b.zolnierkie@samsung.com>
Subject: Re: [PATCH v5 3/5] net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver
Date: Wed, 04 Nov 2020 11:20:37 +0100	[thread overview]
Message-ID: <dleftj361ps9sa.fsf%l.stelmach@samsung.com> (raw)
In-Reply-To: <20201104024211.GS933237@lunn.ch> (Andrew Lunn's message of "Wed, 4 Nov 2020 03:42:11 +0100")

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

It was <2020-11-04 śro 03:42>, when Andrew Lunn wrote:
>> +config SPI_AX88796C_COMPRESSION
>> +	bool "SPI transfer compression"
>> +	default n
>> +	depends on SPI_AX88796C
>> +	help
>> +	  Say Y here to enable SPI transfer compression. It saves up
>> +	  to 24 dummy cycles during each transfer which may noticably
>> +	  speed up short transfers. This sets the default value that is
>> +	  inherited by network interfecase during probe. It can be
>
> interface
>

Done.

>> +	  changed in run time via spi-compression ethtool tunable.
>
> changed _at_ run time...
>

Done.

>> +static int
>> +ax88796c_set_tunable(struct net_device *ndev, const struct ethtool_tunable *tuna,
>> +		     const void *data)
>> +{
>> +	struct ax88796c_device *ax_local = to_ax88796c_device(ndev);
>> +
>> +	switch (tuna->id) {
>> +	case ETHTOOL_SPI_COMPRESSION:
>> +		if (netif_running(ndev))
>> +			return -EBUSY;
>> +		ax_local->capabilities &= ~AX_CAP_COMP;
>> +		ax_local->capabilities |= *(u32 *)data ? AX_CAP_COMP : 0;
>
> You should probably validate here that data is 0 or 1. That is what
> ax88796c_get_tunable() will return.
>
> It seems like this controls two hardware bits:
>
> SPICR_RCEN | SPICR_QCEN
>
> Maybe at some point it would make sense to allow these bits to be set
> individually? If you never validate the tunable, you cannot make use
> of other values to control the bits individually.

Good point. What is your recommendation for the userland facing
interface, so that future changes will be least disruptive?

ax_local->capabilities |= ((*(u32 *)data) & SPICR_RCEN) ? AX_CAP_COMP : 0;

or rather

ax_local->capabilities |= ((*(u32 *)data) & (SPICR_RCEN | SPICR_QCEN)) ? AX_CAP_COMP : 0;

and possibly in the future (or now) split it into 

ax_local->capabilities |= ((*(u32 *)data) & SPICR_RCEN) ? AX_CAP_COMP_R : 0;
ax_local->capabilities |= ((*(u32 *)data) & SPICR_QCEN) ? AX_CAP_COMP_Q : 0;

(and appropriate masking abve and proper handling in
ax88796c_soft_reset()).

Kind regards
-- 
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  parent reply	other threads:[~2020-11-04 10:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20201103151538eucas1p2682c895caedc83638c9a99e7f307e42b@eucas1p2.samsung.com>
2020-11-03 15:15 ` [PATCH v5 0/5] AX88796C SPI Ethernet Adapter Łukasz Stelmach
     [not found]   ` <CGME20201103151539eucas1p197086bea2450e8a11dde42650d1db6db@eucas1p1.samsung.com>
2020-11-03 15:15     ` [PATCH v5 1/5] dt-bindings: vendor-prefixes: Add asix prefix Łukasz Stelmach
     [not found]   ` <CGME20201103151539eucas1p234b5fe43c6f26272560a7d2ac791202f@eucas1p2.samsung.com>
2020-11-03 15:15     ` [PATCH v5 2/5] dt-bindings: net: Add bindings for AX88796C SPI Ethernet Adapter Łukasz Stelmach
2020-11-05 22:26       ` Rob Herring
2020-11-06 19:41       ` Krzysztof Kozlowski
     [not found]   ` <CGME20201103151540eucas1p1d45bc7fdc9ddb07607b5268d50f567ca@eucas1p1.samsung.com>
2020-11-03 15:15     ` [PATCH v5 3/5] net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver Łukasz Stelmach
2020-11-04  2:42       ` Andrew Lunn
     [not found]         ` <CGME20201104102048eucas1p1e3b29b66c497ee38656acf9ba5df10eb@eucas1p1.samsung.com>
2020-11-04 10:20           ` Lukasz Stelmach [this message]
2020-11-04 13:02             ` Andrew Lunn
     [not found]   ` <CGME20201103151540eucas1p2750cffe062d6abff42ee479a218c8eb8@eucas1p2.samsung.com>
2020-11-03 15:15     ` [PATCH v5 4/5] ARM: dts: exynos: Add Ethernet to Artik 5 board Łukasz Stelmach
2020-11-06 19:39       ` Krzysztof Kozlowski
     [not found]   ` <CGME20201103151540eucas1p1be7fe9add1ea297afa95e585be5234ae@eucas1p1.samsung.com>
2020-11-03 15:15     ` [PATCH v5 5/5] ARM: defconfig: Enable ax88796c driver Łukasz Stelmach
2020-11-06 19:40       ` Krzysztof Kozlowski

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=dleftj361ps9sa.fsf%l.stelmach@samsung.com \
    --to=l.stelmach@samsung.com \
    --cc=andrew@lunn.ch \
    --cc=b.zolnierkie@samsung.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=jim.cromie@gmail.com \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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).