* [PATCH 0/2] clean up tx_bytes accounting
From: Marc Kleine-Budde @ 2011-11-03 9:47 UTC (permalink / raw)
To: socketcan; +Cc: kurt.van.dijck, netdev, linux-can, Reuben.Dowle
In-Reply-To: <70F6AAAFDC054F41B9994A9BCD3DF64E16FAA8E0@exch01-aklnz.MARINE.NET.INT>
Hello,
what about turning can_get_echo_skb() into a helper function which returns the number
of tx'ed bytes.
Marc
^ permalink raw reply
* [PATCH 1/2] can: dev: let can_get_echo_skb() return dlc of CAN frame
From: Marc Kleine-Budde @ 2011-11-03 9:47 UTC (permalink / raw)
To: socketcan
Cc: kurt.van.dijck, netdev, linux-can, Reuben.Dowle,
Marc Kleine-Budde
In-Reply-To: <1320313675-30749-1-git-send-email-mkl@pengutronix.de>
can_get_echo_skb() is usually called in the TX complete handler.
The stats->tx_packets and stats->tx_bytes should be updated there, too.
This patch simplifies to figure out the size of the sent CAN frame.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev.c | 10 +++++++++-
include/linux/can/dev.h | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 25695bd..b351632 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -327,16 +327,24 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb);
* is handled in the device driver. The driver must protect
* access to priv->echo_skb, if necessary.
*/
-void can_get_echo_skb(struct net_device *dev, unsigned int idx)
+unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
{
struct can_priv *priv = netdev_priv(dev);
BUG_ON(idx >= priv->echo_skb_max);
if (priv->echo_skb[idx]) {
+ struct sk_buff *skb = priv->echo_skb[idx];
+ struct can_frame *cf = (struct can_frame *)skb->data;
+ u8 dlc = cf->can_dlc;
+
netif_rx(priv->echo_skb[idx]);
priv->echo_skb[idx] = NULL;
+
+ return dlc;
}
+
+ return 0;
}
EXPORT_SYMBOL_GPL(can_get_echo_skb);
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index a0969fc..5d2efe7 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -92,7 +92,7 @@ void can_bus_off(struct net_device *dev);
void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
unsigned int idx);
-void can_get_echo_skb(struct net_device *dev, unsigned int idx);
+unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
void can_free_echo_skb(struct net_device *dev, unsigned int idx);
struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 2/2] flexcan: Fix CAN_RAW_RECV_OWN_MSGS and CAN_RAW_LOOPBACK
From: Marc Kleine-Budde @ 2011-11-03 9:47 UTC (permalink / raw)
To: socketcan
Cc: kurt.van.dijck, netdev, linux-can, Reuben.Dowle, Reuben Dowle,
Marc Kleine-Budde
In-Reply-To: <1320313675-30749-1-git-send-email-mkl@pengutronix.de>
From: Reuben Dowle <Reuben.Dowle@navico.com>
Currently the flexcan driver uses hardware local echo. This blindly
echos all transmitted frames to all receiving sockets, regardless what
CAN_RAW_RECV_OWN_MSGS and CAN_RAW_LOOPBACK are set to.
This patch now submits transmitted frames to be echoed in the transmit
complete interrupt, preserving the reference to the sending
socket. This allows the can protocol to correctly handle the local
echo.
Further this patch moves tx_bytes statistic accounting into the tx_complete
handler.
Signed-off-by: Reuben Dowle <reuben.dowle@navico.com>
[mkl: move tx_bytes accounting into tx_complete handler; cleanups]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/flexcan.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index e023379..ea7b668 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -269,7 +269,6 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
const struct flexcan_priv *priv = netdev_priv(dev);
- struct net_device_stats *stats = &dev->stats;
struct flexcan_regs __iomem *regs = priv->base;
struct can_frame *cf = (struct can_frame *)skb->data;
u32 can_id;
@@ -299,14 +298,11 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
flexcan_write(data, ®s->cantxfg[FLEXCAN_TX_BUF_ID].data[1]);
}
+ can_put_echo_skb(skb, dev, 0);
+
flexcan_write(can_id, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_id);
flexcan_write(ctrl, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
- kfree_skb(skb);
-
- /* tx_packets is incremented in flexcan_irq */
- stats->tx_bytes += cf->can_dlc;
-
return NETDEV_TX_OK;
}
@@ -609,9 +605,10 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
/* transmission complete interrupt */
if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) {
- /* tx_bytes is incremented in flexcan_start_xmit */
+ stats->tx_bytes += can_get_echo_skb(dev, 0);
stats->tx_packets++;
flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1);
+ can_get_echo_skb(dev, 0);
netif_wake_queue(dev);
}
@@ -697,12 +694,13 @@ static int flexcan_chip_start(struct net_device *dev)
* only supervisor access
* enable warning int
* choose format C
+ * disable local echo
*
*/
reg_mcr = flexcan_read(®s->mcr);
reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
- FLEXCAN_MCR_IDAM_C;
+ FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS;
dev_dbg(dev->dev.parent, "%s: writing mcr=0x%08x", __func__, reg_mcr);
flexcan_write(reg_mcr, ®s->mcr);
@@ -970,7 +968,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
goto failed_map;
}
- dev = alloc_candev(sizeof(struct flexcan_priv), 0);
+ dev = alloc_candev(sizeof(struct flexcan_priv), 1);
if (!dev) {
err = -ENOMEM;
goto failed_alloc;
@@ -978,7 +976,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
dev->netdev_ops = &flexcan_netdev_ops;
dev->irq = irq;
- dev->flags |= IFF_ECHO; /* we support local echo in hardware */
+ dev->flags |= IFF_ECHO;
priv = netdev_priv(dev);
priv->can.clock.freq = clock_freq;
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH 2/2] flexcan: Fix CAN_RAW_RECV_OWN_MSGS and CAN_RAW_LOOPBACK
From: Marc Kleine-Budde @ 2011-11-03 9:59 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: socketcan, kurt.van.dijck, netdev, linux-can, Reuben.Dowle
In-Reply-To: <1320313675-30749-3-git-send-email-mkl@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]
On 11/03/2011 10:47 AM, Marc Kleine-Budde wrote:
> From: Reuben Dowle <Reuben.Dowle@navico.com>
>
> Currently the flexcan driver uses hardware local echo. This blindly
> echos all transmitted frames to all receiving sockets, regardless what
> CAN_RAW_RECV_OWN_MSGS and CAN_RAW_LOOPBACK are set to.
>
> This patch now submits transmitted frames to be echoed in the transmit
> complete interrupt, preserving the reference to the sending
> socket. This allows the can protocol to correctly handle the local
> echo.
>
> Further this patch moves tx_bytes statistic accounting into the tx_complete
> handler.
>
> Signed-off-by: Reuben Dowle <reuben.dowle@navico.com>
> [mkl: move tx_bytes accounting into tx_complete handler; cleanups]
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
A changelog would be nice :)
Since v1 (Reuben's original version):
- wrap patch description to 80 lines
- remove can_free_echo_skb() from flexcan_chip_start()
not needed as Reuben pointed out
- remove comments about IFF_ECHO; see patch description for this
- closed potential race condition in flexcan_start_xmit()
first call can_put_echo_skb(), then trigger xmit
- moved tx_bytes accounting to tx_complete handler;
make use of new can_get_echo_skb()
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply
* Re: [PATCH 0/2] clean up tx_bytes accounting
From: Kurt Van Dijck @ 2011-11-03 10:03 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: socketcan, netdev, linux-can, Reuben.Dowle
In-Reply-To: <1320313675-30749-1-git-send-email-mkl@pengutronix.de>
On Thu, Nov 03, 2011 at 10:47:53AM +0100, Marc Kleine-Budde wrote:
> Hello,
>
> what about turning can_get_echo_skb() into a helper function which returns the number
> of tx'ed bytes.
That would work.
Next step would be to do the statistics inside can_get_echo_skb(), but that's
affecting all drivers using it ...
Kurt
>
> Marc
>
>
^ permalink raw reply
* Re: [PATCH 2/2] flexcan: Fix CAN_RAW_RECV_OWN_MSGS and CAN_RAW_LOOPBACK
From: Oliver Hartkopp @ 2011-11-03 10:03 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: kurt.van.dijck, netdev, linux-can, Reuben.Dowle
In-Reply-To: <1320313675-30749-3-git-send-email-mkl@pengutronix.de>
On 03.11.2011 10:47, Marc Kleine-Budde wrote:
> @@ -609,9 +605,10 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
>
> /* transmission complete interrupt */
> if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) {
> - /* tx_bytes is incremented in flexcan_start_xmit */
> + stats->tx_bytes += can_get_echo_skb(dev, 0);
> stats->tx_packets++;
> flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1);
> + can_get_echo_skb(dev, 0);
> netif_wake_queue(dev);
> }
What's the reason for the second can_get_echo_skb() here?
IIRC the skb is already netif_rx'ed and consumed by the first attempt.
Regards,
Oliver
^ permalink raw reply
* [PATCH] netlink: validate NLA_MSECS length
From: Johannes Berg @ 2011-11-03 10:07 UTC (permalink / raw)
To: netdev; +Cc: Thomas Graf
From: Johannes Berg <johannes.berg@intel.com>
L2TP for example uses NLA_MSECS like this:
policy:
[L2TP_ATTR_RECV_TIMEOUT] = { .type = NLA_MSECS, },
code:
if (info->attrs[L2TP_ATTR_RECV_TIMEOUT])
cfg.reorder_timeout = nla_get_msecs(info->attrs[L2TP_ATTR_RECV_TIMEOUT]);
As nla_get_msecs() is essentially nla_get_u64() plus the
conversion to a HZ-based value, this will not properly
reject attributes from userspace that aren't long enough
and might overrun the message.
Add NLA_MSECS to the attribute minlen array to check the
size properly.
Cc: Thomas Graf <tgraf@suug.ch>
Cc: stable@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
lib/nlattr.c | 1 +
1 file changed, 1 insertion(+)
--- a/lib/nlattr.c 2011-04-29 11:34:55.000000000 +0200
+++ b/lib/nlattr.c 2011-11-03 11:02:10.000000000 +0100
@@ -20,6 +20,7 @@ static const u16 nla_attr_minlen[NLA_TYP
[NLA_U16] = sizeof(u16),
[NLA_U32] = sizeof(u32),
[NLA_U64] = sizeof(u64),
+ [NLA_MSECS] = sizeof(u64),
[NLA_NESTED] = NLA_HDRLEN,
};
^ permalink raw reply
* [PATCH] netlink: clarify attribute length check documentation
From: Johannes Berg @ 2011-11-03 10:10 UTC (permalink / raw)
To: netdev; +Cc: Thomas Graf
From: Johannes Berg <johannes.berg@intel.com>
The documentation for how the length of attributes
is checked is wrong ("Exact length" isn't true, the
policy checks are for "minimum length") and a bit
misleading. Make it more complete and explain what
really happens.
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/net/netlink.h | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- a/include/net/netlink.h 2011-11-03 09:26:05.000000000 +0100
+++ b/include/net/netlink.h 2011-11-03 11:01:22.000000000 +0100
@@ -192,8 +192,15 @@ enum {
* NLA_NUL_STRING Maximum length of string (excluding NUL)
* NLA_FLAG Unused
* NLA_BINARY Maximum length of attribute payload
- * NLA_NESTED_COMPAT Exact length of structure payload
- * All other Exact length of attribute payload
+ * NLA_NESTED Don't use `len' field -- length verification is
+ * done by checking len of nested header (or empty)
+ * NLA_NESTED_COMPAT Minimum length of structure payload
+ * NLA_U8, NLA_U16,
+ * NLA_U32, NLA_U64,
+ * NLA_MSECS Leaving the length field zero will verify the
+ * given type fits, using it verifies minimum length
+ * just like "All other"
+ * All other Minimum length of attribute payload
*
* Example:
* static const struct nla_policy my_policy[ATTR_MAX+1] = {
^ permalink raw reply
* Re: [PATCH 2/2] flexcan: Fix CAN_RAW_RECV_OWN_MSGS and CAN_RAW_LOOPBACK
From: Marc Kleine-Budde @ 2011-11-03 10:17 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: kurt.van.dijck, netdev, linux-can, Reuben.Dowle
In-Reply-To: <4EB26702.60506@hartkopp.net>
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
On 11/03/2011 11:03 AM, Oliver Hartkopp wrote:
> On 03.11.2011 10:47, Marc Kleine-Budde wrote:
>
>> @@ -609,9 +605,10 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
>>
>> /* transmission complete interrupt */
>> if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) {
>> - /* tx_bytes is incremented in flexcan_start_xmit */
>> + stats->tx_bytes += can_get_echo_skb(dev, 0);
>> stats->tx_packets++;
>> flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1);
>> + can_get_echo_skb(dev, 0);
>> netif_wake_queue(dev);
>> }
>
>
> What's the reason for the second can_get_echo_skb() here?
doh!
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply
* [PATCH] tg3: fix error handling in tg3_open
From: Akinobu Mita @ 2011-11-03 10:36 UTC (permalink / raw)
To: netdev; +Cc: Akinobu Mita, David S. Miller, Matt Carlson, Michael Chan
If one of the request_irq calls fails in tg3_open, all interrupts
allocated with request_irq should be freed before returning error.
But it accidentally attempts to free the same invalid IRQ repeatedly.
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Matt Carlson <mcarlson@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
drivers/net/ethernet/broadcom/tg3.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 161cbbb..13c4054 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -9674,8 +9674,10 @@ static int tg3_open(struct net_device *dev)
struct tg3_napi *tnapi = &tp->napi[i];
err = tg3_request_irq(tp, i);
if (err) {
- for (i--; i >= 0; i--)
+ for (i--; i >= 0; i--) {
+ tnapi = &tp->napi[i];
free_irq(tnapi->irq_vec, tnapi);
+ }
break;
}
}
--
1.7.4.4
^ permalink raw reply related
* Re: [PATCH 0/2] clean up tx_bytes accounting
From: Marc Kleine-Budde @ 2011-11-03 10:42 UTC (permalink / raw)
To: socketcan, netdev, linux-can, Reuben.Dowle
In-Reply-To: <20111103100333.GD317@e-circ.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 696 bytes --]
On 11/03/2011 11:03 AM, Kurt Van Dijck wrote:
> On Thu, Nov 03, 2011 at 10:47:53AM +0100, Marc Kleine-Budde wrote:
>> Hello,
>>
>> what about turning can_get_echo_skb() into a helper function which returns the number
>> of tx'ed bytes.
> That would work.
>
> Next step would be to do the statistics inside can_get_echo_skb(), but that's
> affecting all drivers using it ...
> Kurt
Interesting idea
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply
* [PATCH] net: add wireless TX status socket option
From: Johannes Berg @ 2011-11-03 10:56 UTC (permalink / raw)
To: netdev; +Cc: linux-wireless
From: Johannes Berg <johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
The 802.1X EAPOL handshake hostapd does requires
knowing whether the frame was ack'ed by the peer.
Currently, we fudge this pretty badly by not even
transmitting the frame as a normal data frame but
injecting it with radiotap and getting the status
out of radiotap monitor as well. This is rather
complex, confuses users (mon.wlan0 presence) and
doesn't work with all hardware.
To get rid of that hack, introduce a real wifi TX
status option for data frame transmissions.
This works similar to the existing TX timestamping
in that it reflects the SKB back to the socket's
error queue with a SCM_WIFI_STATUS cmsg that has
an int indicating ACK status (0/1).
Since it is possible that at some point we will
want to have TX timestamping and wifi status in a
single errqueue SKB (there's little point in not
doing that), redefine SO_EE_ORIGIN_TIMESTAMPING
to SO_EE_ORIGIN_TXSTATUS which can collect more
than just the timestamp; keep the old constant
as an alias of course. Currently the internal APIs
don't make that possible, but it wouldn't be hard
to split them up in a way that makes it possible.
Thanks to Neil Horman for helping me figure out
the functions that add the control messages.
Signed-off-by: Johannes Berg <johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
I'd like to merge this through the wireless tree since
some new features sort of depend on it. Thoughts?
arch/alpha/include/asm/socket.h | 3 +++
arch/arm/include/asm/socket.h | 3 +++
arch/avr32/include/asm/socket.h | 3 +++
arch/cris/include/asm/socket.h | 3 +++
arch/frv/include/asm/socket.h | 3 +++
arch/h8300/include/asm/socket.h | 3 +++
arch/ia64/include/asm/socket.h | 3 +++
arch/m32r/include/asm/socket.h | 3 +++
arch/m68k/include/asm/socket.h | 3 +++
arch/mips/include/asm/socket.h | 3 +++
arch/mn10300/include/asm/socket.h | 3 +++
arch/parisc/include/asm/socket.h | 3 +++
arch/powerpc/include/asm/socket.h | 3 +++
arch/s390/include/asm/socket.h | 3 +++
arch/sparc/include/asm/socket.h | 3 +++
arch/xtensa/include/asm/socket.h | 3 +++
include/asm-generic/socket.h | 3 +++
include/linux/errqueue.h | 3 ++-
include/linux/skbuff.h | 19 +++++++++++++++++--
include/net/sock.h | 6 ++++++
net/core/skbuff.c | 20 ++++++++++++++++++++
net/core/sock.c | 9 +++++++++
net/socket.c | 18 ++++++++++++++++++
23 files changed, 123 insertions(+), 3 deletions(-)
--- a/include/asm-generic/socket.h 2011-11-03 10:54:12.000000000 +0100
+++ b/include/asm-generic/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -64,4 +64,7 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
#endif /* __ASM_GENERIC_SOCKET_H */
--- a/net/core/sock.c 2011-11-03 10:54:12.000000000 +0100
+++ b/net/core/sock.c 2011-11-03 11:52:53.000000000 +0100
@@ -743,6 +743,11 @@ set_rcvbuf:
else
sock_reset_flag(sk, SOCK_RXQ_OVFL);
break;
+
+ case SO_WIFI_STATUS:
+ sock_valbool_flag(sk, SOCK_WIFI_STATUS, valbool);
+ break;
+
default:
ret = -ENOPROTOOPT;
break;
@@ -964,6 +969,10 @@ int sock_getsockopt(struct socket *sock,
v.val = !!sock_flag(sk, SOCK_RXQ_OVFL);
break;
+ case SO_WIFI_STATUS:
+ v.val = !!sock_flag(sk, SOCK_WIFI_STATUS);
+ break;
+
default:
return -ENOPROTOOPT;
}
--- a/include/net/sock.h 2011-11-03 10:54:12.000000000 +0100
+++ b/include/net/sock.h 2011-11-03 11:54:03.000000000 +0100
@@ -564,6 +564,7 @@ enum sock_flags {
SOCK_FASYNC, /* fasync() active */
SOCK_RXQ_OVFL,
SOCK_ZEROCOPY, /* buffers from userspace */
+ SOCK_WIFI_STATUS, /* push wifi status to userspace */
};
static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -1705,6 +1706,8 @@ static inline int sock_intr_errno(long t
extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb);
+extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
+ struct sk_buff *skb);
static __inline__ void
sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
@@ -1732,6 +1735,9 @@ sock_recv_timestamp(struct msghdr *msg,
__sock_recv_timestamp(msg, sk, skb);
else
sk->sk_stamp = kt;
+
+ if (sock_flag(sk, SOCK_WIFI_STATUS) && skb->wifi_acked_valid)
+ __sock_recv_wifi_status(msg, sk, skb);
}
extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
--- a/arch/alpha/include/asm/socket.h 2011-11-03 10:54:12.000000000 +0100
+++ b/arch/alpha/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -69,6 +69,9 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
/* O_NONBLOCK clashes with the bits used for socket types. Therefore we
* have to define SOCK_NONBLOCK to a different value here.
*/
--- a/arch/arm/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/arm/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -62,4 +62,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_SOCKET_H */
--- a/arch/avr32/include/asm/socket.h 2011-11-03 10:54:10.000000000 +0100
+++ b/arch/avr32/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -62,4 +62,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* __ASM_AVR32_SOCKET_H */
--- a/arch/cris/include/asm/socket.h 2011-11-03 10:54:12.000000000 +0100
+++ b/arch/cris/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -64,6 +64,9 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_SOCKET_H */
--- a/arch/frv/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/frv/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -62,5 +62,8 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_SOCKET_H */
--- a/arch/h8300/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/h8300/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -62,4 +62,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_SOCKET_H */
--- a/arch/ia64/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/ia64/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -71,4 +71,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_IA64_SOCKET_H */
--- a/arch/m32r/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/m32r/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -62,4 +62,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_M32R_SOCKET_H */
--- a/arch/m68k/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/m68k/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -62,4 +62,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_SOCKET_H */
--- a/arch/mips/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/mips/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -82,6 +82,9 @@ To add: #define SO_REUSEPORT 0x0200 /* A
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#ifdef __KERNEL__
/** sock_type - Socket types
--- a/arch/mn10300/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/mn10300/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -62,4 +62,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_SOCKET_H */
--- a/arch/parisc/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/parisc/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -61,6 +61,9 @@
#define SO_RXQ_OVFL 0x4021
+#define SO_WIFI_STATUS 0x4022
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
/* O_NONBLOCK clashes with the bits used for socket types. Therefore we
* have to define SOCK_NONBLOCK to a different value here.
*/
--- a/arch/powerpc/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/powerpc/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -69,4 +69,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_POWERPC_SOCKET_H */
--- a/arch/s390/include/asm/socket.h 2011-11-03 10:54:10.000000000 +0100
+++ b/arch/s390/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -70,4 +70,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _ASM_SOCKET_H */
--- a/arch/sparc/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/sparc/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -58,6 +58,9 @@
#define SO_RXQ_OVFL 0x0024
+#define SO_WIFI_STATUS 0x0025
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
--- a/arch/xtensa/include/asm/socket.h 2011-11-03 10:54:11.000000000 +0100
+++ b/arch/xtensa/include/asm/socket.h 2011-11-03 11:52:53.000000000 +0100
@@ -73,4 +73,7 @@
#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+
#endif /* _XTENSA_SOCKET_H */
--- a/include/linux/errqueue.h 2011-11-03 10:54:12.000000000 +0100
+++ b/include/linux/errqueue.h 2011-11-03 11:52:53.000000000 +0100
@@ -17,7 +17,8 @@ struct sock_extended_err {
#define SO_EE_ORIGIN_LOCAL 1
#define SO_EE_ORIGIN_ICMP 2
#define SO_EE_ORIGIN_ICMP6 3
-#define SO_EE_ORIGIN_TIMESTAMPING 4
+#define SO_EE_ORIGIN_TXSTATUS 4
+#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
--- a/include/linux/skbuff.h 2011-11-03 10:54:12.000000000 +0100
+++ b/include/linux/skbuff.h 2011-11-03 11:52:53.000000000 +0100
@@ -190,6 +190,9 @@ enum {
/* device driver supports TX zero-copy buffers */
SKBTX_DEV_ZEROCOPY = 1 << 4,
+
+ /* generate wifi status information (where possible) */
+ SKBTX_WIFI_STATUS = 1 << 5,
};
/*
@@ -322,6 +325,8 @@ typedef unsigned char *sk_buff_data_t;
* @queue_mapping: Queue mapping for multiqueue devices
* @ndisc_nodetype: router type (from link layer)
* @ooo_okay: allow the mapping of a socket to a queue to be changed
+ * @wifi_acked_valid: wifi_acked was set
+ * @wifi_acked: whether frame was acked on wifi or not
* @dma_cookie: a cookie to one of several possible DMA operations
* done by skb DMA functions
* @secmark: security marking
@@ -414,10 +419,11 @@ struct sk_buff {
__u8 ndisc_nodetype:2;
#endif
__u8 ooo_okay:1;
+ __u8 wifi_acked_valid:1;
+ __u8 wifi_acked:1;
+ /* 11/13 bit hole (depending on nodetype presence) */
kmemcheck_bitfield_end(flags2);
- /* 0/13 bit hole */
-
#ifdef CONFIG_NET_DMA
dma_cookie_t dma_cookie;
#endif
@@ -2062,6 +2068,15 @@ static inline void skb_tx_timestamp(stru
sw_tx_timestamp(skb);
}
+/**
+ * skb_complete_wifi_ack - deliver skb with wifi status
+ *
+ * @skb: the original outgoing packet
+ * @acked: ack status
+ *
+ */
+void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
+
extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
--- a/net/core/skbuff.c 2011-11-03 10:54:12.000000000 +0100
+++ b/net/core/skbuff.c 2011-11-03 11:52:53.000000000 +0100
@@ -3150,6 +3150,26 @@ void skb_tstamp_tx(struct sk_buff *orig_
}
EXPORT_SYMBOL_GPL(skb_tstamp_tx);
+void skb_complete_wifi_ack(struct sk_buff *skb, bool acked)
+{
+ struct sock *sk = skb->sk;
+ struct sock_exterr_skb *serr;
+ int err;
+
+ skb->wifi_acked_valid = 1;
+ skb->wifi_acked = acked;
+
+ serr = SKB_EXT_ERR(skb);
+ memset(serr, 0, sizeof(*serr));
+ serr->ee.ee_errno = ENOMSG;
+ serr->ee.ee_origin = SO_EE_ORIGIN_TXSTATUS;
+
+ err = sock_queue_err_skb(sk, skb);
+ if (err)
+ kfree_skb(skb);
+}
+EXPORT_SYMBOL_GPL(skb_complete_wifi_ack);
+
/**
* skb_partial_csum_set - set up and verify partial csum values for packet
--- a/net/socket.c 2011-11-03 10:54:12.000000000 +0100
+++ b/net/socket.c 2011-11-03 11:55:06.000000000 +0100
@@ -538,6 +538,8 @@ int sock_tx_timestamp(struct sock *sk, _
*tx_flags |= SKBTX_HW_TSTAMP;
if (sock_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE))
*tx_flags |= SKBTX_SW_TSTAMP;
+ if (sock_flag(sk, SOCK_WIFI_STATUS))
+ *tx_flags |= SKBTX_WIFI_STATUS;
return 0;
}
EXPORT_SYMBOL(sock_tx_timestamp);
@@ -674,6 +676,22 @@ void __sock_recv_timestamp(struct msghdr
}
EXPORT_SYMBOL_GPL(__sock_recv_timestamp);
+void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
+ struct sk_buff *skb)
+{
+ int ack;
+
+ if (!sock_flag(sk, SOCK_WIFI_STATUS))
+ return;
+ if (!skb->wifi_acked_valid)
+ return;
+
+ ack = skb->wifi_acked;
+
+ put_cmsg(msg, SOL_SOCKET, SCM_WIFI_STATUS, sizeof(ack), &ack);
+}
+EXPORT_SYMBOL_GPL(__sock_recv_wifi_status);
+
static inline void sock_recv_drops(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb)
{
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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
* [PATCH net-next 0/4] be2net fixes and updates
From: Padmanabh Ratnakar @ 2011-11-03 11:47 UTC (permalink / raw)
To: netdev; +Cc: Padmanabh Ratnakar
Please apply.
Thanks,
Padmanabh
Padmanabh Ratnakar (4):
be2net: Fix endian issue in RX filter command
be2net: Fix disabling multicast promiscous mode
be2net: Prevent CQ full condition for Lancer
be2net: Add detect UE feature for Lancer
drivers/net/ethernet/emulex/benet/be_cmds.c | 12 ++++-
drivers/net/ethernet/emulex/benet/be_hw.h | 2 +
drivers/net/ethernet/emulex/benet/be_main.c | 68 +++++++++++++++++---------
3 files changed, 55 insertions(+), 27 deletions(-)
^ permalink raw reply
* [PATCH net-next 1/4] be2net: Fix endian issue in RX filter command
From: Padmanabh Ratnakar @ 2011-11-03 11:49 UTC (permalink / raw)
To: netdev; +Cc: Padmanabh Ratnakar
Use cpu_to_le32() for mcast_num field in RX filter command as this
field is of type u32.
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_cmds.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 824b8e6..bd8332c 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1540,7 +1540,7 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
req->if_flags_mask = req->if_flags =
cpu_to_le32(BE_IF_FLAGS_MULTICAST);
- req->mcast_num = cpu_to_le16(netdev_mc_count(adapter->netdev));
+ req->mcast_num = cpu_to_le32(netdev_mc_count(adapter->netdev));
netdev_for_each_mc_addr(ha, adapter->netdev)
memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN);
}
--
1.6.0.2
^ permalink raw reply related
* [PATCH net-next 2/4] be2net: Fix disabling multicast promiscous mode
From: Padmanabh Ratnakar @ 2011-11-03 11:49 UTC (permalink / raw)
To: netdev; +Cc: Padmanabh Ratnakar
If user tries to disable multicast promiscous mode, the adapter remains
in this mode as resetting the multicast promiscous mode was missing
in RX filter command. Fixed this.
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_cmds.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index bd8332c..03fe7cd 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1540,6 +1540,13 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
req->if_flags_mask = req->if_flags =
cpu_to_le32(BE_IF_FLAGS_MULTICAST);
+
+ /* Reset mcast promisc mode if already set by setting mask
+ * and not setting flags field
+ */
+ req->if_flags_mask |=
+ cpu_to_le32(BE_IF_FLAGS_MCAST_PROMISCUOUS);
+
req->mcast_num = cpu_to_le32(netdev_mc_count(adapter->netdev));
netdev_for_each_mc_addr(ha, adapter->netdev)
memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN);
--
1.6.0.2
^ permalink raw reply related
* [PATCH net-next 3/4] be2net: Prevent CQ full condition for Lancer
From: Padmanabh Ratnakar @ 2011-11-03 11:49 UTC (permalink / raw)
To: netdev; +Cc: Padmanabh Ratnakar
Indicate to HW that the CQ is cleaned up before posting new RX buffers.
This prevents the HW to go into CQ full error condition.
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 2180497..30606f5 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1905,6 +1905,8 @@ loop_continue:
be_rx_stats_update(rxo, rxcp);
}
+ be_cq_notify(adapter, rx_cq->id, false, work_done);
+
/* Refill the queue */
if (work_done && atomic_read(&rxo->q.used) < RX_FRAGS_REFILL_WM)
be_post_rx_frags(rxo, GFP_ATOMIC);
@@ -1912,10 +1914,8 @@ loop_continue:
/* All consumed */
if (work_done < budget) {
napi_complete(napi);
- be_cq_notify(adapter, rx_cq->id, true, work_done);
- } else {
- /* More to be consumed; continue with interrupts disabled */
- be_cq_notify(adapter, rx_cq->id, false, work_done);
+ /* Arm CQ */
+ be_cq_notify(adapter, rx_cq->id, true, 0);
}
return work_done;
}
--
1.6.0.2
^ permalink raw reply related
* [PATCH net-next 4/4] be2net: Add detect UE feature for Lancer
From: Padmanabh Ratnakar @ 2011-11-03 11:50 UTC (permalink / raw)
To: netdev; +Cc: Padmanabh Ratnakar
Add code to detect UE in case of Lancer.
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
---
drivers/net/ethernet/emulex/benet/be_cmds.c | 3 +-
drivers/net/ethernet/emulex/benet/be_hw.h | 2 +
drivers/net/ethernet/emulex/benet/be_main.c | 60 ++++++++++++++++++---------
3 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 03fe7cd..2c7b366 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -318,8 +318,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
if (msecs > 4000) {
dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
- if (!lancer_chip(adapter))
- be_detect_dump_ue(adapter);
+ be_detect_dump_ue(adapter);
return -1;
}
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index fbc8a91..f2c89e3 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -48,6 +48,8 @@
/* Lancer SLIPORT_CONTROL SLIPORT_STATUS registers */
#define SLIPORT_STATUS_OFFSET 0x404
#define SLIPORT_CONTROL_OFFSET 0x408
+#define SLIPORT_ERROR1_OFFSET 0x40C
+#define SLIPORT_ERROR2_OFFSET 0x410
#define SLIPORT_STATUS_ERR_MASK 0x80000000
#define SLIPORT_STATUS_RN_MASK 0x01000000
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 30606f5..e0aed18 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -1977,42 +1977,62 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
void be_detect_dump_ue(struct be_adapter *adapter)
{
- u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask;
+ u32 ue_lo = 0, ue_hi = 0, ue_lo_mask = 0, ue_hi_mask = 0;
+ u32 sliport_status = 0, sliport_err1 = 0, sliport_err2 = 0;
u32 i;
- pci_read_config_dword(adapter->pdev,
- PCICFG_UE_STATUS_LOW, &ue_status_lo);
- pci_read_config_dword(adapter->pdev,
- PCICFG_UE_STATUS_HIGH, &ue_status_hi);
- pci_read_config_dword(adapter->pdev,
- PCICFG_UE_STATUS_LOW_MASK, &ue_status_lo_mask);
- pci_read_config_dword(adapter->pdev,
- PCICFG_UE_STATUS_HI_MASK, &ue_status_hi_mask);
+ if (lancer_chip(adapter)) {
+ sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
+ if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
+ sliport_err1 = ioread32(adapter->db +
+ SLIPORT_ERROR1_OFFSET);
+ sliport_err2 = ioread32(adapter->db +
+ SLIPORT_ERROR2_OFFSET);
+ }
+ } else {
+ pci_read_config_dword(adapter->pdev,
+ PCICFG_UE_STATUS_LOW, &ue_lo);
+ pci_read_config_dword(adapter->pdev,
+ PCICFG_UE_STATUS_HIGH, &ue_hi);
+ pci_read_config_dword(adapter->pdev,
+ PCICFG_UE_STATUS_LOW_MASK, &ue_lo_mask);
+ pci_read_config_dword(adapter->pdev,
+ PCICFG_UE_STATUS_HI_MASK, &ue_hi_mask);
- ue_status_lo = (ue_status_lo & (~ue_status_lo_mask));
- ue_status_hi = (ue_status_hi & (~ue_status_hi_mask));
+ ue_lo = (ue_lo & (~ue_lo_mask));
+ ue_hi = (ue_hi & (~ue_hi_mask));
+ }
- if (ue_status_lo || ue_status_hi) {
+ if (ue_lo || ue_hi ||
+ sliport_status & SLIPORT_STATUS_ERR_MASK) {
adapter->ue_detected = true;
adapter->eeh_err = true;
dev_err(&adapter->pdev->dev, "UE Detected!!\n");
}
- if (ue_status_lo) {
- for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) {
- if (ue_status_lo & 1)
+ if (ue_lo) {
+ for (i = 0; ue_lo; ue_lo >>= 1, i++) {
+ if (ue_lo & 1)
dev_err(&adapter->pdev->dev,
"UE: %s bit set\n", ue_status_low_desc[i]);
}
}
- if (ue_status_hi) {
- for (i = 0; ue_status_hi; ue_status_hi >>= 1, i++) {
- if (ue_status_hi & 1)
+ if (ue_hi) {
+ for (i = 0; ue_hi; ue_hi >>= 1, i++) {
+ if (ue_hi & 1)
dev_err(&adapter->pdev->dev,
"UE: %s bit set\n", ue_status_hi_desc[i]);
}
}
+ if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
+ dev_err(&adapter->pdev->dev,
+ "sliport status 0x%x\n", sliport_status);
+ dev_err(&adapter->pdev->dev,
+ "sliport error1 0x%x\n", sliport_err1);
+ dev_err(&adapter->pdev->dev,
+ "sliport error2 0x%x\n", sliport_err2);
+ }
}
static void be_worker(struct work_struct *work)
@@ -2022,7 +2042,7 @@ static void be_worker(struct work_struct *work)
struct be_rx_obj *rxo;
int i;
- if (!adapter->ue_detected && !lancer_chip(adapter))
+ if (!adapter->ue_detected)
be_detect_dump_ue(adapter);
/* when interrupts are not yet enabled, just reap any pending
--
1.6.0.2
^ permalink raw reply related
* [PATCH] net/can/mscan: add listen only mode
From: Marc Kleine-Budde @ 2011-11-03 13:00 UTC (permalink / raw)
To: linux-can; +Cc: netdev, Marc Kleine-Budde
This patch adds listen only mode to the mscan controller.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
...can be pulled via:
The following changes since commit 8b3408f8ee994973869d8ba32c5bf482bc4ddca4:
dp83640: free packet queues on remove (2011-10-24 19:14:50 -0400)
are available in the git repository at:
git://git.pengutronix.de/git/mkl/linux-2.6.git can/mscan-listen-only-for-net-next
Marc Kleine-Budde (1):
net/can/mscan: add listen only mode
drivers/net/can/mscan/mscan.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
index ec4a311..74f3b18 100644
--- a/drivers/net/can/mscan/mscan.c
+++ b/drivers/net/can/mscan/mscan.c
@@ -581,7 +581,10 @@ static int mscan_open(struct net_device *dev)
priv->open_time = jiffies;
- clrbits8(®s->canctl1, MSCAN_LISTEN);
+ if (ctrlmode.flags & CAN_CTRLMODE_LISTENONLY)
+ setbits8(®s->canctl1, MSCAN_LISTEN);
+ else
+ clrbits8(®s->canctl1, MSCAN_LISTEN);
ret = mscan_start(dev);
if (ret)
@@ -690,7 +693,8 @@ struct net_device *alloc_mscandev(void)
priv->can.bittiming_const = &mscan_bittiming_const;
priv->can.do_set_bittiming = mscan_do_set_bittiming;
priv->can.do_set_mode = mscan_do_set_mode;
- priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
+ priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
+ CAN_CTRLMODE_LISTENONLY;
for (i = 0; i < TX_QUEUE_SIZE; i++) {
priv->tx_queue[i].id = i;
--
1.7.4.1
^ permalink raw reply related
* Re: sky2: only 10Mb/s
From: Kirill Smelkov @ 2011-11-03 12:51 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Pavel Matěja, netdev
In-Reply-To: <201110172253.39948.pavel@netsafe.cz>
On Mon, Oct 17, 2011 at 10:53:39PM +0200, Pavel Matěja wrote:
> > > Hi,
> > > I tested new kernel and I have found out I have only 10Mb/s link instead
> > > of 100Mb/s to my router.
> > > If I did the git bisect right it was caused by commit
> > > 4fb99cd6ac4fe6d03a334a6f4ebb2bbfc4b479ed which was submitted by you.
> > >
> > > My card is (lspci -v):
> > > 05:00.0 Ethernet controller: Marvell Technology Group Ltd. Yukon Optima
> > > 88E8059 [PCIe Gigabit Ethernet Controller with AVB] (rev 11)
> > >
> > > Subsystem: ASUSTeK Computer Inc. Device 8439
> > > Flags: bus master, fast devsel, latency 0, IRQ 80
> > > Memory at fe6fc000 (64-bit, non-prefetchable) [size=16K]
> > > I/O ports at b800 [size=256]
> > > Expansion ROM at fe6c0000 [disabled] [size=128K]
> > > Capabilities: [48] Power Management version 3
> > > Capabilities: [5c] MSI: Enable+ Count=1/1 Maskable- 64bit+
> > > Capabilities: [c0] Express Legacy Endpoint, MSI 00
> > > Capabilities: [100] Advanced Error Reporting
> > > Capabilities: [130] Device Serial Number a5-89-6d-ff-ff-30-cf-20
> > > Kernel driver in use: sky2
> > >
> > > I'm quite sure it's related to Yukon Optima because "Ethernet controller:
> > > Marvell Technology Group Ltd. 88E8056 PCI-E Gigabit Ethernet Controller"
> > > in my work computer has 100Mb/s with the same kernel and driver.
> > >
> > > I got no response on netdev@vger.kernel.org.
> > > Can you help me?
> >
> > What is output of dmesg for sky2.
> > dmesg | grep sky2
>
> sky2: driver version 1.28
> sky2 0000:05:00.0: PCI INT A -> GSI 51 (level, low) -> IRQ 51
> sky2 0000:05:00.0: setting latency timer to 64
> sky2 0000:05:00.0: Yukon-2 Optima chip revision 1
> sky2 0000:05:00.0: irq 80 for MSI/MSI-X
> sky2 0000:05:00.0: eth0: addr 20:cf:30:6d:89:a5
> sky2 0000:05:00.0: eth0: enabling interface
> sky2 0000:05:00.0: eth0: Link is up at 10 Mbps, full duplex, flow control both
Similar problem here with 3.1.0 kernel:
# dmesg |grep sky2 (on 3.1.0)
[ 2.417340] sky2: driver version 1.29
[ 2.419844] sky2 0000:02:00.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19
[ 2.422393] sky2 0000:02:00.0: setting latency timer to 64
[ 2.422444] sky2 0000:02:00.0: Yukon-2 Optima chip revision 1
[ 2.425414] sky2 0000:02:00.0: irq 42 for MSI/MSI-X
[ 2.426144] sky2 0000:02:00.0: eth0: addr 1c:c1:de:ae:73:8a
[ 10.836737] sky2 0000:02:00.0: eth0: enabling interface
[ 12.710240] sky2 0000:02:00.0: eth0: Link is up at 10 Mbps, full duplex, flow control rx
it used to setup the link to switch at 1 Gbps with Linux 3.0:
# dmesg |grep sky2 (on 3.0.0)
[ 2.442283] sky2: driver version 1.28
[ 2.444818] sky2 0000:02:00.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19
[ 2.447345] sky2 0000:02:00.0: setting latency timer to 64
[ 2.447397] sky2 0000:02:00.0: Yukon-2 Optima chip revision 1
[ 2.450062] sky2 0000:02:00.0: irq 42 for MSI/MSI-X
[ 2.450712] sky2 0000:02:00.0: eth0: addr 1c:c1:de:ae:73:8a
[ 11.352480] sky2 0000:02:00.0: eth0: enabling interface
[ 13.824540] sky2 0000:02:00.0: eth0: Link is up at 1000 Mbps, full duplex, flow control rx
[ 13.827178] sky2 0000:02:00.0: eth0: Link is up at 1000 Mbps, full duplex, flow control rx
(strangely it puts 2 lines about "link is up")
Reverting 8dc47b9c2c9e9f607268f6bf3e85408123a36bca "sky2: support for
new Optima chipsets (EXPERIMENTAL)" helps.
# lspci -vv -s 02:00.0 (same with both 3.1.0 and 3.0.0)
02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8059 PCI-E Gigabit Ethernet Controller (rev 11)
Subsystem: Hewlett-Packard Company Device 1608
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 42
Region 0: Memory at 50100000 (64-bit, non-prefetchable) [size=16K]
Region 2: I/O ports at 2000 [size=256]
Expansion ROM at 50600000 [disabled] [size=128K]
Capabilities: [48] Power Management version 3
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [50] Vital Product Data
Product Name: Marvell Yukon 88E8059 Gigabit Ethernet Controller
Read-only fields:
[PN] Part number: Yukon 88E8059
[EC] Engineering changes: Rev. 1.0
[MN] Manufacture ID: 4d 61 72 76 65 6c 6c
[SN] Serial number: AbCdEfGAE738A
[CP] Extended capability: 01 10 cc 03
[RV] Reserved: checksum good, 9 byte(s) reserved
Read/write fields:
[RW] Read-write area: 121 byte(s) free
End
Capabilities: [5c] MSI: Enable+ Count=1/1 Maskable- 64bit+
Address: 00000000fee0300c Data: 4169
Capabilities: [c0] Express (v2) Legacy Endpoint, MSI 00
DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 512 bytes
DevSta: CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr+ TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 <1us, L1 <32us
ClockPM+ Surprise- LLActRep- BwNot-
LnkCtl: ASPM Disabled; RCB 128 bytes Disabled- Retrain- CommClk-
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Not Supported, TimeoutDis+
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -6dB
Kernel driver in use: sky2
Thanks beforehand,
Kirill
^ permalink raw reply
* Re: [PATCH 0/2] clean up tx_bytes accounting
From: Oliver Hartkopp @ 2011-11-03 14:27 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: netdev, linux-can, Reuben.Dowle
In-Reply-To: <4EB27026.90301@pengutronix.de>
On 03.11.2011 11:42, Marc Kleine-Budde wrote:
> On 11/03/2011 11:03 AM, Kurt Van Dijck wrote:
>> On Thu, Nov 03, 2011 at 10:47:53AM +0100, Marc Kleine-Budde wrote:
>>> Hello,
>>>
>>> what about turning can_get_echo_skb() into a helper function which returns the number
>>> of tx'ed bytes.
>> That would work.
>>
>> Next step would be to do the statistics inside can_get_echo_skb(), but that's
>> affecting all drivers using it ...
>> Kurt
>
> Interesting idea
Yes, but then the name of the function is not appropriate anymore.
The return value for can_get_echo_skb() gives a silent improvement that can be
adopted by CAN drivers by the time. But hiding more functionality inside this
function may lead to misunderstandings.
Regards,
Oliver
^ permalink raw reply
* Re: [PATCH 0/2] clean up tx_bytes accounting
From: Kurt Van Dijck @ 2011-11-03 14:37 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: Marc Kleine-Budde, netdev, linux-can, Reuben.Dowle
In-Reply-To: <4EB2A4DA.6040800@hartkopp.net>
On Thu, Nov 03, 2011 at 03:27:38PM +0100, Oliver Hartkopp wrote:
> On 03.11.2011 11:42, Marc Kleine-Budde wrote:
>
> > On 11/03/2011 11:03 AM, Kurt Van Dijck wrote:
> >> On Thu, Nov 03, 2011 at 10:47:53AM +0100, Marc Kleine-Budde wrote:
> >>> Hello,
> >>>
> >>> what about turning can_get_echo_skb() into a helper function which returns the number
> >>> of tx'ed bytes.
> >> That would work.
> >>
> >> Next step would be to do the statistics inside can_get_echo_skb(), but that's
> >> affecting all drivers using it ...
> >> Kurt
> >
> > Interesting idea
>
>
> Yes, but then the name of the function is not appropriate anymore.
>
> The return value for can_get_echo_skb() gives a silent improvement that can be
> adopted by CAN drivers by the time. But hiding more functionality inside this
> function may lead to misunderstandings.
That's what I described with the obscure phrase "..." :-)
Marc's proposed patch is indeed easier to digest at the time.
>
Regards,
Kurt
^ permalink raw reply
* TX watchdog fires for ipheth after phone upgraded to iOS 5
From: Ben Hutchings @ 2011-11-03 14:39 UTC (permalink / raw)
To: Diego Giagio, darx; +Cc: 647513, netdev
In-Reply-To: <20111103135222.3555.69704.reportbug@thib.infomaniak.ch>
[-- Attachment #1: Type: text/plain, Size: 921 bytes --]
On Thu, 2011-11-03 at 14:52 +0100, darx wrote:
> Package: linux-2.6
> Version: 3.0.0-3
> Severity: important
> Tags: upstream
>
> Hi,
>
> After IOS5 update on my iphone when I plug it on my Debian, it crashes.
No it doesn't.
> As I'm using it as a modem it's quite problematic.
>
>
> Nov 3 14:16:51 thib kernel: [ 371.824017] ------------[ cut here
> ]------------
> Nov 3 14:16:51 thib kernel: [ 371.824024] WARNING: at /build/buildd-
> linux-2.6_3.0.0-3-amd64-9ClimQ/linux-2.6-3.0.0/debian/build/source_amd64_none/net/sched/sch_generic.c:255
> dev_watchdog+0xe9/0x148()
> Nov 3 14:16:51 thib kernel: [ 371.824027] Hardware name: OptiPlex 780
> Nov 3 14:16:51 thib kernel: [ 371.824029] NETDEV WATCHDOG: eth1 (ipheth):
> transmit queue 0 timed out
[...]
Diego, please can you investigate this.
Ben.
--
Ben Hutchings
Sturgeon's Law: Ninety percent of everything is crap.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: [PATCH] flexcan: Fix CAN_RAW_RECV_OWN_MSGS and CAN_RAW_LOOPBACK
From: Oliver Hartkopp @ 2011-11-03 14:54 UTC (permalink / raw)
To: Reuben Dowle; +Cc: netdev, linux-can
In-Reply-To: <70F6AAAFDC054F41B9994A9BCD3DF64E16FAA8E0@exch01-aklnz.MARINE.NET.INT>
On 02.11.2011 22:31, Reuben Dowle wrote:
>>>
>>> If we change the behaviour of flexcan, I think at91 and slcan should
>> be changed too, because this should be handled consistently across all
>> drivers I would think.
>>
>>
>> At least the slcan driver does not support the correct echo of CAN
>> frames on
>> driver level at all. The slcan driver adapts CAN frames to a serial
>> line CAN
>> adapter where the feedback of successful transmission is not
>> guaranteed/checked within the serial data stream. Therefore the
>> interface flag
>> IFF_ECHO is not set in the slcan driver and the local echo is performed
>> in
>> af_can.c (as a workaround).
>>
>> Regards,
>> Oliver
>
> Thats fine for the echo behaviour, but does not really answer why the slcan
> (and flexcan) driver is setting the stats for tx_packets and tx_bytes at
> different points in the transmission logic. To my mind, either we think the
> packet has transmitted (along with its bytes) so we should increment both,
> or we should increment neither.
In slcan.c the points of incrementing tx_bytes and tx_packets have been
adopted from slip.c where slcan.c heavily bases on.
Indeed one could argument that tx_packets could be incremented in slc_encaps
together with tx_bytes. This means that the packet is sent.
But the packet is surely sent in slcan_write_wakeup(), when tx_packets is
incremented. Unfortunately we do not have the can_dlc available at this point
anymore.
If you think it's worth the effort tx_packets++ could be integrated into
slc_encaps() to have a consistent statistic update (but you don't know whether
the packet hit the serial line entirely).
Additionally slip.c does it the same (inconsistent) way for the reasons above
and therefore i tend not to change it to stay on the current serial netdevices
behaviour (for slcan as only CAN netdevice).
Regards,
Oliver
^ permalink raw reply
* Re: [PATCH 0/2] clean up tx_bytes accounting
From: Marc Kleine-Budde @ 2011-11-03 15:03 UTC (permalink / raw)
To: Oliver Hartkopp, netdev, linux-can, Reuben.Dowle
In-Reply-To: <20111103143752.GB7718@e-circ.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]
On 11/03/2011 03:37 PM, Kurt Van Dijck wrote:
> On Thu, Nov 03, 2011 at 03:27:38PM +0100, Oliver Hartkopp wrote:
>>>> Next step would be to do the statistics inside can_get_echo_skb(), but that's
>>>> affecting all drivers using it ...
>>>> Kurt
>>>
>>> Interesting idea
>>
>>
>> Yes, but then the name of the function is not appropriate anymore.
>>
>> The return value for can_get_echo_skb() gives a silent improvement that can be
>> adopted by CAN drivers by the time. But hiding more functionality inside this
>> function may lead to misunderstandings.
> That's what I described with the obscure phrase "..." :-)
>
> Marc's proposed patch is indeed easier to digest at the time.
+1, I'll repost my fixed branch. Let's first integrate that one.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply
* Bug#647513: TX watchdog fires for ipheth after phone upgraded to iOS 5
From: Thibault Roulet @ 2011-11-03 15:09 UTC (permalink / raw)
To: Ben Hutchings; +Cc: Diego Giagio, 647513, netdev
In-Reply-To: <1320331171.3079.31.camel@deadeye>
On 11/03/2011 03:39 PM, Ben Hutchings wrote:
> On Thu, 2011-11-03 at 14:52 +0100, darx wrote:
>> Package: linux-2.6
>> Version: 3.0.0-3
>> Severity: important
>> Tags: upstream
>>
>> Hi,
>>
>> After IOS5 update on my iphone when I plug it on my Debian, it crashes.
>
> No it doesn't.
well, "crash" is a bit strong. It looks like a kernel hickups
>
>> As I'm using it as a modem it's quite problematic.
>>
>>
>> Nov 3 14:16:51 thib kernel: [ 371.824017] ------------[ cut here
>> ]------------
>> Nov 3 14:16:51 thib kernel: [ 371.824024] WARNING: at /build/buildd-
>> linux-2.6_3.0.0-3-amd64-9ClimQ/linux-2.6-3.0.0/debian/build/source_amd64_none/net/sched/sch_generic.c:255
>> dev_watchdog+0xe9/0x148()
>> Nov 3 14:16:51 thib kernel: [ 371.824027] Hardware name: OptiPlex 780
>> Nov 3 14:16:51 thib kernel: [ 371.824029] NETDEV WATCHDOG: eth1 (ipheth):
>> transmit queue 0 timed out
> [...]
>
> Diego, please can you investigate this.
>
Oh and I can add that I tested on this DELL Optiplex 780 machine and also a small HP mini 5101 laptop (same debian
version). Same error.
Thanks
Thib
^ 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