Netdev Archive on lore.kernel.org
 help / color / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Igor Russkikh <Igor.Russkikh@aquantia.com>,
	Dmitry Bezrukov <Dmitry.Bezrukov@aquantia.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH 2/3] aqc111: fix writing to the phy on BE
Date: Tue, 14 May 2019 15:14:04 +0200
Message-ID: <1557839644.11261.4.camel@suse.com> (raw)
In-Reply-To: <cd6754c6-8384-a65c-1c0e-0e3d2eaaa66b@aquantia.com>

On Di, 2019-05-14 at 12:11 +0000, Igor Russkikh wrote:
> On 09.05.2019 12:08, Oliver Neukum wrote:
> > When writing to the phy on BE architectures an internal data structure
> > was directly given, leading to it being byte swapped in the wrong
> > way for the CPU in 50% of all cases. A temporary buffer must be used.
> > 
> > Signed-off-by: Oliver Neukum <oneukum@suse.com>
> > ---
> >  drivers/net/usb/aqc111.c | 23 +++++++++++++++++------
> >  1 file changed, 17 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
> > index 408df2d335e3..599d560a8450 100644
> > --- a/drivers/net/usb/aqc111.c
> > +++ b/drivers/net/usb/aqc111.c
> > @@ -320,6 +320,7 @@ static int aqc111_get_link_ksettings(struct net_device *net,
> >  static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed)
> >  {
> >  	struct aqc111_data *aqc111_data = dev->driver_priv;
> > +	u32 phy_on_the_wire;
> >  
> >  	aqc111_data->phy_cfg &= ~AQ_ADV_MASK;
> >  	aqc111_data->phy_cfg |= AQ_PAUSE;
> > @@ -361,7 +362,8 @@ static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed)
> >  		}
> >  	}
> >  
> > -	aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &aqc111_data->phy_cfg);
> > +	phy_on_the_wire = aqc111_data->phy_cfg;
> > +	aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &phy_on_the_wire);
> 
> Hi Oliver,
> 
> I see all write32_cmd and write16_cmd are using a temporary variable to do an
> internal cpu_to_le32. Why this extra temporary storage is needed?
> 
> The question is actually for both 2nd and third patch.
> In all the cases BE machine will store temporary bswap conversion in tmp
> variable and will not actually touch actual field.

Hi,

I am most terribly sorry. I overlooked the copy. Shall I revert or will
you.

	Sorry
		Oliver


  reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09  9:08 [PATCH 1/3] aqc111: fix endianness issue in aqc111_change_mtu Oliver Neukum
2019-05-09  9:08 ` [PATCH 2/3] aqc111: fix writing to the phy on BE Oliver Neukum
2019-05-09 16:37   ` David Miller
2019-05-14 12:11   ` Igor Russkikh
2019-05-14 13:14     ` Oliver Neukum [this message]
2019-05-15 14:16       ` Igor Russkikh
2019-05-09  9:08 ` [PATCH 3/3] aqc111: fix double endianness swap " Oliver Neukum
2019-05-09 16:37   ` David Miller
2019-05-09 16:37 ` [PATCH 1/3] aqc111: fix endianness issue in aqc111_change_mtu David Miller
2019-05-14 12:37 ` Igor Russkikh

Reply instructions:

You may reply publically 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=1557839644.11261.4.camel@suse.com \
    --to=oneukum@suse.com \
    --cc=Dmitry.Bezrukov@aquantia.com \
    --cc=Igor.Russkikh@aquantia.com \
    --cc=netdev@vger.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

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org netdev@archiver.kernel.org
	public-inbox-index netdev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox