linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/3] Add capability to retrieve plug-in module EEPROM
@ 2012-04-19 15:39 Stuart Hodgson
  2012-04-23 21:28 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Stuart Hodgson @ 2012-04-19 15:39 UTC (permalink / raw)
  To: netdev
  Cc: Ben Hutchings, bruce.w.allan, decot, alexander.h.duyck, davem,
	linux-kernel

We want to support reading module (SFP+, XFP, ...) EEPROMs as well as
NIC EEPROMs.  They will need a different command number and driver
operation, but the structure and arguments will be the same and so we
can share most of the code here.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Stuart Hodgson <smhodgson@solarflare.com>
---
 net/core/ethtool.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index beacdd9..ca7698f 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -751,18 +751,17 @@ static int ethtool_get_link(struct net_device *dev, char __user *useraddr)
 	return 0;
 }

-static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
+static int ethtool_get_any_eeprom(struct net_device *dev, void __user *useraddr,
+				  int (*getter)(struct net_device *,
+						struct ethtool_eeprom *, u8 *),
+				  u32 total_len)
 {
 	struct ethtool_eeprom eeprom;
-	const struct ethtool_ops *ops = dev->ethtool_ops;
 	void __user *userbuf = useraddr + sizeof(eeprom);
 	u32 bytes_remaining;
 	u8 *data;
 	int ret = 0;

-	if (!ops->get_eeprom || !ops->get_eeprom_len)
-		return -EOPNOTSUPP;
-
 	if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
 		return -EFAULT;

@@ -771,7 +770,7 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
 		return -EINVAL;

 	/* Check for exceeding total eeprom len */
-	if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
+	if (eeprom.offset + eeprom.len > total_len)
 		return -EINVAL;

 	data = kmalloc(PAGE_SIZE, GFP_USER);
@@ -782,7 +781,7 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
 	while (bytes_remaining > 0) {
 		eeprom.len = min(bytes_remaining, (u32)PAGE_SIZE);

-		ret = ops->get_eeprom(dev, &eeprom, data);
+		ret = getter(dev, &eeprom, data);
 		if (ret)
 			break;
 		if (copy_to_user(userbuf, data, eeprom.len)) {
@@ -803,6 +802,17 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
 	return ret;
 }

+static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
+{
+	const struct ethtool_ops *ops = dev->ethtool_ops;
+
+	if (!ops->get_eeprom || !ops->get_eeprom_len)
+		return -EOPNOTSUPP;
+
+	return ethtool_get_any_eeprom(dev, useraddr, ops->get_eeprom,
+				      ops->get_eeprom_len(dev));
+}
+
 static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr)
 {
 	struct ethtool_eeprom eeprom;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/3] Add capability to retrieve plug-in module EEPROM
  2012-04-19 15:39 [PATCH net-next 1/3] Add capability to retrieve plug-in module EEPROM Stuart Hodgson
@ 2012-04-23 21:28 ` David Miller
  2012-04-24 17:44   ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2012-04-23 21:28 UTC (permalink / raw)
  To: smhodgson
  Cc: netdev, bhutchings, bruce.w.allan, decot, alexander.h.duyck,
	linux-kernel


You can't just submit three seperate patches each with the same exact
Subject line.

Otherwise someone scanning the commit headers can't figure out what
is different in each of these changes.

There also is no signoff from Ben for patches #2 or #3, did he review
them?  If so, why didn't he ACK or sign off on it?  If not, why not?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/3] Add capability to retrieve plug-in module EEPROM
  2012-04-23 21:28 ` David Miller
@ 2012-04-24 17:44   ` Ben Hutchings
  2012-05-06  8:02     ` Yaniv Rosner
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2012-04-24 17:44 UTC (permalink / raw)
  To: David Miller
  Cc: smhodgson, netdev, bruce.w.allan, decot, alexander.h.duyck, linux-kernel

On Mon, 2012-04-23 at 17:28 -0400, David Miller wrote:
> You can't just submit three seperate patches each with the same exact
> Subject line.
> 
> Otherwise someone scanning the commit headers can't figure out what
> is different in each of these changes.
> 
> There also is no signoff from Ben for patches #2 or #3, did he review
> them?  If so, why didn't he ACK or sign off on it?  If not, why not?

Sorry, I've been busy with another project.  I'll reply to Stuart's
patches faster next round.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH net-next 1/3] Add capability to retrieve plug-in module EEPROM
  2012-04-24 17:44   ` Ben Hutchings
@ 2012-05-06  8:02     ` Yaniv Rosner
  2012-05-06 22:05       ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Yaniv Rosner @ 2012-05-06  8:02 UTC (permalink / raw)
  To: Ben Hutchings, smhodgson
  Cc: netdev, bruce.w.allan, decot, alexander.h.duyck, linux-kernel,
	David Miller

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 1337 bytes --]

> On Mon, 2012-04-23 at 17:28 -0400, David Miller wrote:
> > You can't just submit three seperate patches each with the same exact
> > Subject line.
> >
> > Otherwise someone scanning the commit headers can't figure out what
> > is different in each of these changes.
> >
> > There also is no signoff from Ben for patches #2 or #3, did he review
> > them?  If so, why didn't he ACK or sign off on it?  If not, why not?
> 
> Sorry, I've been busy with another project.  I'll reply to Stuart's
> patches faster next round.
> 
> Ben.

Hi Stuart,
It's been 3 weeks since you sent the initial patch series which were not
accepted. Please reply if you're going to resubmit fixed patches soon,
otherwise I'll take over, and complete this task from where you left it.

Thanks much,
Yaniv

> 
> --
> Ben Hutchings, Staff Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH net-next 1/3] Add capability to retrieve plug-in module EEPROM
  2012-05-06  8:02     ` Yaniv Rosner
@ 2012-05-06 22:05       ` Ben Hutchings
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2012-05-06 22:05 UTC (permalink / raw)
  To: Yaniv Rosner
  Cc: smhodgson, netdev, bruce.w.allan, decot, alexander.h.duyck,
	linux-kernel, David Miller

On Sun, 2012-05-06 at 08:02 +0000, Yaniv Rosner wrote:
> > On Mon, 2012-04-23 at 17:28 -0400, David Miller wrote:
> > > You can't just submit three seperate patches each with the same exact
> > > Subject line.
> > >
> > > Otherwise someone scanning the commit headers can't figure out what
> > > is different in each of these changes.
> > >
> > > There also is no signoff from Ben for patches #2 or #3, did he review
> > > them?  If so, why didn't he ACK or sign off on it?  If not, why not?
> > 
> > Sorry, I've been busy with another project.  I'll reply to Stuart's
> > patches faster next round.
> > 
> > Ben.
> 
> Hi Stuart,
> It's been 3 weeks since you sent the initial patch series which were not
> accepted. Please reply if you're going to resubmit fixed patches soon,
> otherwise I'll take over, and complete this task from where you left it.

I'll be making a pull request including Stuart's patches in the next few
days.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-06 22:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 15:39 [PATCH net-next 1/3] Add capability to retrieve plug-in module EEPROM Stuart Hodgson
2012-04-23 21:28 ` David Miller
2012-04-24 17:44   ` Ben Hutchings
2012-05-06  8:02     ` Yaniv Rosner
2012-05-06 22:05       ` Ben Hutchings

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).