* [RFC][PATCH net-next] ethtool: Allow drivers to select RX NFC rule locations
From: Ben Hutchings @ 2011-12-17 1:18 UTC (permalink / raw)
To: netdev
Cc: linux-net-drivers, Alexander Duyck, Dimitrios Michailidis,
Vladislav Zolotarov
Define special location values for RX NFC that request the driver to
select the actual rule location. This allows for implementation on
devices that use hash-based filter lookup, whereas currently the API is
more suited to devices with TCAM lookup or linear search.
In ethtool_set_rxnfc() and the compat wrapper ethtool_ioctl(), copy
the structure back to user-space after insertion so that the actual
location is returned.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
This change is sufficient to allow for conversion of sfc to implementing
the RX NFC operations. I don't know whether anything more would be
necessary for other hardware/drivers. The ethtool_ops::set_rx_ntuple
operation would then be removed, as there will be no in-tree
implementations.
In order for userland to make use of the special location values and
reliably fallback to userland allocation, drivers must properly
range-check location values. gianfar wasn't doing this, and as a result
it also didn't properly limit the total number of rules. I hope the fix
for that can go into stable updates and userland can then ignore the old
versions of gianfar.
I'll post the ethtool changes as a follow-up. If anyone would like to
see the changes to sfc at this stage, I can post them too.
Ben.
include/linux/ethtool.h | 21 ++++++++++++++++++++-
net/core/ethtool.c | 11 ++++++++++-
net/socket.c | 2 +-
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b38bf69..1c003d4 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -501,10 +501,23 @@ struct ethtool_rx_flow_spec {
* must use the second parameter to get_rxnfc() instead of @rule_locs.
*
* For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
- * @fs.@location specifies the location to use and must not be ignored.
+ * @fs.@location either specifies the location to use or is a special
+ * location value with %RX_CLS_LOC_SPECIAL flag set. Drivers do not
+ * have to support special location values but must return -%EINVAL if
+ * passed an unsupported value. On return, @fs.@location is the
+ * actual rule location.
*
* For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
* existing rule on entry.
+ *
+ * A driver supporting the special location values for
+ * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
+ * location, and may remove a rule at a later location (lower
+ * priority) that matches exactly the same set of flows. The special
+ * values are: %RX_CLS_LOC_ANY, selecting any location;
+ * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
+ * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
+ * location (minimum priority).
*/
struct ethtool_rxnfc {
__u32 cmd;
@@ -1141,6 +1154,12 @@ struct ethtool_ops {
#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
+/* Special RX classification rule insert location values */
+#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
+#define RX_CLS_LOC_ANY 0xffffffff
+#define RX_CLS_LOC_FIRST 0xfffffffe
+#define RX_CLS_LOC_LAST 0xfffffffd
+
/* Reset flags */
/* The reset() operation must clear the flags for the components which
* were actually reset. On successful return, the flags indicate the
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 597732c..e88b80d 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -439,6 +439,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
{
struct ethtool_rxnfc info;
size_t info_size = sizeof(info);
+ int rc;
if (!dev->ethtool_ops->set_rxnfc)
return -EOPNOTSUPP;
@@ -454,7 +455,15 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,
if (copy_from_user(&info, useraddr, info_size))
return -EFAULT;
- return dev->ethtool_ops->set_rxnfc(dev, &info);
+ rc = dev->ethtool_ops->set_rxnfc(dev, &info);
+ if (rc)
+ return rc;
+
+ if (cmd == ETHTOOL_SRXCLSRLINS &&
+ copy_to_user(useraddr, &info, info_size))
+ return -EFAULT;
+
+ return 0;
}
static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
diff --git a/net/socket.c b/net/socket.c
index e62b4f0..2cad581 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2758,10 +2758,10 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
case ETHTOOL_GRXRINGS:
case ETHTOOL_GRXCLSRLCNT:
case ETHTOOL_GRXCLSRULE:
+ case ETHTOOL_SRXCLSRLINS:
convert_out = true;
/* fall through */
case ETHTOOL_SRXCLSRLDEL:
- case ETHTOOL_SRXCLSRLINS:
buf_size += sizeof(struct ethtool_rxnfc);
convert_in = true;
break;
--
1.7.4.4
--
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 related
* [PATCH ethtool 1/2] ethtool-copy.h: sync with net-next
From: Ben Hutchings @ 2011-12-17 1:27 UTC (permalink / raw)
To: netdev
Cc: linux-net-drivers, Alexander Duyck, Dimitrios Michailidis,
Vladislav Zolotarov
This covers kernel changes up to:
commit XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Author: Ben Hutchings <bhutchings@solarflare.com>
Date: Mon Sep 5 21:53:10 2011 +0100
ethtool: Allow drivers to select RX NFC rule locations
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
ethtool-copy.h | 33 ++++++++++++++++++++++++++++++---
1 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 8342ade..7fb0c3b 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -498,10 +498,23 @@ struct ethtool_rx_flow_spec {
* must use the second parameter to get_rxnfc() instead of @rule_locs.
*
* For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
- * @fs.@location specifies the location to use and must not be ignored.
+ * @fs.@location either specifies the location to use or is a special
+ * location value with %RX_CLS_LOC_SPECIAL flag set. Drivers do not
+ * have to support special location values but must report an error
+ * for an unsupported value. On return, @fs.@location is the actual
+ * rule location.
*
* For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
* existing rule on entry.
+ *
+ * A driver supporting the special location values for
+ * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
+ * location, and may remove a rule at a later location (lower
+ * priority) that matches exactly the same set of flows. The special
+ * values are: %RX_CLS_LOC_ANY, selecting any location;
+ * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
+ * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
+ * location (minimum priority).
*/
struct ethtool_rxnfc {
__u32 cmd;
@@ -516,9 +529,15 @@ struct ethtool_rxnfc {
/**
* struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
* @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
- * @size: On entry, the array size of the user buffer. On return from
- * %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table.
+ * @size: On entry, the array size of the user buffer, which may be zero.
+ * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
+ * indirection table.
* @ring_index: RX ring/queue index for each hash value
+ *
+ * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
+ * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
+ * the table should be reset to default values. This last feature
+ * is not supported by the original implementations.
*/
struct ethtool_rxfh_indir {
__u32 cmd;
@@ -831,10 +850,12 @@ enum ethtool_sfeatures_retval_bits {
#define SPEED_1000 1000
#define SPEED_2500 2500
#define SPEED_10000 10000
+#define SPEED_UNKNOWN -1
/* Duplex, half or full. */
#define DUPLEX_HALF 0x00
#define DUPLEX_FULL 0x01
+#define DUPLEX_UNKNOWN 0xff
/* Which connector port. */
#define PORT_TP 0x00
@@ -905,6 +926,12 @@ enum ethtool_sfeatures_retval_bits {
#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
+/* Special RX classification rule insert location values */
+#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
+#define RX_CLS_LOC_ANY 0xffffffff
+#define RX_CLS_LOC_FIRST 0xfffffffe
+#define RX_CLS_LOC_LAST 0xfffffffd
+
/* Reset flags */
/* The reset() operation must clear the flags for the components which
* were actually reset. On successful return, the flags indicate the
--
1.7.4.4
--
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 related
* [PATCH ethtool 2/2] ethtool: Allow driver to select RX NFC rule location
From: Ben Hutchings @ 2011-12-17 1:29 UTC (permalink / raw)
To: netdev
Cc: linux-net-drivers, Alexander Duyck, Dimitrios Michailidis,
Vladislav Zolotarov
If the user does not specify a location for an RX NFC rule to be
added, pass in a location of RX_CLS_FLOW_LOC_ANY. This will only be
supported by some drivers, so if the driver returns EINVAL then use
the rule manager functions to select a location as we have done
previously.
Remove use of RX_CLS_LOC_UNSPEC and allow for later generalisation to
other special rule locations.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
ethtool.c | 2 +-
internal.h | 2 --
rxclass.c | 29 +++++++++++++++--------------
3 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index d21eaea..d0cc7d4 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2719,7 +2719,7 @@ static int flow_spec_to_ntuple(struct ethtool_rx_flow_spec *fsp,
size_t i;
/* verify location is not specified */
- if (fsp->location != RX_CLS_LOC_UNSPEC)
+ if (fsp->location != RX_CLS_LOC_ANY)
return -1;
/* verify ring cookie can transfer to action */
diff --git a/internal.h b/internal.h
index cb126b3..867c0ea 100644
--- a/internal.h
+++ b/internal.h
@@ -86,8 +86,6 @@ static inline int test_bit(unsigned int nr, const unsigned long *addr)
#define SIOCETHTOOL 0x8946
#endif
-#define RX_CLS_LOC_UNSPEC 0xffffffffUL
-
/* Context for sub-commands */
struct cmd_context {
const char *devname; /* net device name */
diff --git a/rxclass.c b/rxclass.c
index 1980d0e..f0794ed 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -68,10 +68,7 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp)
unsigned char *smac, *smacm, *dmac, *dmacm;
__u32 flow_type;
- if (fsp->location != RX_CLS_LOC_UNSPEC)
- fprintf(stdout, "Filter: %d\n", fsp->location);
- else
- fprintf(stdout, "Filter: Unspecified\n");
+ fprintf(stdout, "Filter: %d\n", fsp->location);
flow_type = fsp->flow_type & ~FLOW_EXT;
@@ -461,24 +458,28 @@ int rxclass_rule_ins(struct cmd_context *ctx,
__u32 loc = fsp->location;
int err;
+ /* notify netdev of new rule */
+ nfccmd.cmd = ETHTOOL_SRXCLSRLINS;
+ nfccmd.fs = *fsp;
+ err = send_ioctl(ctx, &nfccmd);
+
/*
- * if location is unspecified pull rules from device
- * and allocate a free rule for our use
+ * If location is 'special' and not supported, pull rules from
+ * device and allocate a free rule for our use, then try
+ * again.
*/
- if (loc == RX_CLS_LOC_UNSPEC) {
+ if (err < 0 && errno == EINVAL && (loc & RX_CLS_LOC_SPECIAL)) {
err = rmgr_set_location(ctx, fsp);
if (err < 0)
return err;
+ nfccmd.fs = *fsp;
+ err = send_ioctl(ctx, &nfccmd);
}
- /* notify netdev of new rule */
- nfccmd.cmd = ETHTOOL_SRXCLSRLINS;
- nfccmd.fs = *fsp;
- err = send_ioctl(ctx, &nfccmd);
if (err < 0)
perror("rmgr: Cannot insert RX class rule");
- else if (loc == RX_CLS_LOC_UNSPEC)
- printf("Added rule with ID %d\n", fsp->location);
+ else if (loc & RX_CLS_LOC_SPECIAL)
+ printf("Added rule with ID %d\n", nfccmd.fs.location);
return 0;
}
@@ -998,7 +999,7 @@ int rxclass_parse_ruleopts(struct cmd_context *ctx,
memset(p, 0, sizeof(*fsp));
fsp->flow_type = flow_type;
- fsp->location = RX_CLS_LOC_UNSPEC;
+ fsp->location = RX_CLS_LOC_ANY;
for (i = 1; i < argc;) {
const struct rule_opts *opt;
--
1.7.4.4
--
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 related
* RE: drivers/net/usb/asix: bug in asix_get_wol
From: allan @ 2011-12-17 2:35 UTC (permalink / raw)
To: 'Grant Grundler'
Cc: 'Eugene', netdev, 'Freddy Xin',
'ASIX Louis [蘇威陸]'
In-Reply-To: <CANEJEGvPqWVa+i9yfACU1Aoe1wdKCiO+dMtSgzcjiDqxM2ddRA@mail.gmail.com>
Dear Grant,
I will double check this issue and submit the revised patch to Linux kernel mainline source next week. Thanks a lot for your great helps.
---
Best regards,
Allan Chou
Technical Support Division
ASIX Electronics Corporation
TEL: 886-3-5799500 ext.228
FAX: 886-3-5799558
E-mail: allan@asix.com.tw
http://www.asix.com.tw/
-----Original Message-----
From: grundler@google.com [mailto:grundler@google.com] On Behalf Of Grant Grundler
Sent: Saturday, December 17, 2011 6:16 AM
To: ASIX Allan Email [office]
Cc: Eugene; netdev@vger.kernel.org; Freddy Xin; ASIX Louis [蘇威陸]
Subject: Re: drivers/net/usb/asix: bug in asix_get_wol
On Thu, Dec 15, 2011 at 9:15 PM, ASIX Allan Email [office]
<allan@asix.com.tw> wrote:
> Resend without attachment due to below email server error.
...
> -----Original Message-----
> From: ASIX Allan Email [office] [mailto:allan@asix.com.tw]
> Sent: Friday, December 16, 2011 11:38 AM
> To: 'Grant Grundler'; 'Eugene'
> Cc: 'netdev@vger.kernel.org'; 'Freddy Xin'; ASIX Louis [蘇威陸]
> Subject: RE: drivers/net/usb/asix: bug in asix_get_wol
> Importance: High
>
> Dear Grant and Eugene,
>
> Please refer to the attached file and below statements to modify the
> asix_get_wol() routine and let us know if this suggestion can solve
> your issues or not? Thanks a lot.
Allan,
Thanks for the response but it doesn't answer my previous question.
Let me ask the same question differently.
Does WOL support in asix driver need more than the four lines of code?
Ie does MONITOR_MODE need to be enabled or anything like that?
> ================
> static void
> asix_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
> {
> struct usbnet *dev = netdev_priv(net);
> u8 opt;
>
> if (asix_read_cmd(dev, AX_CMD_READ_MONITOR_MODE, 0, 0, 1, &opt) < 0) {
> wolinfo->supported = 0;
> wolinfo->wolopts = 0;
> return;
> }
> wolinfo->supported = WAKE_PHY | WAKE_MAGIC;
> wolinfo->wolopts = 0;
> if (opt & AX_MONITOR_LINK)
> wolinfo->wolopts |= WAKE_PHY;
> if (opt & AX_MONITOR_MAGIC)
> wolinfo->wolopts |= WAKE_MAGIC;
> }
This looks remarkably similar to the code Eugene said enables WOL for
him (and it works). I not able to find any difference.
If you believe it was a mistake to remove these four lines of code,
please submit a patch (See Documentation/SubmittingPatches) to add
them back. You can add a "Tested-by: Eugene <elubarsky@gmail.com>"
line after your own "Signed-off-by:" in the patch.
thanks!
grant
^ permalink raw reply
* Re: [RFC][PATCH net-next] ethtool: Allow drivers to select RX NFC rule locations
From: Dimitris Michailidis @ 2011-12-17 2:44 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev, linux-net-drivers, Alexander Duyck, Vladislav Zolotarov
In-Reply-To: <1324084683.2798.45.camel@bwh-desktop>
On 12/16/2011 05:18 PM, Ben Hutchings wrote:
> Define special location values for RX NFC that request the driver to
> select the actual rule location. This allows for implementation on
> devices that use hash-based filter lookup, whereas currently the API is
> more suited to devices with TCAM lookup or linear search.
>
> In ethtool_set_rxnfc() and the compat wrapper ethtool_ioctl(), copy
> the structure back to user-space after insertion so that the actual
> location is returned.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
I like this change. One concern below.
> - return dev->ethtool_ops->set_rxnfc(dev, &info);
> + rc = dev->ethtool_ops->set_rxnfc(dev, &info);
> + if (rc)
> + return rc;
> +
> + if (cmd == ETHTOOL_SRXCLSRLINS &&
> + copy_to_user(useraddr, &info, info_size))
> + return -EFAULT;
Here we return failure but the rule has been added successfully and is in
effect. It may be better to return 0 and let user-space tell this last step
failed by the fact that the location field is still special.
^ permalink raw reply
* Re: [RFC][PATCH net-next] ethtool: Allow drivers to select RX NFC rule locations
From: Ben Hutchings @ 2011-12-17 4:15 UTC (permalink / raw)
To: Dimitris Michailidis
Cc: netdev, linux-net-drivers, Alexander Duyck, Vladislav Zolotarov
In-Reply-To: <4EEC021D.1050804@chelsio.com>
On Fri, 2011-12-16 at 18:44 -0800, Dimitris Michailidis wrote:
> On 12/16/2011 05:18 PM, Ben Hutchings wrote:
> > Define special location values for RX NFC that request the driver to
> > select the actual rule location. This allows for implementation on
> > devices that use hash-based filter lookup, whereas currently the API is
> > more suited to devices with TCAM lookup or linear search.
> >
> > In ethtool_set_rxnfc() and the compat wrapper ethtool_ioctl(), copy
> > the structure back to user-space after insertion so that the actual
> > location is returned.
> >
> > Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
>
> I like this change. One concern below.
>
> > - return dev->ethtool_ops->set_rxnfc(dev, &info);
> > + rc = dev->ethtool_ops->set_rxnfc(dev, &info);
> > + if (rc)
> > + return rc;
> > +
> > + if (cmd == ETHTOOL_SRXCLSRLINS &&
> > + copy_to_user(useraddr, &info, info_size))
> > + return -EFAULT;
>
> Here we return failure but the rule has been added successfully and is in
> effect. It may be better to return 0 and let user-space tell this last step
> failed by the fact that the location field is still special.
If copy_to_user() fails then the user program has a bug (or is probing
for security flaws). A return value of -EFAULT is morally equivalent to
SIGSEGV. (I'm not sure why it isn't translated into a signal on return,
but I imagine there are historical reasons.) I don't see any point in
trying to help userland recover from this.
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
* Re: [PATCH net] gianfar: Reject out-of-range RX NFC locations
From: Sebastian Pöhn @ 2011-12-17 8:39 UTC (permalink / raw)
To: Ben Hutchings, David Miller; +Cc: netdev
In-Reply-To: <1324083927.2798.34.camel@bwh-desktop>
On Sat, 2011-12-17 at 01:05 +0000, Ben Hutchings wrote:
> Currently the driver only uses location values to maintain an ordered
> list of filters. There is nothing to stop the list becoming longer
> than the filer hardware can support - the driver will report an error,
> but will not roll back the change!
Sure that it does not do the rollback?
In case of to much filters it should work this way:
# Convert all in temp table
# Compress temp table
# Write out temp table => not enough space => discard temp table &
remove filter from list
>
> Make it reject location values >= MAX_FILER_IDX, consistent with the
> range that gfar_get_cls_all() reports.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Reviewed-by: Sebastian Pöhn <sebastian.poehn@googlemail.com>
> ---
> [Re-sent to what I hope is a current address for Sebastian.]
>
> This has not been tested in any way, as I don't have a suitable compiler
> installed. Sebastian, please could you review this?
Unfortunately I haven't too ...
>
> Ben.
>
> drivers/net/ethernet/freescale/gianfar_ethtool.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> index 5890f4b..5a3b2e5 100644
> --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
> +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> @@ -1692,8 +1692,9 @@ static int gfar_set_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
> ret = gfar_set_hash_opts(priv, cmd);
> break;
> case ETHTOOL_SRXCLSRLINS:
> - if (cmd->fs.ring_cookie != RX_CLS_FLOW_DISC &&
> - cmd->fs.ring_cookie >= priv->num_rx_queues) {
> + if ((cmd->fs.ring_cookie != RX_CLS_FLOW_DISC &&
> + cmd->fs.ring_cookie >= priv->num_rx_queues) ||
> + cmd->fs.location >= MAX_FILER_IDX) {
> ret = -EINVAL;
> break;
> }
> --
> 1.7.4.4
>
>
^ permalink raw reply
* Re: [PATCH 0/13] Dumping AF_UNIX sockets via netlink
From: Pavel Emelyanov @ 2011-12-17 9:54 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org
In-Reply-To: <20111216.135024.262929657289610510.davem@davemloft.net>
On 12/16/2011 10:50 PM, David Miller wrote:
> From: Pavel Emelyanov <xemul@parallels.com>
> Date: Thu, 15 Dec 2011 16:42:18 +0400
>
>> Make the unix_diag.ko module, which is the AF_UNIX client for the sock_diag.
>>
>> Use the sock_i_ino() as the primary ID key for sockets. This is currently the
>> only unique (except for the sk address itself) ID of a unix socket and is de
>> facto used in the ss tool to identify sockets. Thus the basic nlk request and
>> response structures operate on this ID. Other socket info (sun_name, peer, etc.)
>> are reported in the respective NLA-s (patches 8 through 12).
>>
>> There's a locking trickery in patch #11. I've tried to study it carefully and
>> checked with lockdep, but anyway, please, pay special attention to it.
>>
>> The patch for ss tool is also included.
>>
>> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
>
> Looks good, applied.
>
> I'm slightly confused by the module alias strings these diag modules
> are using, can you explain it to me?
>
> On one side it looks like it wants to see a suffix of "-${AF_INET}-${IPPROTO_TCP}"
> but in the macros you pass in one numerical value, which is AF_INET minus the
> protocol value.
You're right, the intention is to get the "family-protocol" pair, and the minus you
see (surrounded with numbers) is put into the stringify macro, which works like
stringify(2-16) => "2-16"
since (as far as I understand this) C pre-processor doesn't perform arithmetic
calculations.
> How does that work?
>
> Thanks.
> .
>
Thanks,
Pavel
^ permalink raw reply
* Re: nonlocal_bind and IPv6
From: Vincent Bernat @ 2011-12-17 10:52 UTC (permalink / raw)
To: David Miller; +Cc: zenczykowski, netdev, yoshfuji
In-Reply-To: <20111216.131833.2127398230815526406.davem@davemloft.net>
OoO Pendant le repas du vendredi 16 décembre 2011, vers 19:18, David
Miller <davem@davemloft.net> disait :
>> Moreover, I am just adding the IPv6 version of this setting. The IPv4
>> version already exists.
> I don't think the ipv4 feature was a wise thing to add, so just because
> ipv4 has something doesn't automatically make it appropriate to support
> it in ipv6 too. So please don't use arguments like that.
Here are my arguments against using IP_FREEBIND:
1. It needs to be applied to all services, this will take years. All
services will need an option just for that (because usually a user
does not want to be able to bind to a non local IP). We could use
some hacks with LD_PRELOAD, but that's just an hack.
2. This option may just be unavailable because it is too low-level. For
example, it is not available in Python socket implementation (but I
can still hardcode the numerical value). If I use some web
framework, I will also have hard time to set this option.
3. This is a Linux only option.
Here are the arguments for a sysctl:
1. It is a system-wide configuration: you configure VRRP on your
system, you enable this sysctl, nothing else to do.
2. This is essentially a one-line modification. This will be quite easy
to maintain for years.
3. This is the natural option for many people. See for example:
http://thread.gmane.org/gmane.comp.web.haproxy/7317/focus=7318
4. Without it, people just do horrible things:
http://thread.gmane.org/gmane.comp.web.haproxy/7317/focus=7321
Did I convince you?
--
Vincent Bernat ☯ http://vincent.bernat.im
/*
* We used to try various strange things. Let's not.
*/
2.2.16 /usr/src/linux/fs/buffer.c
^ permalink raw reply
* Re: Kernel-DOS error in arp mechanism – no delete off incomplete arp adresses
From: richard -rw- weinberger @ 2011-12-17 13:26 UTC (permalink / raw)
To: Robert Gladewitz; +Cc: linux-kernel, netdev
In-Reply-To: <4EEC5286.3070408@gmx.de>
On Sat, Dec 17, 2011 at 9:27 AM, Robert Gladewitz <gladewitz@gmx.de> wrote:
> Hello,
>
> first i have to say sorry for m y bad english. I try my best to descripe the
> error.
>
> I Use Linux-Routers for internal and external firewall components. For this
> I Use own kernel configurations und use only the drivers an modules what I
> need. Other features and modules I deactivated in my kernel versions
>
> Since the kernel version 2.6.36 there is some mistake in the ipv4 arp
> implementation. The the System try to find an unknown system, the send an
> “who is” and marked the ip address as “incomplete” (German: unvollständig).
> The thing is, usually linux delete all incomplete and complete entries in
> some time, but in all kernel versions since 2.6.36 he doas not delete any
> addresses.
>
> In my case, I scan my network-segmens for new devices (Kaspersky, Landesk)
> and on this process, the router learned a lot of incomplete addresses. I
> have some class b networks (from the history), and this means the router
> will be learned mor then 2^16 adresses.
>
> Now the kerlen learn a maximum addresses – I know this is defined on
> gc_thresh1 , gc_thresh2 and gc_thresh3 in the proc system under
> sys.net.ipv4.neight.default. If the table have the maximum addresses in the
> table (default=1024), no new host can send traffic packet over this router.
> This means, we have a classical risk of DOS. In my case, I have only an
> internal risk, but some providers may have also external risc.
>
> I hope, my description help you to find this error. I send also my kernel
> config, may there is some relation to small configurations in kernel
>
> Viele Grüße
>
> Robert Gladewitz
>
CC'ing netdev.
--
Thanks,
//richard
^ permalink raw reply
* [PATCH] 9p: Don't use ATTR_* values from fs.h in userspace facing structs
From: Sasha Levin @ 2011-12-17 15:07 UTC (permalink / raw)
To: ericvh, rminnich, lucho, davem, aneesh.kumar, jvrao, viro
Cc: v9fs-developer, netdev, linux-kernel, Sasha Levin
struct p9_iattr_dotl is userspace facing, but the 'valid' field is documented
as follows:
* @valid: bitfield specifying which fields are valid
* same as in struct iattr
Which means that the user has to know about kernel internal ATTR_* values.
On Fri, 2011-12-16 at 23:30 +0000, Al Viro wrote:
> They *are* kernel internal values and 9P is asking for trouble exposing
> them. Translation: tomorrow we might reassign those as we bloody wish
> and any userland code that happens to rely on their values will break.
> At which point we'll handle complaints by pointing and laughing.
>
> It's a 9P bug; fix it there. Turning random internal constants into a part
> of ABI is not going to work.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
fs/9p/vfs_inode_dotl.c | 31 ++++++++++++++++++++++++++++++-
include/net/9p/9p.h | 18 ++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletions(-)
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 0b5745e..a948214 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -523,6 +523,35 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
return 0;
}
+int v9fs_vfs_iattr_to_9p_valid(u32 ia_valid)
+{
+ u32 valid = 0, i;
+ static u32 attr_map[][2] = {
+ {ATTR_MODE, P9_ATTR_MODE},
+ {ATTR_UID, P9_ATTR_UID},
+ {ATTR_SIZE, P9_ATTR_SIZE},
+ {ATTR_ATIME, P9_ATTR_ATIME},
+ {ATTR_MTIME, P9_ATTR_MTIME},
+ {ATTR_CTIME, P9_ATTR_CTIME},
+ {ATTR_ATIME_SET, P9_ATTR_ATIME_SET},
+ {ATTR_MTIME_SET, P9_ATTR_MTIME_SET},
+ {ATTR_FORCE, P9_ATTR_FORCE},
+ {ATTR_ATTR_FLAG, P9_ATTR_ATTR_FLAG},
+ {ATTR_KILL_SUID, P9_ATTR_KILL_SUID},
+ {ATTR_KILL_SGID, P9_ATTR_KILL_SGID},
+ {ATTR_FILE, P9_ATTR_FILE},
+ {ATTR_KILL_PRIV, P9_ATTR_KILL_PRIV},
+ {ATTR_OPEN, P9_ATTR_OPEN},
+ {ATTR_TIMES_SET, P9_ATTR_TIMES_SET},
+ };
+
+ for (i = 0; i < ARRAY_SIZE(attr_map); i++)
+ if (ia_valid & attr_map[i][0])
+ valid |= attr_map[i][1];
+
+ return valid;
+}
+
/**
* v9fs_vfs_setattr_dotl - set file metadata
* @dentry: file whose metadata to set
@@ -543,7 +572,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
if (retval)
return retval;
- p9attr.valid = iattr->ia_valid;
+ p9attr.valid = v9fs_vfs_iattr_to_9p_valid(iattr->ia_valid);
p9attr.mode = iattr->ia_mode;
p9attr.uid = iattr->ia_uid;
p9attr.gid = iattr->ia_gid;
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 2d70b95..98b3f71 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -468,6 +468,24 @@ struct p9_stat_dotl {
#define P9_STATS_BASIC 0x000007ffULL /* Mask for fields up to BLOCKS */
#define P9_STATS_ALL 0x00003fffULL /* Mask for All fields above */
+#define P9_ATTR_MODE (1 << 0)
+#define P9_ATTR_UID (1 << 1)
+#define P9_ATTR_GID (1 << 2)
+#define P9_ATTR_SIZE (1 << 3)
+#define P9_ATTR_ATIME (1 << 4)
+#define P9_ATTR_MTIME (1 << 5)
+#define P9_ATTR_CTIME (1 << 6)
+#define P9_ATTR_ATIME_SET (1 << 7)
+#define P9_ATTR_MTIME_SET (1 << 8)
+#define P9_ATTR_FORCE (1 << 9) /* Not a change, but a change it */
+#define P9_ATTR_ATTR_FLAG (1 << 10)
+#define P9_ATTR_KILL_SUID (1 << 11)
+#define P9_ATTR_KILL_SGID (1 << 12)
+#define P9_ATTR_FILE (1 << 13)
+#define P9_ATTR_KILL_PRIV (1 << 14)
+#define P9_ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */
+#define P9_ATTR_TIMES_SET (1 << 16)
+
/**
* struct p9_iattr_dotl - P9 inode attribute for setattr
* @valid: bitfield specifying which fields are valid
--
1.7.8
^ permalink raw reply related
* Re: [PATCH net-next] can: replace the dev_dbg/info/err/... with the new netdev_xxx macros
From: Sebastian Haas @ 2011-12-17 15:12 UTC (permalink / raw)
To: Wolfgang Grandegger
Cc: netdev, linux-can, Barry Song, Marc Kleine-Budde, Anant Gole,
Chris Elston, Sebastian Haas, Matthias Fuchs
In-Reply-To: <4EE61D71.90401@grandegger.com>
Looks good for ems_usb. Thanks Wolfgang.
Acked-by: Sebastian Haas <dev@sebastianhaas.info>
Am 12.12.2011 16:27, schrieb Wolfgang Grandegger:
> CC: Barry Song<barry.song@analog.com>
> CC: Anant Gole<anantgole@ti.com>
> CC: Chris Elston<celston@katalix.com>
> CC: Sebastian Haas<haas@ems-wuensche.com>
> CC: Matthias Fuchs<matthias.fuchs@esd.eu>
> Signed-off-by: Wolfgang Grandegger<wg@grandegger.com>
> ---
> drivers/net/can/bfin_can.c | 21 +++++--------
> drivers/net/can/dev.c | 23 +++++++--------
> drivers/net/can/flexcan.c | 44 +++++++++++++---------------
> drivers/net/can/mcp251x.c | 3 +-
> drivers/net/can/mscan/mscan.c | 17 +++++------
> drivers/net/can/sja1000/sja1000.c | 19 ++++++------
> drivers/net/can/ti_hecc.c | 20 ++++++------
> drivers/net/can/usb/ems_usb.c | 57 +++++++++++++++----------------------
> drivers/net/can/usb/esd_usb2.c | 27 ++++++++----------
> 9 files changed, 103 insertions(+), 128 deletions(-)
>
> diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
> index 349e0fa..9cf4ddb 100644
> --- a/drivers/net/can/bfin_can.c
> +++ b/drivers/net/can/bfin_can.c
> @@ -82,8 +82,7 @@ static int bfin_can_set_bittiming(struct net_device *dev)
> bfin_write(®->clock, clk);
> bfin_write(®->timing, timing);
>
> - dev_info(dev->dev.parent, "setting CLOCK=0x%04x TIMING=0x%04x\n",
> - clk, timing);
> + netdev_info(dev, "setting CLOCK=0x%04x TIMING=0x%04x\n", clk, timing);
>
> return 0;
> }
> @@ -108,8 +107,7 @@ static void bfin_can_set_reset_mode(struct net_device *dev)
> while (!(bfin_read(®->control)& CCA)) {
> udelay(10);
> if (--timeout == 0) {
> - dev_err(dev->dev.parent,
> - "fail to enter configuration mode\n");
> + netdev_err(dev, "fail to enter configuration mode\n");
> BUG();
> }
> }
> @@ -165,8 +163,7 @@ static void bfin_can_set_normal_mode(struct net_device *dev)
> while (bfin_read(®->status)& CCA) {
> udelay(10);
> if (--timeout == 0) {
> - dev_err(dev->dev.parent,
> - "fail to leave configuration mode\n");
> + netdev_err(dev, "fail to leave configuration mode\n");
> BUG();
> }
> }
> @@ -331,7 +328,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
>
> if (isrc& RMLIS) {
> /* data overrun interrupt */
> - dev_dbg(dev->dev.parent, "data overrun interrupt\n");
> + netdev_dbg(dev, "data overrun interrupt\n");
> cf->can_id |= CAN_ERR_CRTL;
> cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
> stats->rx_over_errors++;
> @@ -339,7 +336,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
> }
>
> if (isrc& BOIS) {
> - dev_dbg(dev->dev.parent, "bus-off mode interrupt\n");
> + netdev_dbg(dev, "bus-off mode interrupt\n");
> state = CAN_STATE_BUS_OFF;
> cf->can_id |= CAN_ERR_BUSOFF;
> can_bus_off(dev);
> @@ -347,13 +344,12 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
>
> if (isrc& EPIS) {
> /* error passive interrupt */
> - dev_dbg(dev->dev.parent, "error passive interrupt\n");
> + netdev_dbg(dev, "error passive interrupt\n");
> state = CAN_STATE_ERROR_PASSIVE;
> }
>
> if ((isrc& EWTIS) || (isrc& EWRIS)) {
> - dev_dbg(dev->dev.parent,
> - "Error Warning Transmit/Receive Interrupt\n");
> + netdev_dbg(dev, "Error Warning Transmit/Receive Interrupt\n");
> state = CAN_STATE_ERROR_WARNING;
> }
>
> @@ -636,8 +632,7 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
> while (!(bfin_read(®->intr)& SMACK)) {
> udelay(10);
> if (--timeout == 0) {
> - dev_err(dev->dev.parent,
> - "fail to enter sleep mode\n");
> + netdev_err(dev, "fail to enter sleep mode\n");
> BUG();
> }
> }
> diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> index 120f1ab..ac4ac92 100644
> --- a/drivers/net/can/dev.c
> +++ b/drivers/net/can/dev.c
> @@ -130,13 +130,13 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
> /* Error in one-tenth of a percent */
> error = (best_error * 1000) / bt->bitrate;
> if (error> CAN_CALC_MAX_ERROR) {
> - dev_err(dev->dev.parent,
> - "bitrate error %ld.%ld%% too high\n",
> - error / 10, error % 10);
> + netdev_err(dev,
> + "bitrate error %ld.%ld%% too high\n",
> + error / 10, error % 10);
> return -EDOM;
> } else {
> - dev_warn(dev->dev.parent, "bitrate error %ld.%ld%%\n",
> - error / 10, error % 10);
> + netdev_warn(dev, "bitrate error %ld.%ld%%\n",
> + error / 10, error % 10);
> }
> }
>
> @@ -172,7 +172,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
> #else /* !CONFIG_CAN_CALC_BITTIMING */
> static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
> {
> - dev_err(dev->dev.parent, "bit-timing calculation not available\n");
> + netdev_err(dev, "bit-timing calculation not available\n");
> return -EINVAL;
> }
> #endif /* CONFIG_CAN_CALC_BITTIMING */
> @@ -313,8 +313,7 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
> priv->echo_skb[idx] = skb;
> } else {
> /* locking problem with netif_stop_queue() ?? */
> - dev_err(dev->dev.parent, "%s: BUG! echo_skb is occupied!\n",
> - __func__);
> + netdev_err(dev, "%s: BUG! echo_skb is occupied!\n", __func__);
> kfree_skb(skb);
> }
> }
> @@ -392,7 +391,7 @@ void can_restart(unsigned long data)
> stats->rx_bytes += cf->can_dlc;
>
> restart:
> - dev_dbg(dev->dev.parent, "restarted\n");
> + netdev_dbg(dev, "restarted\n");
> priv->can_stats.restarts++;
>
> /* Now restart the device */
> @@ -400,7 +399,7 @@ restart:
>
> netif_carrier_on(dev);
> if (err)
> - dev_err(dev->dev.parent, "Error %d during restart", err);
> + netdev_err(dev, "Error %d during restart", err);
> }
>
> int can_restart_now(struct net_device *dev)
> @@ -433,7 +432,7 @@ void can_bus_off(struct net_device *dev)
> {
> struct can_priv *priv = netdev_priv(dev);
>
> - dev_dbg(dev->dev.parent, "bus-off\n");
> + netdev_dbg(dev, "bus-off\n");
>
> netif_carrier_off(dev);
> priv->can_stats.bus_off++;
> @@ -545,7 +544,7 @@ int open_candev(struct net_device *dev)
> struct can_priv *priv = netdev_priv(dev);
>
> if (!priv->bittiming.tq&& !priv->bittiming.bitrate) {
> - dev_err(dev->dev.parent, "bit-timing not yet defined\n");
> + netdev_err(dev, "bit-timing not yet defined\n");
> return -EINVAL;
> }
>
> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> index 111f154..e40afad 100644
> --- a/drivers/net/can/flexcan.c
> +++ b/drivers/net/can/flexcan.c
> @@ -322,34 +322,34 @@ static void do_bus_err(struct net_device *dev,
> cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
>
> if (reg_esr& FLEXCAN_ESR_BIT1_ERR) {
> - dev_dbg(dev->dev.parent, "BIT1_ERR irq\n");
> + netdev_dbg(dev, "BIT1_ERR irq\n");
> cf->data[2] |= CAN_ERR_PROT_BIT1;
> tx_errors = 1;
> }
> if (reg_esr& FLEXCAN_ESR_BIT0_ERR) {
> - dev_dbg(dev->dev.parent, "BIT0_ERR irq\n");
> + netdev_dbg(dev, "BIT0_ERR irq\n");
> cf->data[2] |= CAN_ERR_PROT_BIT0;
> tx_errors = 1;
> }
> if (reg_esr& FLEXCAN_ESR_ACK_ERR) {
> - dev_dbg(dev->dev.parent, "ACK_ERR irq\n");
> + netdev_dbg(dev, "ACK_ERR irq\n");
> cf->can_id |= CAN_ERR_ACK;
> cf->data[3] |= CAN_ERR_PROT_LOC_ACK;
> tx_errors = 1;
> }
> if (reg_esr& FLEXCAN_ESR_CRC_ERR) {
> - dev_dbg(dev->dev.parent, "CRC_ERR irq\n");
> + netdev_dbg(dev, "CRC_ERR irq\n");
> cf->data[2] |= CAN_ERR_PROT_BIT;
> cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;
> rx_errors = 1;
> }
> if (reg_esr& FLEXCAN_ESR_FRM_ERR) {
> - dev_dbg(dev->dev.parent, "FRM_ERR irq\n");
> + netdev_dbg(dev, "FRM_ERR irq\n");
> cf->data[2] |= CAN_ERR_PROT_FORM;
> rx_errors = 1;
> }
> if (reg_esr& FLEXCAN_ESR_STF_ERR) {
> - dev_dbg(dev->dev.parent, "STF_ERR irq\n");
> + netdev_dbg(dev, "STF_ERR irq\n");
> cf->data[2] |= CAN_ERR_PROT_STUFF;
> rx_errors = 1;
> }
> @@ -396,7 +396,7 @@ static void do_state(struct net_device *dev,
> */
> if (new_state>= CAN_STATE_ERROR_WARNING&&
> new_state<= CAN_STATE_BUS_OFF) {
> - dev_dbg(dev->dev.parent, "Error Warning IRQ\n");
> + netdev_dbg(dev, "Error Warning IRQ\n");
> priv->can.can_stats.error_warning++;
>
> cf->can_id |= CAN_ERR_CRTL;
> @@ -412,7 +412,7 @@ static void do_state(struct net_device *dev,
> */
> if (new_state>= CAN_STATE_ERROR_PASSIVE&&
> new_state<= CAN_STATE_BUS_OFF) {
> - dev_dbg(dev->dev.parent, "Error Passive IRQ\n");
> + netdev_dbg(dev, "Error Passive IRQ\n");
> priv->can.can_stats.error_passive++;
>
> cf->can_id |= CAN_ERR_CRTL;
> @@ -422,8 +422,8 @@ static void do_state(struct net_device *dev,
> }
> break;
> case CAN_STATE_BUS_OFF:
> - dev_err(dev->dev.parent,
> - "BUG! hardware recovered automatically from BUS_OFF\n");
> + netdev_err(dev, "BUG! "
> + "hardware recovered automatically from BUS_OFF\n");
> break;
> default:
> break;
> @@ -432,7 +432,7 @@ static void do_state(struct net_device *dev,
> /* process state changes depending on the new state */
> switch (new_state) {
> case CAN_STATE_ERROR_ACTIVE:
> - dev_dbg(dev->dev.parent, "Error Active\n");
> + netdev_dbg(dev, "Error Active\n");
> cf->can_id |= CAN_ERR_PROT;
> cf->data[2] = CAN_ERR_PROT_ACTIVE;
> break;
> @@ -653,12 +653,12 @@ static void flexcan_set_bittiming(struct net_device *dev)
> if (priv->can.ctrlmode& CAN_CTRLMODE_3_SAMPLES)
> reg |= FLEXCAN_CTRL_SMP;
>
> - dev_info(dev->dev.parent, "writing ctrl=0x%08x\n", reg);
> + netdev_info(dev, "writing ctrl=0x%08x\n", reg);
> flexcan_write(reg,®s->ctrl);
>
> /* print chip status */
> - dev_dbg(dev->dev.parent, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__,
> - flexcan_read(®s->mcr), flexcan_read(®s->ctrl));
> + netdev_dbg(dev, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__,
> + flexcan_read(®s->mcr), flexcan_read(®s->ctrl));
> }
>
> /*
> @@ -684,9 +684,8 @@ static int flexcan_chip_start(struct net_device *dev)
>
> reg_mcr = flexcan_read(®s->mcr);
> if (reg_mcr& FLEXCAN_MCR_SOFTRST) {
> - dev_err(dev->dev.parent,
> - "Failed to softreset can module (mcr=0x%08x)\n",
> - reg_mcr);
> + netdev_err(dev, "Failed to softreset can module (mcr=0x%08x)\n",
> + reg_mcr);
> err = -ENODEV;
> goto out;
> }
> @@ -708,7 +707,7 @@ static int flexcan_chip_start(struct net_device *dev)
> reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
> FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
> FLEXCAN_MCR_IDAM_C;
> - dev_dbg(dev->dev.parent, "%s: writing mcr=0x%08x", __func__, reg_mcr);
> + netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr);
> flexcan_write(reg_mcr,®s->mcr);
>
> /*
> @@ -734,7 +733,7 @@ static int flexcan_chip_start(struct net_device *dev)
>
> /* save for later use */
> priv->reg_ctrl_default = reg_ctrl;
> - dev_dbg(dev->dev.parent, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
> + netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
> flexcan_write(reg_ctrl,®s->ctrl);
>
> for (i = 0; i< ARRAY_SIZE(regs->cantxfg); i++) {
> @@ -766,8 +765,8 @@ static int flexcan_chip_start(struct net_device *dev)
> flexcan_write(FLEXCAN_IFLAG_DEFAULT,®s->imask1);
>
> /* print chip status */
> - dev_dbg(dev->dev.parent, "%s: reading mcr=0x%08x ctrl=0x%08x\n",
> - __func__, flexcan_read(®s->mcr), flexcan_read(®s->ctrl));
> + netdev_dbg(dev, "%s: reading mcr=0x%08x ctrl=0x%08x\n", __func__,
> + flexcan_read(®s->mcr), flexcan_read(®s->ctrl));
>
> return 0;
>
> @@ -905,8 +904,7 @@ static int __devinit register_flexcandev(struct net_device *dev)
> */
> reg = flexcan_read(®s->mcr);
> if (!(reg& FLEXCAN_MCR_FEN)) {
> - dev_err(dev->dev.parent,
> - "Could not enable RX FIFO, unsupported core\n");
> + netdev_err(dev, "Could not enable RX FIFO, unsupported core\n");
> err = -ENODEV;
> goto out;
> }
> diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
> index 330140e..346785c 100644
> --- a/drivers/net/can/mcp251x.c
> +++ b/drivers/net/can/mcp251x.c
> @@ -712,8 +712,7 @@ static void mcp251x_error_skb(struct net_device *net, int can_id, int data1)
> frame->data[1] = data1;
> netif_rx_ni(skb);
> } else {
> - dev_err(&net->dev,
> - "cannot allocate error skb\n");
> + netdev_err(net, "cannot allocate error skb\n");
> }
> }
>
> diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
> index 1c82dd8..ad8e687 100644
> --- a/drivers/net/can/mscan/mscan.c
> +++ b/drivers/net/can/mscan/mscan.c
> @@ -95,9 +95,9 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
> * any, at once.
> */
> if (i>= MSCAN_SET_MODE_RETRIES)
> - dev_dbg(dev->dev.parent,
> - "device failed to enter sleep mode. "
> - "We proceed anyhow.\n");
> + netdev_dbg(dev,
> + "device failed to enter sleep mode. "
> + "We proceed anyhow.\n");
> else
> priv->can.state = CAN_STATE_SLEEPING;
> }
> @@ -213,7 +213,7 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
> switch (hweight8(i)) {
> case 0:
> netif_stop_queue(dev);
> - dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
> + netdev_err(dev, "Tx Ring full when queue awake!\n");
> return NETDEV_TX_BUSY;
> case 1:
> /*
> @@ -352,7 +352,7 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame,
> struct net_device_stats *stats =&dev->stats;
> enum can_state old_state;
>
> - dev_dbg(dev->dev.parent, "error interrupt (canrflg=%#x)\n", canrflg);
> + netdev_dbg(dev, "error interrupt (canrflg=%#x)\n", canrflg);
> frame->can_id = CAN_ERR_FLAG;
>
> if (canrflg& MSCAN_OVRIF) {
> @@ -427,7 +427,7 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota)
> skb = alloc_can_skb(dev,&frame);
> if (!skb) {
> if (printk_ratelimit())
> - dev_notice(dev->dev.parent, "packet dropped\n");
> + netdev_notice(dev, "packet dropped\n");
> stats->rx_dropped++;
> out_8(®s->canrflg, canrflg);
> continue;
> @@ -551,8 +551,7 @@ static int mscan_do_set_bittiming(struct net_device *dev)
> BTR1_SET_TSEG2(bt->phase_seg2) |
> BTR1_SET_SAM(priv->can.ctrlmode& CAN_CTRLMODE_3_SAMPLES));
>
> - dev_info(dev->dev.parent, "setting BTR0=0x%02x BTR1=0x%02x\n",
> - btr0, btr1);
> + netdev_info(dev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
>
> out_8(®s->canbtr0, btr0);
> out_8(®s->canbtr1, btr1);
> @@ -575,7 +574,7 @@ static int mscan_open(struct net_device *dev)
>
> ret = request_irq(dev->irq, mscan_isr, 0, dev->name, dev);
> if (ret< 0) {
> - dev_err(dev->dev.parent, "failed to attach interrupt\n");
> + netdev_err(dev, "failed to attach interrupt\n");
> goto exit_napi_disable;
> }
>
> diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
> index 04a3f1b..ebbcfca 100644
> --- a/drivers/net/can/sja1000/sja1000.c
> +++ b/drivers/net/can/sja1000/sja1000.c
> @@ -128,7 +128,7 @@ static void set_reset_mode(struct net_device *dev)
> status = priv->read_reg(priv, REG_MOD);
> }
>
> - dev_err(dev->dev.parent, "setting SJA1000 into reset mode failed!\n");
> + netdev_err(dev, "setting SJA1000 into reset mode failed!\n");
> }
>
> static void set_normal_mode(struct net_device *dev)
> @@ -156,7 +156,7 @@ static void set_normal_mode(struct net_device *dev)
> status = priv->read_reg(priv, REG_MOD);
> }
>
> - dev_err(dev->dev.parent, "setting SJA1000 into normal mode failed!\n");
> + netdev_err(dev, "setting SJA1000 into normal mode failed!\n");
> }
>
> static void sja1000_start(struct net_device *dev)
> @@ -209,8 +209,7 @@ static int sja1000_set_bittiming(struct net_device *dev)
> if (priv->can.ctrlmode& CAN_CTRLMODE_3_SAMPLES)
> btr1 |= 0x80;
>
> - dev_info(dev->dev.parent,
> - "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
> + netdev_info(dev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
>
> priv->write_reg(priv, REG_BTR0, btr0);
> priv->write_reg(priv, REG_BTR1, btr1);
> @@ -378,7 +377,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
>
> if (isrc& IRQ_DOI) {
> /* data overrun interrupt */
> - dev_dbg(dev->dev.parent, "data overrun interrupt\n");
> + netdev_dbg(dev, "data overrun interrupt\n");
> cf->can_id |= CAN_ERR_CRTL;
> cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
> stats->rx_over_errors++;
> @@ -388,7 +387,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
>
> if (isrc& IRQ_EI) {
> /* error warning interrupt */
> - dev_dbg(dev->dev.parent, "error warning interrupt\n");
> + netdev_dbg(dev, "error warning interrupt\n");
>
> if (status& SR_BS) {
> state = CAN_STATE_BUS_OFF;
> @@ -429,7 +428,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
> }
> if (isrc& IRQ_EPI) {
> /* error passive interrupt */
> - dev_dbg(dev->dev.parent, "error passive interrupt\n");
> + netdev_dbg(dev, "error passive interrupt\n");
> if (status& SR_ES)
> state = CAN_STATE_ERROR_PASSIVE;
> else
> @@ -437,7 +436,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
> }
> if (isrc& IRQ_ALI) {
> /* arbitration lost interrupt */
> - dev_dbg(dev->dev.parent, "arbitration lost interrupt\n");
> + netdev_dbg(dev, "arbitration lost interrupt\n");
> alc = priv->read_reg(priv, REG_ALC);
> priv->can.can_stats.arbitration_lost++;
> stats->tx_errors++;
> @@ -495,7 +494,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
> status = priv->read_reg(priv, REG_SR);
>
> if (isrc& IRQ_WUI)
> - dev_warn(dev->dev.parent, "wakeup interrupt\n");
> + netdev_warn(dev, "wakeup interrupt\n");
>
> if (isrc& IRQ_TI) {
> /* transmission complete interrupt */
> @@ -522,7 +521,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
> priv->post_irq(priv);
>
> if (n>= SJA1000_MAX_IRQ)
> - dev_dbg(dev->dev.parent, "%d messages handled in ISR", n);
> + netdev_dbg(dev, "%d messages handled in ISR", n);
>
> return (n) ? IRQ_HANDLED : IRQ_NONE;
> }
> diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
> index df809e3..d50e5e0 100644
> --- a/drivers/net/can/ti_hecc.c
> +++ b/drivers/net/can/ti_hecc.c
> @@ -306,7 +306,7 @@ static int ti_hecc_set_btc(struct ti_hecc_priv *priv)
> if (bit_timing->brp> 4)
> can_btc |= HECC_CANBTC_SAM;
> else
> - dev_warn(priv->ndev->dev.parent, "WARN: Triple" \
> + netdev_warn(priv->ndev, "WARN: Triple"
> "sampling not set due to h/w limitations");
> }
> can_btc |= ((bit_timing->sjw - 1)& 0x3)<< 8;
> @@ -315,7 +315,7 @@ static int ti_hecc_set_btc(struct ti_hecc_priv *priv)
> /* ERM being set to 0 by default meaning resync at falling edge */
>
> hecc_write(priv, HECC_CANBTC, can_btc);
> - dev_info(priv->ndev->dev.parent, "setting CANBTC=%#x\n", can_btc);
> + netdev_info(priv->ndev, "setting CANBTC=%#x\n", can_btc);
>
> return 0;
> }
> @@ -332,7 +332,7 @@ static void ti_hecc_reset(struct net_device *ndev)
> u32 cnt;
> struct ti_hecc_priv *priv = netdev_priv(ndev);
>
> - dev_dbg(ndev->dev.parent, "resetting hecc ...\n");
> + netdev_dbg(ndev, "resetting hecc ...\n");
> hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_SRES);
>
> /* Set change control request and wait till enabled */
> @@ -496,7 +496,7 @@ static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev)
> if (unlikely(hecc_read(priv, HECC_CANME)& mbx_mask)) {
> spin_unlock_irqrestore(&priv->mbx_lock, flags);
> netif_stop_queue(ndev);
> - dev_err(priv->ndev->dev.parent,
> + dev_err(priv->ndev,
> "BUG: TX mbx not ready tx_head=%08X, tx_tail=%08X\n",
> priv->tx_head, priv->tx_tail);
> return NETDEV_TX_BUSY;
> @@ -550,7 +550,7 @@ static int ti_hecc_rx_pkt(struct ti_hecc_priv *priv, int mbxno)
> skb = alloc_can_skb(priv->ndev,&cf);
> if (!skb) {
> if (printk_ratelimit())
> - dev_err(priv->ndev->dev.parent,
> + netdev_err(priv->ndev,
> "ti_hecc_rx_pkt: alloc_can_skb() failed\n");
> return -ENOMEM;
> }
> @@ -668,7 +668,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
> skb = alloc_can_err_skb(ndev,&cf);
> if (!skb) {
> if (printk_ratelimit())
> - dev_err(priv->ndev->dev.parent,
> + netdev_err(priv->ndev,
> "ti_hecc_error: alloc_can_err_skb() failed\n");
> return -ENOMEM;
> }
> @@ -684,7 +684,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
> cf->data[1] |= CAN_ERR_CRTL_RX_WARNING;
> }
> hecc_set_bit(priv, HECC_CANES, HECC_CANES_EW);
> - dev_dbg(priv->ndev->dev.parent, "Error Warning interrupt\n");
> + netdev_dbg(priv->ndev, "Error Warning interrupt\n");
> hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
> }
>
> @@ -699,7 +699,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
> cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE;
> }
> hecc_set_bit(priv, HECC_CANES, HECC_CANES_EP);
> - dev_dbg(priv->ndev->dev.parent, "Error passive interrupt\n");
> + netdev_dbg(priv->ndev, "Error passive interrupt\n");
> hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
> }
>
> @@ -824,7 +824,7 @@ static int ti_hecc_open(struct net_device *ndev)
> err = request_irq(ndev->irq, ti_hecc_interrupt, IRQF_SHARED,
> ndev->name, ndev);
> if (err) {
> - dev_err(ndev->dev.parent, "error requesting interrupt\n");
> + netdev_err(ndev, "error requesting interrupt\n");
> return err;
> }
>
> @@ -833,7 +833,7 @@ static int ti_hecc_open(struct net_device *ndev)
> /* Open common can device */
> err = open_candev(ndev);
> if (err) {
> - dev_err(ndev->dev.parent, "open_candev() failed %d\n", err);
> + netdev_err(ndev, "open_candev() failed %d\n", err);
> ti_hecc_transceiver_switch(priv, 0);
> free_irq(ndev->irq, ndev);
> return err;
> diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
> index a72c7bf..bf088b5 100644
> --- a/drivers/net/can/usb/ems_usb.c
> +++ b/drivers/net/can/usb/ems_usb.c
> @@ -288,8 +288,7 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
> return;
>
> default:
> - dev_info(netdev->dev.parent, "Rx interrupt aborted %d\n",
> - urb->status);
> + netdev_info(netdev, "Rx interrupt aborted %d\n", urb->status);
> break;
> }
>
> @@ -298,8 +297,7 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
> if (err == -ENODEV)
> netif_device_detach(netdev);
> else if (err)
> - dev_err(netdev->dev.parent,
> - "failed resubmitting intr urb: %d\n", err);
> + netdev_err(netdev, "failed resubmitting intr urb: %d\n", err);
> }
>
> static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg)
> @@ -431,8 +429,7 @@ static void ems_usb_read_bulk_callback(struct urb *urb)
> return;
>
> default:
> - dev_info(netdev->dev.parent, "Rx URB aborted (%d)\n",
> - urb->status);
> + netdev_info(netdev, "Rx URB aborted (%d)\n", urb->status);
> goto resubmit_urb;
> }
>
> @@ -477,7 +474,7 @@ static void ems_usb_read_bulk_callback(struct urb *urb)
> msg_count--;
>
> if (start> urb->transfer_buffer_length) {
> - dev_err(netdev->dev.parent, "format error\n");
> + netdev_err(netdev, "format error\n");
> break;
> }
> }
> @@ -493,8 +490,8 @@ resubmit_urb:
> if (retval == -ENODEV)
> netif_device_detach(netdev);
> else if (retval)
> - dev_err(netdev->dev.parent,
> - "failed resubmitting read bulk urb: %d\n", retval);
> + netdev_err(netdev,
> + "failed resubmitting read bulk urb: %d\n", retval);
> }
>
> /*
> @@ -521,8 +518,7 @@ static void ems_usb_write_bulk_callback(struct urb *urb)
> return;
>
> if (urb->status)
> - dev_info(netdev->dev.parent, "Tx URB aborted (%d)\n",
> - urb->status);
> + netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status);
>
> netdev->trans_start = jiffies;
>
> @@ -605,16 +601,14 @@ static int ems_usb_start(struct ems_usb *dev)
> /* create a URB, and a buffer for it */
> urb = usb_alloc_urb(0, GFP_KERNEL);
> if (!urb) {
> - dev_err(netdev->dev.parent,
> - "No memory left for URBs\n");
> + netdev_err(netdev, "No memory left for URBs\n");
> return -ENOMEM;
> }
>
> buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL,
> &urb->transfer_dma);
> if (!buf) {
> - dev_err(netdev->dev.parent,
> - "No memory left for USB buffer\n");
> + netdev_err(netdev, "No memory left for USB buffer\n");
> usb_free_urb(urb);
> return -ENOMEM;
> }
> @@ -642,13 +636,13 @@ static int ems_usb_start(struct ems_usb *dev)
>
> /* Did we submit any URBs */
> if (i == 0) {
> - dev_warn(netdev->dev.parent, "couldn't setup read URBs\n");
> + netdev_warn(netdev, "couldn't setup read URBs\n");
> return err;
> }
>
> /* Warn if we've couldn't transmit all the URBs */
> if (i< MAX_RX_URBS)
> - dev_warn(netdev->dev.parent, "rx performance may be slow\n");
> + netdev_warn(netdev, "rx performance may be slow\n");
>
> /* Setup and start interrupt URB */
> usb_fill_int_urb(dev->intr_urb, dev->udev,
> @@ -662,8 +656,7 @@ static int ems_usb_start(struct ems_usb *dev)
> if (err == -ENODEV)
> netif_device_detach(dev->netdev);
>
> - dev_warn(netdev->dev.parent, "intr URB submit failed: %d\n",
> - err);
> + netdev_warn(netdev, "intr URB submit failed: %d\n", err);
>
> return err;
> }
> @@ -695,7 +688,7 @@ failed:
> if (err == -ENODEV)
> netif_device_detach(dev->netdev);
>
> - dev_warn(netdev->dev.parent, "couldn't submit control: %d\n", err);
> + netdev_warn(netdev, "couldn't submit control: %d\n", err);
>
> return err;
> }
> @@ -735,8 +728,7 @@ static int ems_usb_open(struct net_device *netdev)
> if (err == -ENODEV)
> netif_device_detach(dev->netdev);
>
> - dev_warn(netdev->dev.parent, "couldn't start device: %d\n",
> - err);
> + netdev_warn(netdev, "couldn't start device: %d\n", err);
>
> close_candev(netdev);
>
> @@ -769,13 +761,13 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
> /* create a URB, and a buffer for it, and copy the data to the URB */
> urb = usb_alloc_urb(0, GFP_ATOMIC);
> if (!urb) {
> - dev_err(netdev->dev.parent, "No memory left for URBs\n");
> + netdev_err(netdev, "No memory left for URBs\n");
> goto nomem;
> }
>
> buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC,&urb->transfer_dma);
> if (!buf) {
> - dev_err(netdev->dev.parent, "No memory left for USB buffer\n");
> + netdev_err(netdev, "No memory left for USB buffer\n");
> usb_free_urb(urb);
> goto nomem;
> }
> @@ -818,7 +810,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
> usb_unanchor_urb(urb);
> usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
>
> - dev_warn(netdev->dev.parent, "couldn't find free context\n");
> + netdev_warn(netdev, "couldn't find free context\n");
>
> return NETDEV_TX_BUSY;
> }
> @@ -849,7 +841,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
> if (err == -ENODEV) {
> netif_device_detach(netdev);
> } else {
> - dev_warn(netdev->dev.parent, "failed tx_urb %d\n", err);
> + netdev_warn(netdev, "failed tx_urb %d\n", err);
>
> stats->tx_dropped++;
> }
> @@ -889,7 +881,7 @@ static int ems_usb_close(struct net_device *netdev)
>
> /* Set CAN controller to reset mode */
> if (ems_usb_write_mode(dev, SJA1000_MOD_RM))
> - dev_warn(netdev->dev.parent, "couldn't stop device");
> + netdev_warn(netdev, "couldn't stop device");
>
> close_candev(netdev);
>
> @@ -926,7 +918,7 @@ static int ems_usb_set_mode(struct net_device *netdev, enum can_mode mode)
> switch (mode) {
> case CAN_MODE_START:
> if (ems_usb_write_mode(dev, SJA1000_MOD_NORMAL))
> - dev_warn(netdev->dev.parent, "couldn't start device");
> + netdev_warn(netdev, "couldn't start device");
>
> if (netif_queue_stopped(netdev))
> netif_wake_queue(netdev);
> @@ -951,8 +943,7 @@ static int ems_usb_set_bittiming(struct net_device *netdev)
> if (dev->can.ctrlmode& CAN_CTRLMODE_3_SAMPLES)
> btr1 |= 0x80;
>
> - dev_info(netdev->dev.parent, "setting BTR0=0x%02x BTR1=0x%02x\n",
> - btr0, btr1);
> + netdev_info(netdev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
>
> dev->active_params.msg.can_params.cc_params.sja1000.btr0 = btr0;
> dev->active_params.msg.can_params.cc_params.sja1000.btr1 = btr1;
> @@ -1057,15 +1048,13 @@ static int ems_usb_probe(struct usb_interface *intf,
>
> err = ems_usb_command_msg(dev,&dev->active_params);
> if (err) {
> - dev_err(netdev->dev.parent,
> - "couldn't initialize controller: %d\n", err);
> + netdev_err(netdev, "couldn't initialize controller: %d\n", err);
> goto cleanup_tx_msg_buffer;
> }
>
> err = register_candev(netdev);
> if (err) {
> - dev_err(netdev->dev.parent,
> - "couldn't register CAN device: %d\n", err);
> + netdev_err(netdev, "couldn't register CAN device: %d\n", err);
> goto cleanup_tx_msg_buffer;
> }
>
> diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
> index eb8b0e6..6f3fafb 100644
> --- a/drivers/net/can/usb/esd_usb2.c
> +++ b/drivers/net/can/usb/esd_usb2.c
> @@ -470,8 +470,7 @@ static void esd_usb2_write_bulk_callback(struct urb *urb)
> return;
>
> if (urb->status)
> - dev_info(netdev->dev.parent, "Tx URB aborted (%d)\n",
> - urb->status);
> + netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status);
>
> netdev->trans_start = jiffies;
> }
> @@ -651,7 +650,7 @@ failed:
> if (err == -ENODEV)
> netif_device_detach(netdev);
>
> - dev_err(netdev->dev.parent, "couldn't start device: %d\n", err);
> + netdev_err(netdev, "couldn't start device: %d\n", err);
>
> return err;
> }
> @@ -687,8 +686,7 @@ static int esd_usb2_open(struct net_device *netdev)
> /* finally start device */
> err = esd_usb2_start(priv);
> if (err) {
> - dev_warn(netdev->dev.parent,
> - "couldn't start device: %d\n", err);
> + netdev_warn(netdev, "couldn't start device: %d\n", err);
> close_candev(netdev);
> return err;
> }
> @@ -721,7 +719,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
> /* create a URB, and a buffer for it, and copy the data to the URB */
> urb = usb_alloc_urb(0, GFP_ATOMIC);
> if (!urb) {
> - dev_err(netdev->dev.parent, "No memory left for URBs\n");
> + netdev_err(netdev, "No memory left for URBs\n");
> stats->tx_dropped++;
> dev_kfree_skb(skb);
> goto nourbmem;
> @@ -730,7 +728,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
> buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC,
> &urb->transfer_dma);
> if (!buf) {
> - dev_err(netdev->dev.parent, "No memory left for USB buffer\n");
> + netdev_err(netdev, "No memory left for USB buffer\n");
> stats->tx_dropped++;
> dev_kfree_skb(skb);
> goto nobufmem;
> @@ -766,7 +764,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
> * This may never happen.
> */
> if (!context) {
> - dev_warn(netdev->dev.parent, "couldn't find free context\n");
> + netdev_warn(netdev, "couldn't find free context\n");
> ret = NETDEV_TX_BUSY;
> goto releasebuf;
> }
> @@ -806,7 +804,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
> if (err == -ENODEV)
> netif_device_detach(netdev);
> else
> - dev_warn(netdev->dev.parent, "failed tx_urb %d\n", err);
> + netdev_warn(netdev, "failed tx_urb %d\n", err);
>
> goto releasebuf;
> }
> @@ -845,7 +843,7 @@ static int esd_usb2_close(struct net_device *netdev)
> for (i = 0; i<= ESD_MAX_ID_SEGMENT; i++)
> msg.msg.filter.mask[i] = 0;
> if (esd_usb2_send_msg(priv->usb2,&msg)< 0)
> - dev_err(netdev->dev.parent, "sending idadd message failed\n");
> + netdev_err(netdev, "sending idadd message failed\n");
>
> /* set CAN controller to reset mode */
> msg.msg.hdr.len = 2;
> @@ -854,7 +852,7 @@ static int esd_usb2_close(struct net_device *netdev)
> msg.msg.setbaud.rsvd = 0;
> msg.msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE);
> if (esd_usb2_send_msg(priv->usb2,&msg)< 0)
> - dev_err(netdev->dev.parent, "sending setbaud message failed\n");
> + netdev_err(netdev, "sending setbaud message failed\n");
>
> priv->can.state = CAN_STATE_STOPPED;
>
> @@ -910,7 +908,7 @@ static int esd_usb2_set_bittiming(struct net_device *netdev)
> msg.msg.setbaud.rsvd = 0;
> msg.msg.setbaud.baud = cpu_to_le32(canbtr);
>
> - dev_info(netdev->dev.parent, "setting BTR=%#x\n", canbtr);
> + netdev_info(netdev, "setting BTR=%#x\n", canbtr);
>
> return esd_usb2_send_msg(priv->usb2,&msg);
> }
> @@ -988,15 +986,14 @@ static int esd_usb2_probe_one_net(struct usb_interface *intf, int index)
>
> err = register_candev(netdev);
> if (err) {
> - dev_err(&intf->dev,
> - "couldn't register CAN device: %d\n", err);
> + dev_err(&intf->dev, "couldn't register CAN device: %d\n", err);
> free_candev(netdev);
> err = -ENOMEM;
> goto done;
> }
>
> dev->nets[index] = priv;
> - dev_info(netdev->dev.parent, "device %s registered\n", netdev->name);
> + netdev_info(netdev, "device %s registered\n", netdev->name);
>
> done:
> return err;
^ permalink raw reply
* bnx2x firmware version 6.x.y
From: Ben Hutchings @ 2011-12-17 16:52 UTC (permalink / raw)
To: Eilon Greenstein, Dmitry Kravkov, Vladislav Zolotarov
Cc: LKML, netdev, David Woodhouse
[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]
In general, linux-firmware includes all blobs that any released version
of a driver may need.
Therefore, I'm about to add the bnx2x firmware versions 6.0.34.0,
6.2.5.0 and 6.2.9.0 (taken from kernel versions 2.6.37, 2.6.38 and 3.0
respectively) into linux-firmware.
The full lists of bnx2x firmware blobs that will be included after this
is:
bnx2x-e1-4.8.53.0.fw
bnx2x-e1-5.2.13.0.fw
bnx2x-e1-5.2.7.0.fw
bnx2x-e1h-4.8.53.0.fw
bnx2x-e1h-5.2.13.0.fw
bnx2x-e1h-5.2.7.0.fw
bnx2x/bnx2x-e1-6.0.34.0.fw
bnx2x/bnx2x-e1-6.2.5.0.fw
bnx2x/bnx2x-e1-6.2.9.0.fw
bnx2x/bnx2x-e1-7.0.20.0.fw
bnx2x/bnx2x-e1-7.0.23.0.fw
bnx2x/bnx2x-e1-7.0.29.0.fw
bnx2x/bnx2x-e1h-6.0.34.0.fw
bnx2x/bnx2x-e1h-6.2.5.0.fw
bnx2x/bnx2x-e1h-6.2.9.0.fw
bnx2x/bnx2x-e1h-7.0.20.0.fw
bnx2x/bnx2x-e1h-7.0.23.0.fw
bnx2x/bnx2x-e1h-7.0.29.0.fw
bnx2x/bnx2x-e2-6.0.34.0.fw
bnx2x/bnx2x-e2-6.2.5.0.fw
bnx2x/bnx2x-e2-6.2.9.0.fw
bnx2x/bnx2x-e2-7.0.20.0.fw
bnx2x/bnx2x-e2-7.0.23.0.fw
bnx2x/bnx2x-e2-7.0.29.0.fw
Ben.
--
Ben Hutchings
Computers are not intelligent. They only think they are.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: [PATCH net-next] r8169: Support for byte queue limits
From: Igor Maravić @ 2011-12-17 17:28 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, davem
In-Reply-To: <1324071003.2621.33.camel@edumazet-laptop>
> Why here in rtl8169_xmit_frags() ?
>
> If done from rtl8169_start_xmit(), you already have "dev" pointer.
>
> netdev_sent_queue(dev, skb->len);
>
I put it there because actual dma maping is occurring in that function.
Logically there is no difference if I put it after calling of function
rtl8169_xmit_frags() in rtl8169_start_xmit().
If You think it would be better to be in function rtl8169_start_xmit,
for performance reasons I'l put it there.
In any case I'l resubmit this patch in Monday. After all it's Saturday :)
BR
Igor
^ permalink raw reply
* Re: [PATCH] 9p: Don't use ATTR_* values from fs.h in userspace facing structs
From: Al Viro @ 2011-12-17 17:47 UTC (permalink / raw)
To: Sasha Levin
Cc: ericvh, rminnich, lucho, davem, aneesh.kumar, jvrao,
v9fs-developer, netdev, linux-kernel
In-Reply-To: <1324134422-16642-1-git-send-email-levinsasha928@gmail.com>
On Sat, Dec 17, 2011 at 05:07:02PM +0200, Sasha Levin wrote:
> struct p9_iattr_dotl is userspace facing, but the 'valid' field is documented
> as follows:
>
> * @valid: bitfield specifying which fields are valid
> * same as in struct iattr
>
> Which means that the user has to know about kernel internal ATTR_* values.
>
> On Fri, 2011-12-16 at 23:30 +0000, Al Viro wrote:
> > They *are* kernel internal values and 9P is asking for trouble exposing
> > them. Translation: tomorrow we might reassign those as we bloody wish
> > and any userland code that happens to rely on their values will break.
> > At which point we'll handle complaints by pointing and laughing.
> >
> > It's a 9P bug; fix it there. Turning random internal constants into a part
> > of ABI is not going to work.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
> fs/9p/vfs_inode_dotl.c | 31 ++++++++++++++++++++++++++++++-
> include/net/9p/9p.h | 18 ++++++++++++++++++
> 2 files changed, 48 insertions(+), 1 deletions(-)
>
> diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
> index 0b5745e..a948214 100644
> --- a/fs/9p/vfs_inode_dotl.c
> +++ b/fs/9p/vfs_inode_dotl.c
> @@ -523,6 +523,35 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
> return 0;
> }
>
> +int v9fs_vfs_iattr_to_9p_valid(u32 ia_valid)
> +{
> + u32 valid = 0, i;
> + static u32 attr_map[][2] = {
> + {ATTR_MODE, P9_ATTR_MODE},
> + {ATTR_UID, P9_ATTR_UID},
> + {ATTR_SIZE, P9_ATTR_SIZE},
> + {ATTR_ATIME, P9_ATTR_ATIME},
> + {ATTR_MTIME, P9_ATTR_MTIME},
> + {ATTR_CTIME, P9_ATTR_CTIME},
> + {ATTR_ATIME_SET, P9_ATTR_ATIME_SET},
> + {ATTR_MTIME_SET, P9_ATTR_MTIME_SET},
> + {ATTR_FORCE, P9_ATTR_FORCE},
> + {ATTR_ATTR_FLAG, P9_ATTR_ATTR_FLAG},
> + {ATTR_KILL_SUID, P9_ATTR_KILL_SUID},
> + {ATTR_KILL_SGID, P9_ATTR_KILL_SGID},
> + {ATTR_FILE, P9_ATTR_FILE},
> + {ATTR_KILL_PRIV, P9_ATTR_KILL_PRIV},
> + {ATTR_OPEN, P9_ATTR_OPEN},
> + {ATTR_TIMES_SET, P9_ATTR_TIMES_SET},
> + };
a) ATTR_GID is lost
b) passing ATTR_FILE is bloody pointless; look at what it does and
realize that 9p doesn't as much as look at ia_file.
c) ATTR_KILL_PRIV is very dubious; what's the legitimate use of that
puppy in fs code?
Look, that's the problem with exposing this stuff to protocol; you don't
get clear semantics and are you seriously asking for trouble on kernel
changes. Suppose tomorrow we get rid of e.g. ATTR_KILL_PRIV; what are you
guys going to do? Hope that no 9p server has behaviour dependent on that
flag being set or cleared?
Don't turn the kernel internals into a part of ABI. And blind bulk remapping
of constants is exactly that...
^ permalink raw reply
* Re: [PATCH] 9p: Don't use ATTR_* values from fs.h in userspace facing structs
From: Sasha Levin @ 2011-12-17 18:04 UTC (permalink / raw)
To: Al Viro
Cc: ericvh, rminnich, lucho, davem, aneesh.kumar, jvrao,
v9fs-developer, netdev, linux-kernel
In-Reply-To: <20111217174725.GW2203@ZenIV.linux.org.uk>
On Sat, 2011-12-17 at 17:47 +0000, Al Viro wrote:
> Look, that's the problem with exposing this stuff to protocol; you don't
> get clear semantics and are you seriously asking for trouble on kernel
> changes. Suppose tomorrow we get rid of e.g. ATTR_KILL_PRIV; what are you
> guys going to do? Hope that no 9p server has behaviour dependent on that
> flag being set or cleared?
>
> Don't turn the kernel internals into a part of ABI. And blind bulk remapping
> of constants is exactly that...
I went with Aneesh's suggestion and did something similar to something
9p already has done before.
This is probably a good opportunity to open it up for discussion, since
I currently have a block of code containing those ATTR_* defines
copy-pasted from linux/fs.h in my userspace code, and thats obviously a
serious wtf.
--
Sasha.
^ permalink raw reply
* Re: Latency guarantees in HFSC rt service curves
From: Michal Soltys @ 2011-12-17 18:40 UTC (permalink / raw)
To: John A. Sullivan III; +Cc: netdev
In-Reply-To: <1323934716.8451.272.camel@denise.theartistscloset.com>
Sorry for late reply.
On 15.12.2011 08:38, John A. Sullivan III wrote:
> Yes, granted. What I'm trying to do in the documentation is translate
> the model's mathematical concepts into concepts more germane to
> system > administrators. A sys admin is not very likely to think in
> terms of > deadline times but will think, "I've got a momentary
> boost in > bandwidth to allow me to ensure proper latency for time
> sensitive > traffic." Of course, that could be where I'm getting in
> trouble :)
Tough to say. I'd say you can't completely avoid math here (I'm not
saying not to trim it a bit though). In the same way one can't really go
through TBF without understanding what token bucket is. Well, the
complexity of both is on different level, but you see my point.
>> Whole RT design - with eligible/deadline split - is to allow convex
>> curves to send "earlier", pushing the deadlines to the "right" -
>> which in turn allows newly backlogged class to have brief priority.
>> But it all remains under interface limit and over-time fulfills
>> guarantees (even if locally they are violated).
> To the right? I would have thought to the left on the x axis, i.e.,
> the deadline time becomes sooner? Ah, unless you are referring to the
> other queue's deadline times and mean not literally changing the
> deadline time but jumping in front of the ones on the right of the new
> queue's deadline time.
I mean - for convex curves - deadlines are further to the right, as such
class is eligible earlier (for convex curves, eligible is just linear m2
without m1 part), thus => receive more service => deadline projection is
shifted to the right. When some other concave curve becomes active, its
deadlines will be naturally preferred if both curves are eligible.
> The thought behind oversubscribing m1 . . . well . . . not
> intentionally oversubscribing - just not being very careful about
> setting m1 to make sure it is not oversubscribed (perhaps I wasn't
> clear that the oversubscription is not intentional) - is that it is
> not likely that all queues are continually backlogged thus I can get
> away with an accidental over-allocation in most cases as it will
> quickly sort itself out as soon as a queue goes idle. As a result, I
> can calculate m1 solely based upon the latency requirements of the
> traffic not accounting for the impact of the bandwidth momentarily
> required to do that, i.e., not being too concerned if I have
> accidentally oversubscribed m1.
Well, that's one way to do it. If your aim is that say certain n% of
leaves are used at the same time (with rare exceptions), you could set
RT curves (m1 parts) as if you had less leaves. If you leave m2 alone
and don't care about mentioned exceptions, it should work.
But IMHO that's more like a corner case (with alternative solutions
available), than a "cookbook" recommendation.
> The advantages of doing it via the m1 portion of the rt curve rather
> than the ls curve are:
>
> 1) It is guaranteed whereas the ls will only work when there is
> available bandwidth. Granted, my assumption that it is rare for all
> classes to be continually backlogged implies there is always some
> extra bandwidth available. And granted that it is not guaranteed if
> too many oversubscribed m1's kick in at the same time.
>
> 2) It seems less complicated than trying to figure out what my
> possibly available ls ratios should be to meet my latency requirements
> (which then also recouples bandwidth and latency). m1 is much more
> direct and reliable.
Like mentioned above - it's one way to do things and you're right. But
I think you might be underestimating LS a bit. By its nature, it
schedules at speed normalized to the interface's capacity after all (or
UL limits, if applicable) - so the less of the classes are acutally
active, the more they get from LS. You mentioned earlier that you saw LS
being more aggressive in allocating bandwidth - maybe that was the
effect you were seeing ?
^ permalink raw reply
* Re: Latency guarantees in HFSC rt service curves
From: John A. Sullivan III @ 2011-12-17 20:41 UTC (permalink / raw)
To: Michal Soltys; +Cc: netdev
In-Reply-To: <4EECE224.90800@ziu.info>
On Sat, 2011-12-17 at 19:40 +0100, Michal Soltys wrote:
> Sorry for late reply.
No problem - you're my lifeline on this so any response is greatly
appreciated!
>
> On 15.12.2011 08:38, John A. Sullivan III wrote:
>
<snip>
> > The advantages of doing it via the m1 portion of the rt curve rather
> > than the ls curve are:
> >
> > 1) It is guaranteed whereas the ls will only work when there is
> > available bandwidth. Granted, my assumption that it is rare for all
> > classes to be continually backlogged implies there is always some
> > extra bandwidth available. And granted that it is not guaranteed if
> > too many oversubscribed m1's kick in at the same time.
> >
> > 2) It seems less complicated than trying to figure out what my
> > possibly available ls ratios should be to meet my latency requirements
> > (which then also recouples bandwidth and latency). m1 is much more
> > direct and reliable.
>
> Like mentioned above - it's one way to do things and you're right. But
> I think you might be underestimating LS a bit. By its nature, it
> schedules at speed normalized to the interface's capacity after all (or
> UL limits, if applicable) - so the less of the classes are acutally
> active, the more they get from LS. You mentioned earlier that you saw LS
> being more aggressive in allocating bandwidth - maybe that was the
> effect you were seeing ?
I think this is the crux right here. As I think it through, I'm
probably just raising a tempest in a tea pot by my ignorance so I think
I'll stop here and just implement what you have advised. I'll outline
the way I was thinking below just in case it does have merit and should
not be discarded.
I think LS can be used to do it but here is how I instinctively (and
perhaps erroneously) viewed rt m1, rt m2 and ls. I thought, rt m2 are
my sustained guarantees so, what I'll do is divide all my available
bandwidth across all my various traffic flows via rt m2. This reflects
that I was planning to use ls in a different way. My thinking was that
rt m2 reflects how I want the bandwidth allocated if all queues are
backlogged and hence why I matched the sum of the rt m2 curves to the
total available bandwidth.
However, constant backlog is not likely to be the case most of the time.
When it is not, that's where I used ls curves. So, when they are all
backlogged, I have tight control over how I have allocated all the
bandwidth. When they are not, I have a separate control (the ls curves)
which can be used to allocate that extra bandwidth in ratios completely
different from the rt m2 ratios if that is appropriate (as it is likely
to be).
Notice at this point, I have only considered bandwidth and have used the
rt m2 curves and the ls curves solely as bandwidth control mechanisms.
This is where I decided I might want to bend the rules and, if m2 does
not provide sufficiently low latency, I would add an m1 curve to
guarantee that latency. Since the m2 curves add up to the total
available bandwidth, by definition my higher m1 curves are going to
exceed it but that's OK because the queues are not all backlogged most
of the time.
Thus rt m1 and ls are doing the same thing in the sense that they are
allocated with the assumption that not all queues are backlogged
(because, in my scenario, if all queues are backlogged, we will
eventually be using exclusively rt m2 curves), but they are tuned
differently. rt m1 is tuned for latency and takes precedence whereas ls
is tuned for bandwidth as long as I don't need the extra bandwidth to
meet the rt m1 guarantees.
So, that was my newbie thinking. It sounds like what I should really do
is target my rt m2 curves for truly minimum needed bandwidth, tune my rt
m1 curves for latency, ensure the sum of the greater of the m1 or m2 rt
curves does not exceed total bandwidth, and then use ls to allocate
anything left over.
So, sorry for all the gyrations. Unless anyone tells me differently,
I'll use that last paragraph as my summary guidelines. Thanks - John
^ permalink raw reply
* [PATCH] net: bpf_jit: fix an off-one bug in x86_64 cond jump target
From: Eric Dumazet @ 2011-12-17 21:39 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Markus
From: Markus Kötter <nepenthesdev@gmail.com>
x86 jump instruction size is 2 or 5 bytes (near/long jump), not 2 or 6
bytes.
In case a conditional jump is followed by a long jump, conditional jump
target is one byte past the start of target instruction.
Signed-off-by: Markus Kötter <nepenthesdev@gmail.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
libpcap expression to reproduce the bug :
"(tcp and portrange 0-1024) or (udp and portrange 1025-2048)"
arch/x86/net/bpf_jit_comp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index bfab3fa..7b65f75 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -568,8 +568,8 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
break;
}
if (filter[i].jt != 0) {
- if (filter[i].jf)
- t_offset += is_near(f_offset) ? 2 : 6;
+ if (filter[i].jf && f_offset)
+ t_offset += is_near(f_offset) ? 2 : 5;
EMIT_COND_JMP(t_op, t_offset);
if (filter[i].jf)
EMIT_JMP(f_offset);
^ permalink raw reply related
* Re: [PATCH 01/11] SYSCTL: export root and set handling routines
From: Eric W. Biederman @ 2011-12-17 22:25 UTC (permalink / raw)
To: Stanislav Kinsbursky
Cc: Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA,
linux-nfs-u79uwXL29TY76Z2rM5mHXA, xemul-bzQdu9zFT3WakBO8gow8eQ,
neilb-l3A5Bk7waGM, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
jbottomley-bzQdu9zFT3WakBO8gow8eQ, bfields-uC3wQj2KruNg9hUCZPvPmw,
davem-fT/PcQaiUtIeIZ0/mPfg9Q, devel-GEFAQzZX7r8dnm+yROfE0A
In-Reply-To: <20111214104449.3991.61989.stgit-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
Stanislav Kinsbursky <skinsbursky-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> writes:
> These routines are required for making SUNRPC sysctl's per network namespace
> context.
Why does sunrpc require it's own sysctl root? You should be able to use
the generic per network namespace root and call it good.
What makes register_net_sysctl_table and register_net_sysctl_ro_table
unsuitable for sunrpc. I skimmed through your patches and I haven't
seen anything obvious.
Eric
> Signed-off-by: Stanislav Kinsbursky <skinsbursky-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
>
> ---
> include/linux/sysctl.h | 1 +
> kernel/sysctl.c | 11 +++++++++++
> 2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index 703cfa3..be586a9 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -1084,6 +1084,7 @@ struct ctl_path {
> };
>
> void register_sysctl_root(struct ctl_table_root *root);
> +void unregister_sysctl_root(struct ctl_table_root *root);
> struct ctl_table_header *__register_sysctl_paths(
> struct ctl_table_root *root, struct nsproxy *namespaces,
> const struct ctl_path *path, struct ctl_table *table);
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index ae27196..fb016a9 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -1700,6 +1700,15 @@ void register_sysctl_root(struct ctl_table_root *root)
> list_add_tail(&root->root_list, &sysctl_table_root.root_list);
> spin_unlock(&sysctl_lock);
> }
> +EXPORT_SYMBOL_GPL(register_sysctl_root);
> +
> +void unregister_sysctl_root(struct ctl_table_root *root)
> +{
> + spin_lock(&sysctl_lock);
> + list_del(&root->root_list);
> + spin_unlock(&sysctl_lock);
> +}
> +EXPORT_SYMBOL_GPL(unregister_sysctl_root);
>
> /*
> * sysctl_perm does NOT grant the superuser all rights automatically, because
> @@ -1925,6 +1934,7 @@ struct ctl_table_header *__register_sysctl_paths(
>
> return header;
> }
> +EXPORT_SYMBOL_GPL(__register_sysctl_paths);
>
> /**
> * register_sysctl_table_path - register a sysctl table hierarchy
> @@ -2007,6 +2017,7 @@ void setup_sysctl_set(struct ctl_table_set *p,
> p->parent = parent ? parent : &sysctl_table_root.default_set;
> p->is_seen = is_seen;
> }
> +EXPORT_SYMBOL_GPL(setup_sysctl_set);
>
> #else /* !CONFIG_SYSCTL */
> struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 0/2] Tracepoint for tcp retransmission
From: Hagen Paul Pfeifer @ 2011-12-18 0:49 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Satoru Moriya, nhorman, davem, tgraf, Seiji Aguchi, dle-develop,
netdev
In-Reply-To: <5f654c7d-f18e-4d70-8830-a3e31b8f5f4a@tahiti.vyatta.com>
> Sometimes network packets are dropped for some reason. In enterprise
> systems which require strict RAS functionality, we must know the
> reason why it happened and explain it to our customers even if using
> TCP. When we investigate the incidents, at first we try to find out
> whether the problem is in the server(kernel, application) or else
> (router, hub etc). And next we try to find out which layer
> (application/middleware/kernel(IP/TCP/UDP/..)etc.) the problem
> occurs.
For the first question tcpdump may the right tool. For the later systemtap can
be used. I mean we now have the possibility to instrument the kernel at runtime,
without bloating the source. Anyway: is 63e03724b51 not suitable to gather the
required information easily?
Hagen
^ permalink raw reply
* [PATCH] net: meth: Add set_rx_mode hook to fix ICMPv6 neighbor discovery
From: Joshua Kinard @ 2011-12-18 0:56 UTC (permalink / raw)
To: netdev, Linux MIPS List
SGI IP32 (O2)'s ethernet driver (meth) lacks a set_rx_mode function, which
prevents IPv6 from working completely because any ICMPv6 neighbor
solicitation requests aren't picked up by the driver. So the machine can
ping out and connect to other systems, but other systems will have a very
hard time connecting to the O2.
Signed-off-by: Joshua Kinard <kumba@gentoo.org>
---
drivers/net/ethernet/sgi/meth.c | 60 +++++++++++++++++++++++++++++++++++-----
1 file changed, 53 insertions(+), 7 deletions(-)
--- a/drivers/net/ethernet/sgi/meth.c 2011-12-17 15:51:44.569166824 -0500
+++ b/drivers/net/ethernet/sgi/meth.c 2011-12-17 15:51:20.259167050 -0500
@@ -28,6 +28,7 @@
#include <linux/tcp.h> /* struct tcphdr */
#include <linux/skbuff.h>
#include <linux/mii.h> /* MII definitions */
+#include <linux/crc32.h>
#include <asm/ip32/mace.h>
#include <asm/ip32/ip32_ints.h>
@@ -57,6 +58,12 @@ static const char *meth_str="SGI O2 Fast
static int timeout = TX_TIMEOUT;
module_param(timeout, int, 0);
+/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
+ * MACE Ethernet uses a 64 element hash table based on the Ethernet CRC.
+ */
+static int multicast_filter_limit = 32;
+
+
/*
* This structure is private to each device. It is used to pass
* packets in and out, so there is place for a packet
@@ -79,6 +86,9 @@ struct meth_private {
struct sk_buff *rx_skbs[RX_RING_ENTRIES];
unsigned long rx_write;
+ /* Multicast filter. */
+ unsigned long mcast_filter;
+
spinlock_t meth_lock;
};
@@ -765,15 +775,51 @@ static int meth_ioctl(struct net_device
}
}
+static void meth_set_rx_mode(struct net_device *dev)
+{
+ struct meth_private *priv = netdev_priv(dev);
+ unsigned long flags;
+
+ netif_stop_queue(dev);
+ spin_lock_irqsave(&priv->meth_lock, flags);
+ priv->mac_ctrl &= ~(METH_PROMISC);
+
+ if (dev->flags & IFF_PROMISC) {
+ priv->mac_ctrl |= METH_PROMISC;
+ priv->mcast_filter = 0xffffffffffffffffUL;
+ mace->eth.mac_ctrl = priv->mac_ctrl;
+ mace->eth.mcast_filter = priv->mcast_filter;
+ } else if ((netdev_mc_count(dev) > multicast_filter_limit) ||
+ (dev->flags & IFF_ALLMULTI)) {
+ priv->mac_ctrl |= METH_ACCEPT_AMCAST;
+ priv->mcast_filter = 0xffffffffffffffffUL;
+ mace->eth.mac_ctrl = priv->mac_ctrl;
+ mace->eth.mcast_filter = priv->mcast_filter;
+ } else {
+ struct netdev_hw_addr *ha;
+ priv->mac_ctrl |= METH_ACCEPT_MCAST;
+
+ netdev_for_each_mc_addr(ha, dev)
+ set_bit((ether_crc(ETH_ALEN, ha->addr) >> 26),
+ (volatile long unsigned int *)&priv->mcast_filter);
+
+ mace->eth.mcast_filter = priv->mcast_filter;
+ }
+
+ spin_unlock_irqrestore(&priv->meth_lock, flags);
+ netif_wake_queue(dev);
+}
+
static const struct net_device_ops meth_netdev_ops = {
- .ndo_open = meth_open,
- .ndo_stop = meth_release,
- .ndo_start_xmit = meth_tx,
- .ndo_do_ioctl = meth_ioctl,
- .ndo_tx_timeout = meth_tx_timeout,
- .ndo_change_mtu = eth_change_mtu,
- .ndo_validate_addr = eth_validate_addr,
+ .ndo_open = meth_open,
+ .ndo_stop = meth_release,
+ .ndo_start_xmit = meth_tx,
+ .ndo_do_ioctl = meth_ioctl,
+ .ndo_tx_timeout = meth_tx_timeout,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
+ .ndo_set_rx_mode = meth_set_rx_mode,
};
/*
^ permalink raw reply
* [PATCH] net: meth: Some code cleanups for meth
From: Joshua Kinard @ 2011-12-18 1:27 UTC (permalink / raw)
To: netdev, Linux MIPS List
Clean up meth.h a fair bit, including replacing the copyright header with
one more appropriate for the kernel, including the original author. Some
minor cleanups were also done to meth.c, but more could be used down the road.
Signed-off-by: Joshua Kinard <kumba@gentoo.org>
---
drivers/net/ethernet/sgi/meth.c | 42 ++-
drivers/net/ethernet/sgi/meth.h | 440 ++++++++++++++++++++++++++--------------
2 files changed, 319 insertions(+), 163 deletions(-)
--- a/drivers/net/ethernet/sgi/meth.c 2011-12-17 16:01:20.729161498 -0500
+++ b/drivers/net/ethernet/sgi/meth.c 2011-12-17 16:03:38.189160228 -0500
@@ -71,16 +71,21 @@ static int multicast_filter_limit = 32;
struct meth_private {
/* in-memory copy of MAC Control register */
unsigned long mac_ctrl;
+
/* in-memory copy of DMA Control register */
unsigned long dma_ctrl;
+
/* address of PHY, used by mdio_* functions, initialized in mdio_probe */
unsigned long phy_addr;
+
+ /* TX stuff. */
tx_packet *tx_ring;
dma_addr_t tx_ring_dma;
struct sk_buff *tx_skbs[TX_RING_ENTRIES];
dma_addr_t tx_skb_dmas[TX_RING_ENTRIES];
unsigned long tx_read, tx_write, tx_count;
+ /* RX stuff. */
rx_packet *rx_ring[RX_RING_ENTRIES];
dma_addr_t rx_ring_dmas[RX_RING_ENTRIES];
struct sk_buff *rx_skbs[RX_RING_ENTRIES];
@@ -114,10 +119,11 @@ static inline void load_eaddr(struct net
/*
* Waits for BUSY status of mdio bus to clear
*/
-#define WAIT_FOR_PHY(___rval) \
- while ((___rval = mace->eth.phy_data) & MDIO_BUSY) { \
- udelay(25); \
+#define WAIT_FOR_PHY(___rval) \
+ while ((___rval = mace->eth.phy_data) & MDIO_BUSY) { \
+ udelay(25); \
}
+
/*read phy register, return value read */
static unsigned long mdio_read(struct meth_private *priv, unsigned long phyreg)
{
@@ -135,16 +141,20 @@ static int mdio_probe(struct meth_privat
{
int i;
unsigned long p2, p3, flags;
+
/* check if phy is detected already */
if(priv->phy_addr>=0&&priv->phy_addr<32)
return 0;
+
spin_lock_irqsave(&priv->meth_lock, flags);
- for (i=0;i<32;++i){
- priv->phy_addr=i;
- p2=mdio_read(priv,2);
- p3=mdio_read(priv,3);
+
+ for (i = 0; i < 32; i++){
+ priv->phy_addr = i;
+ p2 = mdio_read(priv,2);
+ p3 = mdio_read(priv,3);
+
#if MFE_DEBUG>=2
- switch ((p2<<12)|(p3>>4)){
+ switch ((p2 << 12) | (p3 >> 4)) {
case PHY_QS6612X:
DPRINTK("PHY is QS6612X\n");
break;
@@ -159,17 +169,19 @@ static int mdio_probe(struct meth_privat
break;
}
#endif
- if(p2!=0xffff&&p2!=0x0000){
- DPRINTK("PHY code: %x\n",(p2<<12)|(p3>>4));
+
+ if ((p2 != 0xffff) && (p2 != 0x0000)) {
+ DPRINTK("PHY code: %x\n",((p2 << 12) | (p3 >> 4)));
break;
}
}
spin_unlock_irqrestore(&priv->meth_lock, flags);
- if(priv->phy_addr<32) {
+
+ if (priv->phy_addr < 32)
return 0;
- }
- DPRINTK("Oopsie! PHY is not known!\n");
- priv->phy_addr=-1;
+
+ DPRINTK("Error: Unknown PHY chip!\n");
+ priv->phy_addr = -1;
return -ENODEV;
}
@@ -276,7 +288,7 @@ int meth_reset(struct net_device *dev)
struct meth_private *priv = netdev_priv(dev);
/* Reset card */
- mace->eth.mac_ctrl = SGI_MAC_RESET;
+ mace->eth.mac_ctrl = METH_CORE_RESET;
udelay(1);
mace->eth.mac_ctrl = 0;
udelay(25);
--- a/drivers/net/ethernet/sgi/meth.h 2011-12-17 16:01:30.509161408 -0500
+++ b/drivers/net/ethernet/sgi/meth.h 2011-12-17 16:02:51.279160663 -0500
@@ -1,69 +1,87 @@
/*
- * snull.h -- definitions for the network module
+ * meth.h -- definitions for the SGI O2 Fast Ethernet device
*
- * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet
- * Copyright (C) 2001 O'Reilly & Associates
+ * Copyright (C) 2001-2003 Ilya Volynets
+ * Copyright (C) 2011 Joshua Kinard
*
- * The source code in this file can be freely used, adapted,
- * and redistributed in source or binary form, so long as an
- * acknowledgment appears in derived source files. The citation
- * should list that the code comes from the book "Linux Device
- * Drivers" by Alessandro Rubini and Jonathan Corbet, published
- * by O'Reilly & Associates. No warranty is attached;
- * we cannot take responsibility for errors or fitness for use.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
*/
-
+
/* version dependencies have been confined to a separate file */
/* Tunable parameters */
#define TX_RING_ENTRIES 64 /* 64-512?*/
+#define RX_RING_ENTRIES 16 /* Do not change */
-#define RX_RING_ENTRIES 16 /* Do not change */
/* Internal constants */
#define TX_RING_BUFFER_SIZE (TX_RING_ENTRIES*sizeof(tx_packet))
-#define RX_BUFFER_SIZE 1546 /* ethenet packet size */
-#define METH_RX_BUFF_SIZE 4096
-#define METH_RX_HEAD 34 /* status + 3 quad garbage-fill + 2 byte zero-pad */
+#define RX_BUFFER_SIZE 1546 /* ethenet packet size */
#define RX_BUFFER_OFFSET (sizeof(rx_status_vector)+2) /* staus vector + 2
bytes of padding */
#define RX_BUCKET_SIZE 256
+#define METH_RX_BUFF_SIZE 4096
-/* For more detailed explanations of what each field menas,
- see Nick's great comments to #defines below (or docs, if
- you are lucky enough toget hold of them :)*/
-/* tx status vector is written over tx command header upon
- dma completion. */
+/*
+ * status +
+ * 3 quad garbage-fill +
+ * 2 byte zero-pad
+ */
+#define METH_RX_HEAD 34
+
+/*
+ * For more detailed explanations of what each field menas,
+ * see Nick's great comments to #defines below (or docs, if
+ * you are lucky enough toget hold of them :)
+ */
+
+/*
+ * tx status vector is written over tx command header upon
+ * dma completion.
+ */
typedef struct tx_status_vector {
- u64 sent:1; /* always set to 1...*/
- u64 pad0:34;/* always set to 0 */
- u64 flags:9; /*I'm too lazy to specify each one separately at the moment*/
- u64 col_retry_cnt:4; /*collision retry count*/
- u64 len:16; /*Transmit length in bytes*/
+ u64 sent:1; /* Always set to one */
+ u64 pad0:34; /* Always filled with zeroes */
+ u64 drp_late_coll:1; /* Transmit dropped due to late collision */
+ u64 can_xsv_defr:1; /* Transmit cancelled due to excessive deferral */
+ u64 drp_xs_coll:1; /* Transmit dropped due to excess collisions */
+ u64 abrt_underrun:1; /* Transmit aborted due to underrun */
+ u64 abrt_xsv_len:1; /* Transmit aborted to to excessive length */
+ u64 success:1; /* Transmit completed successfully */
+ u64 pkt_deferred:1; /* Packet deferred on at least one TX attempt */
+ u64 crc_error:1; /* CRC error on at least one TX attempt */
+ u64 late_coll:1; /* Late collision on at least one TX attempt */
+ u64 col_retry_cnt:4; /* collision retry count */
+ u64 len:16; /* Transmit length in bytes */
} tx_status_vector;
+
/*
* Each packet is 128 bytes long.
* It consists of header, 0-3 concatination
* buffer pointers and up to 120 data bytes.
*/
typedef struct tx_packet_hdr {
- u64 pad1:36; /*should be filled with 0 */
- u64 cat_ptr3_valid:1, /*Concatination pointer valid flags*/
- cat_ptr2_valid:1,
- cat_ptr1_valid:1;
- u64 tx_int_flag:1; /*Generate TX intrrupt when packet has been sent*/
- u64 term_dma_flag:1; /*Terminate transmit DMA on transmit abort conditions*/
- u64 data_offset:7; /*Starting byte offset in ring data block*/
- u64 data_len:16; /*Length of valid data in bytes-1*/
+ u64 pad1:36; /*should be filled with 0 */
+ u64 cat_ptr3_valid:1; /* Concatination pointer valid flags */
+ u64 cat_ptr2_valid:1;
+ u64 cat_ptr1_valid:1;
+ u64 tx_int_flag:1; /* Generate TX intrrupt when packet has been sent */
+ u64 term_dma_flag:1; /* Terminate transmit DMA on transmit abort
conditions */
+ u64 data_offset:7; /* Starting byte offset in ring data block */
+ u64 data_len:16; /* Length of valid data in bytes-1 */
} tx_packet_hdr;
+
typedef union tx_cat_ptr {
struct {
- u64 pad2:16; /* should be 0 */
- u64 len:16; /*length of buffer data - 1*/
- u64 start_addr:29; /*Physical starting address*/
- u64 pad1:3; /* should be zero */
+ u64 pad2:16; /* Should be 0 */
+ u64 len:16; /* length of buffer data - 1 */
+ u64 start_addr:29; /* Physical starting address */
+ u64 pad1:3; /* Should be 0 */
} form;
u64 raw;
} tx_cat_ptr;
@@ -82,8 +100,8 @@ typedef struct tx_packet {
typedef union rx_status_vector {
volatile struct {
- u64 pad1:1;/*fill it with ones*/
- u64 pad2:15;/*fill with 0*/
+ u64 pad1:1; /* Fill it with ones */
+ u64 pad2:15; /* Fill with zeros */
u64 ip_chk_sum:16;
u64 seq_num:5;
u64 mac_addr_match:1;
@@ -95,7 +113,7 @@ typedef union rx_status_vector {
u64 broadcast:1;
u64 multicast:1;
u64 crc_error:1;
- u64 huh:1;/*???*/
+ u64 dribble:1; /* Dribble nibble? */
u64 rx_code_violation:1;
u64 rx_len:16;
} parsed;
@@ -109,135 +127,261 @@ typedef struct rx_packet {
char
buf[METH_RX_BUFF_SIZE-sizeof(rx_status_vector)-3*sizeof(u64)-sizeof(u16)];/*
data */
} rx_packet;
-#define TX_INFO_RPTR 0x00FF0000
-#define TX_INFO_WPTR 0x000000FF
+#define TX_INFO_RPTR 0x00FF0000
+#define TX_INFO_WPTR 0x000000FF
+
- /* Bits in METH_MAC */
-#define SGI_MAC_RESET BIT(0) /* 0: MAC110 active in run mode, 1: Global
reset signal to MAC110 core is active */
-#define METH_PHY_FDX BIT(1) /* 0: Disable full duplex, 1: Enable full
duplex */
-#define METH_PHY_LOOP BIT(2) /* 0: Normal operation, follows 10/100mbit and
M10T/MII select, 1: loops internal MII bus */
- /* selects ignored */
-#define METH_100MBIT BIT(3) /* 0: 10meg mode, 1: 100meg mode */
-#define METH_PHY_MII BIT(4) /* 0: MII selected, 1: SIA selected */
- /* Note: when loopback is set this bit becomes collision
control. Setting this bit will */
- /* cause a collision to be reported. */
+/* Bits in METH_MAC */
+
+/*
+ * Core Reset:
+ * 0: MAC110 active in run mode
+ * 1: Global reset signal to MAC110 core is active
+ */
+#define METH_CORE_RESET BIT(0)
- /* Bits 5 and 6 are used to determine the Destination address
filter mode */
-#define METH_ACCEPT_MY 0 /* 00: Accept PHY address only */
-#define METH_ACCEPT_MCAST 0x20 /* 01: Accept physical, broadcast, and
multicast filter matches only */
-#define METH_ACCEPT_AMCAST 0x40 /* 10: Accept physical, broadcast, and all
multicast packets */
-#define METH_PROMISC 0x60 /* 11: Promiscious mode */
+/*
+ * Duplex:
+ * 0: Disable full duplex
+ * 1: Enable full duplex
+ */
+#define METH_PHY_FDX BIT(1)
-#define METH_PHY_LINK_FAIL BIT(7) /* 0: Link failure detection disabled, 1:
Hardware scans for link failure in PHY */
+/*
+ * Loopback Internal Select
+ * 0: Normal operation, follows 10/100mbit and M10T/MII select
+ * 1: loops internal MII bus, selects ignored.
+ */
+#define METH_PHY_LOOP BIT(2)
-#define METH_MAC_IPG 0x1ffff00
+/*
+ * 10/100 Mbit Select
+ * 0: 10mb mode
+ * 1: 100mb mode
+ */
+#define METH_100MBIT BIT(3)
-#define METH_DEFAULT_IPG ((17<<15) | (11<<22) | (21<<8))
- /* 0x172e5c00 */ /* 23, 23, 23 */ /*0x54A9500 *//*21,21,21*/
- /* Bits 8 through 14 are used to determine Inter-Packet Gap
between "Back to Back" packets */
- /* The gap depends on the clock speed of the link, 80ns per
increment for 100baseT, 800ns */
- /* per increment for 10BaseT */
+/*
+ * M10T/MII Select
+ * 0: MII selected
+ * 1: SIA selected
+ *
+ * Note: when loopback is set this bit becomes collision
+ * control. Setting this bit will cause a collision to
+ * be reported.
+ */
+#define METH_PHY_MII BIT(4)
- /* Bits 15 through 21 are used to determine IPGR1 */
+/*
+ * Destination Address Filter Mode
+ *
+ * Bits 5 and 6 are written to one of the values below to
+ * set the destination address filtering.
+ */
+#define METH_ACCEPT_MY 0x00 /* 00: PHY address only */
+#define METH_ACCEPT_MCAST 0x20 /* 01: Phys, bcast, & multicast filter
matches only */
+#define METH_ACCEPT_AMCAST 0x40 /* 10: Phys, bcast, and all multicast
packets */
+#define METH_PROMISC 0x60 /* 11: Promiscious mode */
- /* Bits 22 through 28 are used to determine IPGR2 */
+/*
+ * Link Failure Enable
+ * 0: Link failure detection disabled
+ * 1: Hardware scans for link failure in PHY
+ */
+#define METH_PHY_LINK_FAIL BIT(7)
-#define METH_REV_SHIFT 29 /* Bits 29 through 31 are used to determine
the revision */
- /* 000: Initial revision */
- /* 001: First revision, Improved TX concatenation */
+/*
+ * Inter-packet Gap
+ *
+ * Bits 8 through 14 are used to determine Inter-Packet Gap
+ * between "Back to Back" packets. The gap depends on the
+ * clock speed of the link, 80ns per increment for 100baseT,
+ * 800ns per increment for 10BaseT.
+ *
+ * Bits 15 through 21 are used to determine IPGR1.
+ * Bits 22 through 28 are used to determine IPGR2.
+ *
+ */
+#define METH_MAC_IPG 0x1ffff00
+#define METH_DEFAULT_IPG ((17<<15) | (11<<22) | (21<<8))
+/*
+ * Implementation Revision (read-only)
+ * 000: Initial revision
+ * 001: First revision, Improved TX concatenation
+ *
+ * Bits 29 through 31 are used to determine the revision.
+ */
+ #define METH_REV_MASK (BIT(29) | BIT(30) | BIT(31))
-/* DMA control bits */
-#define METH_RX_OFFSET_SHIFT 12 /* Bits 12:14 of DMA control register
indicate starting offset of packet data for RX operation */
-#define METH_RX_DEPTH_SHIFT 4 /* Bits 8:4 define RX fifo depth -- when # of
RX fifo entries != depth, interrupt is generted */
-#define METH_DMA_TX_EN BIT(1) /* enable TX DMA */
-#define METH_DMA_TX_INT_EN BIT(0) /* enable TX Buffer Empty interrupt */
-#define METH_DMA_RX_EN BIT(15) /* Enable RX */
-#define METH_DMA_RX_INT_EN BIT(9) /* Enable interrupt on RX packet */
+/* DMA control register */
+
+/*
+ * RX DMA Starting Offset
+ *
+ * Bits 12:14 of indicate starting offset of packet data
+ * for RX operation.
+ */
+#define METH_RX_OFFSET_SHIFT 12
+
+/* RX FIFO Depth
+ *
+ * Bits 8:4 define RX fifo depth. When the number of RX
+ * fifo entries != depth, then an interrupt is generated.
+ */
+#define METH_RX_DEPTH_SHIFT 4
+
+/*
+ * DMA RX/TX Enable + Intr Enable
+ */
+#define METH_DMA_TX_EN BIT(1) /* TX DMA Enable */
+#define METH_DMA_TX_INT_EN BIT(0) /* TX Interrupt Enable */
+#define METH_DMA_RX_EN BIT(15) /* RX DMA Enable */
+#define METH_DMA_RX_INT_EN BIT(9) /* RX Interrupt Enable */
/* RX FIFO MCL Info bits */
-#define METH_RX_FIFO_WPTR(x) (((x)>>16)&0xf)
-#define METH_RX_FIFO_RPTR(x) (((x)>>8)&0xf)
-#define METH_RX_FIFO_DEPTH(x) ((x)&0x1f)
-
-/* RX status bits */
-
-#define METH_RX_ST_VALID BIT(63)
-#define METH_RX_ST_RCV_CODE_VIOLATION BIT(16)
-#define METH_RX_ST_DRBL_NBL BIT(17)
-#define METH_RX_ST_CRC_ERR BIT(18)
-#define METH_RX_ST_MCAST_PKT BIT(19)
-#define METH_RX_ST_BCAST_PKT BIT(20)
-#define METH_RX_ST_INV_PREAMBLE_CTX BIT(21)
-#define METH_RX_ST_LONG_EVT_SEEN BIT(22)
-#define METH_RX_ST_BAD_PACKET BIT(23)
-#define METH_RX_ST_CARRIER_EVT_SEEN BIT(24)
-#define METH_RX_ST_MCAST_FILTER_MATCH BIT(25)
-#define METH_RX_ST_PHYS_ADDR_MATCH BIT(26)
-
-#define METH_RX_STATUS_ERRORS \
- ( \
- METH_RX_ST_RCV_CODE_VIOLATION| \
- METH_RX_ST_CRC_ERR| \
- METH_RX_ST_INV_PREAMBLE_CTX| \
- METH_RX_ST_LONG_EVT_SEEN| \
- METH_RX_ST_BAD_PACKET| \
- METH_RX_ST_CARRIER_EVT_SEEN \
- )
- /* Bits in METH_INT */
- /* Write _1_ to corresponding bit to clear */
-#define METH_INT_TX_EMPTY BIT(0) /* 0: No interrupt pending, 1: The TX ring
buffer is empty */
-#define METH_INT_TX_PKT BIT(1) /* 0: No interrupt pending */
- /* 1: A TX message had the INT request bit set, the packet has
been sent. */
-#define METH_INT_TX_LINK_FAIL BIT(2) /* 0: No interrupt pending, 1: PHY has
reported a link failure */
-#define METH_INT_MEM_ERROR BIT(3) /* 0: No interrupt pending */
- /* 1: A memory error occurred during DMA, DMA stopped, Fatal */
-#define METH_INT_TX_ABORT BIT(4) /* 0: No interrupt pending, 1: The TX
aborted operation, DMA stopped, FATAL */
-#define METH_INT_RX_THRESHOLD BIT(5) /* 0: No interrupt pending, 1:
Selected receive threshold condition Valid */
-#define METH_INT_RX_UNDERFLOW BIT(6) /* 0: No interrupt pending, 1: FIFO
was empty, packet could not be queued */
-#define METH_INT_RX_OVERFLOW BIT(7) /* 0: No interrupt pending, 1: DMA
FIFO Overflow, DMA stopped, FATAL */
-
-/*#define METH_INT_RX_RPTR_MASK 0x0001F00*/ /* Bits 8 through 12 alias of
RX read-pointer */
-#define METH_INT_RX_RPTR_MASK 0x0000F00 /* Bits 8 through 11 alias of RX
read-pointer - so, is Rx FIFO 16 or 32 entry?*/
-
- /* Bits 13 through 15 are always 0. */
-
-#define METH_INT_TX_RPTR_MASK 0x1FF0000 /* Bits 16 through 24 alias
of TX read-pointer */
-
-#define METH_INT_RX_SEQ_MASK 0x2E000000 /* Bits 25 through 29 are the
starting seq number for the message at the */
-
- /* top of the queue */
-
-#define METH_INT_ERROR (METH_INT_TX_LINK_FAIL| \
- METH_INT_MEM_ERROR| \
- METH_INT_TX_ABORT| \
- METH_INT_RX_OVERFLOW| \
- METH_INT_RX_UNDERFLOW)
+#define METH_RX_FIFO_WPTR(x) (((x) >> 16) & 0xf)
+#define METH_RX_FIFO_RPTR(x) (((x) >> 8) & 0xf)
+#define METH_RX_FIFO_DEPTH(x) ((x) & 0x1f)
+
+
+/* RX status vector bits */
+#define METH_RX_ST_VALID BIT(63)
+#define METH_RX_ST_RCV_CODE_VIOLATION BIT(16)
+#define METH_RX_ST_DRBL_NBL BIT(17)
+#define METH_RX_ST_CRC_ERR BIT(18)
+#define METH_RX_ST_MCAST_PKT BIT(19)
+#define METH_RX_ST_BCAST_PKT BIT(20)
+#define METH_RX_ST_INV_PREAMBLE_CTX BIT(21)
+#define METH_RX_ST_LONG_EVT_SEEN BIT(22)
+#define METH_RX_ST_BAD_PACKET BIT(23)
+#define METH_RX_ST_CARRIER_EVT_SEEN BIT(24)
+#define METH_RX_ST_MCAST_FILTER_MATCH BIT(25)
+#define METH_RX_ST_PHYS_ADDR_MATCH BIT(26)
+
+#define METH_RX_STATUS_ERRORS \
+ (METH_RX_ST_RCV_CODE_VIOLATION | \
+ METH_RX_ST_CRC_ERR | \
+ METH_RX_ST_INV_PREAMBLE_CTX | \
+ METH_RX_ST_LONG_EVT_SEEN | \
+ METH_RX_ST_BAD_PACKET | \
+ METH_RX_ST_CARRIER_EVT_SEEN)
+
-#define METH_INT_MCAST_HASH BIT(30) /* If RX DMA is enabled the hash
select logic output is latched here */
+/*
+ * Ethernet Interrupt Status Register
+ *
+ * Write a '1' to the corresponding bit to clear it.
+ */
+
+/*
+ * TX Ring Empty Interrupt Event
+ * 0: No interrupt pending
+ * 1: The TX ring buffer is empty
+ */
+#define METH_INT_TX_EMPTY BIT(0)
+
+/*
+ * TX Packet User Request Interrupt Event
+ * 0: No interrupt pending
+ * 1: A TX message had the INT request bit set, the packet has been sent.
+ */
+#define METH_INT_TX_PKT BIT(1)
+
+/*
+ * TX Link Failure Condition Detected
+ * 0: No interrupt pending
+ * 1: PHY has reported a link failure
+ */
+#define METH_INT_TX_LINK_FAIL BIT(2)
+
+/*
+ * TX CRIME Memory Error Interrupt Event
+ * 0: No interrupt pending
+ * 1: A memory error occurred during a DMA transaction,
+ * DMA has stopped, fatal error.
+ */
+#define METH_INT_MEM_ERROR BIT(3)
+
+/*
+ * TX Abort Interrupt Event
+ * 0: No interrupt pending
+ * 1: The TX aborted operation, DMA has stopped, fatal error.
+ * Examine the TX status register for the abort reason.
+ */
+#define METH_INT_TX_ABORT BIT(4)
+
+/*
+ * RX Threshold INterrupt Event
+ * 0: No interrupt pending
+ * 1: Selected receive threshold condition is valid
+ */
+#define METH_INT_RX_THRESHOLD BIT(5)
+
+/*
+ * RX Cluster FIFO Underflow Interrupt Event
+ * 0: No interrupt pending
+ * 1: FIFO was empty, packet could not be queued
+ */
+#define METH_INT_RX_UNDERFLOW BIT(6)
+
+/*
+ * RX DMA FIFO Overflow Interrupt Event
+ * 0: No interrupt pending
+ * 1: DMA FIFO Overflow, DMA has stopped, fatal error
+ */
+#define METH_INT_RX_OVERFLOW BIT(7)
+
+/* Bits 8:12 are an alias of the RX MCL FIFO Read Pointer */
+//#define METH_INT_RX_RPTR_MASK 0x0001F00
+#define METH_INT_RX_RPTR_MASK 0x0000F00
+
+/* Bits 13 through 15 are always 0. */
+
+/* Bits 16:24 are an alias of the TX Ring Buffer Read Pointer */
+#define METH_INT_TX_RPTR_MASK 0x1FF0000
+
+/* Bits 25:29 are for the RX sequence number */
+#define METH_INT_RX_SEQ_MASK 0x2E000000
+
+/* top of the queue */
+#define METH_INT_ERROR \
+ (METH_INT_TX_LINK_FAIL | \
+ METH_INT_MEM_ERROR | \
+ METH_INT_TX_ABORT | \
+ METH_INT_RX_OVERFLOW | \
+ METH_INT_RX_UNDERFLOW)
+
+/*
+ * Multicast Hash Output (Debug)
+ *
+ * If RX DMA is enabled, the hash select logic output is latched here.
+ */
+#define METH_INT_MCAST_HASH BIT(30)
/* TX status bits */
-#define METH_TX_ST_DONE BIT(63) /* TX complete */
-#define METH_TX_ST_SUCCESS BIT(23) /* Packet was transmitted successfully */
-#define METH_TX_ST_TOOLONG BIT(24) /* TX abort due to excessive length */
-#define METH_TX_ST_UNDERRUN BIT(25) /* TX abort due to underrun (?) */
-#define METH_TX_ST_EXCCOLL BIT(26) /* TX abort due to excess collisions */
-#define METH_TX_ST_DEFER BIT(27) /* TX abort due to excess deferals */
-#define METH_TX_ST_LATECOLL BIT(28) /* TX abort due to late collision */
+#define METH_TX_ST_DONE BIT(63) /* TX complete */
+#define METH_TX_ST_SUCCESS BIT(23) /* Packet was transmitted successfully */
+#define METH_TX_ST_TOOLONG BIT(24) /* TX abort due to excessive length */
+#define METH_TX_ST_UNDERRUN BIT(25) /* TX abort due to underrun (?) */
+#define METH_TX_ST_EXCCOLL BIT(26) /* TX abort due to excess collisions */
+#define METH_TX_ST_DEFER BIT(27) /* TX abort due to excess deferals */
+#define METH_TX_ST_LATECOLL BIT(28) /* TX abort due to late collision */
/* Tx command header bits */
-#define METH_TX_CMD_INT_EN BIT(24) /* Generate TX interrupt when packet is
sent */
+#define METH_TX_CMD_INT_EN BIT(24) /* Generate TX interrupt when packet
is sent */
/* Phy MDIO interface busy flag */
-#define MDIO_BUSY BIT(16)
-#define MDIO_DATA_MASK 0xFFFF
+#define MDIO_BUSY BIT(16)
+#define MDIO_DATA_MASK 0xFFFF
+
/* PHY defines */
-#define PHY_QS6612X 0x0181441 /* Quality TX */
-#define PHY_ICS1889 0x0015F41 /* ICS FX */
-#define PHY_ICS1890 0x0015F42 /* ICS TX */
-#define PHY_DP83840 0x20005C0 /* National TX */
+#define PHY_QS6612X 0x0181441 /* Quality TX */
+#define PHY_ICS1889 0x0015F41 /* ICS FX */
+#define PHY_ICS1890 0x0015F42 /* ICS TX */
+#define PHY_DP83840 0x20005C0 /* National TX */
-#define ADVANCE_RX_PTR(x) x=(x+1)&(RX_RING_ENTRIES-1)
+#define ADVANCE_RX_PTR(x) (x) = ((x + 1) & (RX_RING_ENTRIES - 1))
\ No newline at end of file
^ permalink raw reply
* ipv6/addrconf_dad_failure printk() in interrupt context
From: Marek Vasut @ 2011-12-18 2:28 UTC (permalink / raw)
To: netdev
Cc: Wolfgang Denk, David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
Hi,
I just recently hit the following issue. I might actually be wrong with my
conclusions so bear with me. The events that led to the issue:
1) Duplicate IPv6 address on the network
2) console driver that locks a mutex when printk() is called
The problem is the following backtrace:
[ 4.870000] eth0: IPv6 duplicate address XXXX::YYYY:ZZZZ:WWWW:0 detected!
[ 4.870000] ------------[ cut here ]------------
[ 4.870000] WARNING: at kernel/mutex.c:198 mutex_lock_nested+0x284/0x2c0()
[ 4.870000] Modules linked in:
[ 4.870000] [<c0013ab8>] (unwind_backtrace+0x0/0xf0) from [<c001d934>]
(warn_slowpath_common+0x4c/0x64)
[ 4.870000] [<c001d934>] (warn_slowpath_common+0x4c/0x64) from [<c001d968>]
(warn_slowpath_null+0x1c/0x24)
[ 4.870000] [<c001d968>] (warn_slowpath_null+0x1c/0x24) from [<c033a4f4>]
(mutex_lock_nested+0x284/0x2c0)
[ 4.870000] [<c033a4f4>] (mutex_lock_nested+0x284/0x2c0) from [<c0017d88>]
(clk_enable+0x20/0x48)
[ 4.870000] [<c0017d88>] (clk_enable+0x20/0x48) from [<c01dfbf0>]
(pl011_console_write+0x20/0x74)
[ 4.870000] [<c01dfbf0>] (pl011_console_write+0x20/0x74) from [<c001da98>]
(__call_console_drivers+0x7c/0x94)
[ 4.870000] [<c001da98>] (__call_console_drivers+0x7c/0x94) from [<c001df20>]
(console_unlock+0xf8/0x244)
[ 4.870000] [<c001df20>] (console_unlock+0xf8/0x244) from [<c001e308>]
(vprintk+0x29c/0x484)
[ 4.870000] [<c001e308>] (vprintk+0x29c/0x484) from [<c03355a8>]
(printk+0x20/0x30)
[ 4.870000] [<c03355a8>] (printk+0x20/0x30) from [<c02df600>]
(addrconf_dad_failure+0x148/0x158)
[ 4.870000] [<c02df600>] (addrconf_dad_failure+0x148/0x158) from [<c02ebde0>]
(ndisc_rcv+0xb38/0xdb0)
[ 4.870000] [<c02ebde0>] (ndisc_rcv+0xb38/0xdb0) from [<c02f1b28>]
(icmpv6_rcv+0x6ec/0x9c4)
[ 4.870000] [<c02f1b28>] (icmpv6_rcv+0x6ec/0x9c4) from [<c02da9a4>]
(ip6_input_finish+0x144/0x4e0)
[ 4.870000] [<c02da9a4>] (ip6_input_finish+0x144/0x4e0) from [<c02db424>]
(ip6_mc_input+0xb8/0x154)
[ 4.870000] [<c02db424>] (ip6_mc_input+0xb8/0x154) from [<c02db12c>]
(ipv6_rcv+0x300/0x53c)
[ 4.870000] [<c02db12c>] (ipv6_rcv+0x300/0x53c) from [<c0267b78>]
(__netif_receive_skb+0x240/0x420)
[ 4.870000] [<c0267b78>] (__netif_receive_skb+0x240/0x420) from [<c0267de8>]
(process_backlog+0x90/0x150)
[ 4.870000] [<c0267de8>] (process_backlog+0x90/0x150) from [<c026a5f8>]
(net_rx_action+0xc0/0x264)
[ 4.870000] [<c026a5f8>] (net_rx_action+0xc0/0x264) from [<c0023cfc>]
(__do_softirq+0xa8/0x214)
[ 4.870000] [<c0023cfc>] (__do_softirq+0xa8/0x214) from [<c00242c0>]
(irq_exit+0x8c/0x94)
[ 4.870000] [<c00242c0>] (irq_exit+0x8c/0x94) from [<c000f6d0>]
(handle_IRQ+0x34/0x84)
[ 4.870000] [<c000f6d0>] (handle_IRQ+0x34/0x84) from [<c000e5d8>]
(__irq_usr+0x38/0x80)
[ 4.870000] ---[ end trace 32eab6a8dcdca9c0 ]---
So basically what I see here is the following order of events:
Packet received -> IRQ generated -> ipv6 packet received (still in interrupt
context ... why not in tasklet ... or am I wrong here ?) -> icmpv6 packet
processing -> addrconf_dad_failure() called -> printk() called in there ->
mutex_lock() called in printk(), causing the warning.
Can printk() be actually called in interrupt context?
What direction of solving this shall I take?
Thanks in advance!
M
^ permalink raw reply
* Re: [PATCH] net: meth: Add set_rx_mode hook to fix ICMPv6 neighbor discovery
From: David Miller @ 2011-12-18 2:56 UTC (permalink / raw)
To: kumba; +Cc: netdev, linux-mips
In-Reply-To: <4EED3A3D.9080503@gentoo.org>
From: Joshua Kinard <kumba@gentoo.org>
Date: Sat, 17 Dec 2011 19:56:29 -0500
> +/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
> + * MACE Ethernet uses a 64 element hash table based on the Ethernet CRC.
> + */
> +static int multicast_filter_limit = 32;
> +
> +
Unnecessary empty line, only one is sufficient. I also don't see a reason
to even define this value. If it's a constant then use a const type.
> + /* Multicast filter. */
> + unsigned long mcast_filter;
> +
...
> + priv->mcast_filter = 0xffffffffffffffffUL;
You're assuming that unsigned long is 64-bits here. You need to use a
type which matches your expections regardless of the architecture that
the code is built on.
> + netdev_for_each_mc_addr(ha, dev)
> + set_bit((ether_crc(ETH_ALEN, ha->addr) >> 26),
> + (volatile long unsigned int *)&priv->mcast_filter);
This makes an assumption not only about the size of the "unsigned long"
type, but also of the endianness of the architecture this runs on.
Please recode this to remove both assumptions.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox