* [PATCH 3/3] can: c_can: fix calculation of transmitted bytes on tx complete
From: Marc Kleine-Budde @ 2013-11-25 20:56 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Holger Bechtold, Marc Kleine-Budde
In-Reply-To: <1385412987-31205-1-git-send-email-mkl@pengutronix.de>
From: Holger Bechtold <Holger.Bechtold@gmx.net>
The number of bytes transmitted was not updated correctly, if several CAN
messages (with different length) were transmitted in one 'bunch'. Thus
programs like 'ifconfig' showed wrong transmit byte counts. Reason was, that
the message object whose DLC is to be read was not necessarily the active one
at the time when
priv->read_reg(priv, C_CAN_IFACE(MSGCTRL_REG, 0)) & IF_MCONT_DLC_MASK;
was executed.
Signed-off-by: Holger Bechtold <Holger.Bechtold@gmx.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/c_can/c_can.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index e59c42b..77061ee 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -763,6 +763,7 @@ static void c_can_do_tx(struct net_device *dev)
if (!(val & (1 << (msg_obj_no - 1)))) {
can_get_echo_skb(dev,
msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
+ c_can_object_get(dev, 0, msg_obj_no, IF_COMM_ALL);
stats->tx_bytes += priv->read_reg(priv,
C_CAN_IFACE(MSGCTRL_REG, 0))
& IF_MCONT_DLC_MASK;
--
1.8.5.rc0
^ permalink raw reply related
* [PATCH 2/3] can: c_can: don't call pm_runtime_get_sync() from interrupt context
From: Marc Kleine-Budde @ 2013-11-25 20:56 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Marc Kleine-Budde, Andrew Glen,
linux-stable
In-Reply-To: <1385412987-31205-1-git-send-email-mkl@pengutronix.de>
The c_can driver contians a callpath (c_can_poll -> c_can_state_change ->
c_can_get_berr_counter) which may call pm_runtime_get_sync() from the IRQ
handler, which is not allowed and results in "BUG: scheduling while atomic".
This problem is fixed by introducing __c_can_get_berr_counter, which will not
call pm_runtime_get_sync().
Reported-by: Andrew Glen <AGlen@bepmarine.com>
Tested-by: Andrew Glen <AGlen@bepmarine.com>
Signed-off-by: Andrew Glen <AGlen@bepmarine.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/c_can/c_can.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index e3fc07c..e59c42b 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -712,22 +712,31 @@ static int c_can_set_mode(struct net_device *dev, enum can_mode mode)
return 0;
}
-static int c_can_get_berr_counter(const struct net_device *dev,
- struct can_berr_counter *bec)
+static int __c_can_get_berr_counter(const struct net_device *dev,
+ struct can_berr_counter *bec)
{
unsigned int reg_err_counter;
struct c_can_priv *priv = netdev_priv(dev);
- c_can_pm_runtime_get_sync(priv);
-
reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG);
bec->rxerr = (reg_err_counter & ERR_CNT_REC_MASK) >>
ERR_CNT_REC_SHIFT;
bec->txerr = reg_err_counter & ERR_CNT_TEC_MASK;
+ return 0;
+}
+
+static int c_can_get_berr_counter(const struct net_device *dev,
+ struct can_berr_counter *bec)
+{
+ struct c_can_priv *priv = netdev_priv(dev);
+ int err;
+
+ c_can_pm_runtime_get_sync(priv);
+ err = __c_can_get_berr_counter(dev, bec);
c_can_pm_runtime_put_sync(priv);
- return 0;
+ return err;
}
/*
@@ -872,7 +881,7 @@ static int c_can_handle_state_change(struct net_device *dev,
if (unlikely(!skb))
return 0;
- c_can_get_berr_counter(dev, &bec);
+ __c_can_get_berr_counter(dev, &bec);
reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG);
rx_err_passive = (reg_err_counter & ERR_CNT_RP_MASK) >>
ERR_CNT_RP_SHIFT;
--
1.8.5.rc0
^ permalink raw reply related
* pull-request: can 2013-11-25
From: Marc Kleine-Budde @ 2013-11-25 20:56 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel
Hello David,
here's a pull request for v3.13, i.e. net/master. It consists of a patch by
Oliver Hartkopp which fixes some corner cases in the interrupt handler of the
sja1000 driver. Then there are two patches for the c_can dirver. One by me,
which fixes a runtime pm related "scheduling while atomic" error and patch by
Holger Bechtold that fixes the calculation of the transmitted bytes.
regards,
Marc
---
The following changes since commit 2c7a9dc1641664173211c4ebc5db510a08684c46:
be2net: Avoid programming permenant MAC by BE3-R VFs (2013-11-23 15:11:07 -0800)
are available in the git repository at:
git://gitorious.org/linux-can/linux-can.git fixes-for-3.13
for you to fetch changes up to 7ee330c7b3b738847bf297912b371bbcec3bc994:
can: c_can: fix calculation of transmitted bytes on tx complete (2013-11-25 21:48:54 +0100)
----------------------------------------------------------------
Holger Bechtold (1):
can: c_can: fix calculation of transmitted bytes on tx complete
Marc Kleine-Budde (1):
can: c_can: don't call pm_runtime_get_sync() from interrupt context
Oliver Hartkopp (1):
can: sja1000: fix {pre,post}_irq() handling and IRQ handler return value
drivers/net/can/c_can/c_can.c | 22 ++++++++++++++++------
drivers/net/can/sja1000/sja1000.c | 17 +++++++++--------
2 files changed, 25 insertions(+), 14 deletions(-)
^ permalink raw reply
* Re: [PATCH 00/16] wl1251 patches from linux-n900 tree
From: Pali Rohár @ 2013-11-25 19:54 UTC (permalink / raw)
To: Felipe Contreras
Cc: Luciano Coelho, John W. Linville, Johannes Berg, David S. Miller,
linux-wireless Mailing List, netdev, Linux Kernel Mailing List,
freemangordon, aaro.koskinen, Pavel Machek, sre, joni.lapilainen
In-Reply-To: <CAMP44s1ADLHagfPa8kmx_wSyqvLf7pcN_UuOqoPShYx2HPUQXA@mail.gmail.com>
[-- Attachment #1: Type: Text/Plain, Size: 1420 bytes --]
On Friday 08 November 2013 15:20:07 Felipe Contreras wrote:
> On Sat, Oct 26, 2013 at 3:33 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> > Hello, I'm sending wl1251 patches from linux-n900 tree [1]
> > for comments. More patches come from David's monitor &
> > packet injection work. Patches are tested with 3.12 rc5
> > kernel on Nokia N900.
> >
> > [1] - https://gitorious.org/linux-n900/linux-n900
>
> How did you test these patches? I get a panic loop immediately
> after I bring the interface loop in monitor mode (v3.12).
Hi!
now I can reproduce this crash with 3.12-rc5 kernel. Problem
looks like irrelevant to this patch series and is present in 3.12
kernel. There is possible NULL pointer dereference.
With this patch I'm not able to reproduce this bug:
diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c
index 192cebd..db01053 100644
--- a/drivers/net/wireless/ti/wl1251/event.c
+++ b/drivers/net/wireless/ti/wl1251/event.c
@@ -124,7 +124,7 @@ static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox)
return ret;
}
- if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) {
+ if (wl->vif && vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) {
wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT");
/* indicate to the stack, that beacons have been lost */
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related
* Re: [lm-sensors] [PATCH 0/5] net: hwmon fixes
From: Jean Delvare @ 2013-11-25 19:34 UTC (permalink / raw)
To: Ben Hutchings
Cc: Guenter Roeck, Nithin Nayak Sujir, e1000-devel, netdev,
Michael Chan, Bruce Allan, Jesse Brandeburg, lm-sensors,
Greg Rose, Jeff Kirsher, Don Skidmore, Carolyn Wyborny,
David S. Miller
In-Reply-To: <1385405786.1586.44.camel@bwh-desktop.uk.level5networks.com>
On Mon, 25 Nov 2013 18:56:26 +0000, Ben Hutchings wrote:
> On Mon, 2013-11-25 at 19:23 +0100, Jean Delvare wrote:
> > On Mon, 25 Nov 2013 17:15:50 +0000, Ben Hutchings wrote:
> > > We don't attach them to the hwmon device either, and I would rather not
> > > change that yet because lm-sensors 2 is still widely used.
> >
> > Mouahahahah.
> >
> > No, seriously, it's not.
>
> RHEL 5 has it, and that is widely used - even with recent mainline
> kernels, in some cases.
RHEL 5 comes with kernel 2.6.18, which isn't exactly recent. I very
much doubt a significant share of users dare to use a brand new kernel
on such an old distribution. And if they do, then there are several
packages which need to be updated (udev, kernel-firmware...),
lm-sensors is only one of them, and the user should be aware of that.
> > And lm-sensors 2 doesn't even support your
> > device so this is a totally moot point.
>
> I thought it did work with arbitrary devices providing the right
> attributes, but obviously I misremembered.
This is how lm-sensors 3 works. But lm-sensors 2 needs explicit support
for each and every device. Which is exactly why version 2 sucked and
nobody should be using it any longer.
> So there's no reason not to change. Thanks.
Good to hear :)
--
Jean Delvare
^ permalink raw reply
* Re: [PATCH IPROUTE] ip: Add HSR support
From: Arvid Brodin @ 2013-11-25 19:20 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev@vger.kernel.org, Stephen Hemminger
In-Reply-To: <20131122173334.0ae81887@nehalam.linuxnetplumber.net>
On 2013-11-23 02:33, Stephen Hemminger wrote:
> On Fri, 8 Nov 2013 20:34:36 +0100
> Arvid Brodin <arvid.brodin@xdin.com> wrote:
>
>> This patch adds basic support for High-Availability Seamless
>> Redundancy (HSR) network devices.
>>
>> Signed-off-by: Arvid Brodin <arvid.brodin@xdin.com>
>
> Will not apply to current iproute source. The header files have been updated
> to be from current upstream (linus), and the IFLA_HSR doesn't match.
So, what's the least annoying (for everyone) way of getting the updated header
file into the kernel _and_ iproute?
I guess the iproute patch should be against net-next-for-3.13? (The HSR kernel
patch was picked up into 3.13-rc1.)
And the updated kernel patch (with the .fill_info routine implemented and the
updated header file), where do I send that?
--
Arvid Brodin | Consultant (Linux)
ALTEN | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden
arvid.brodin@alten.se | www.alten.se/en/
________________________________
Xdin is changing its name. From 25 November 2013 we will be known as Alten. Read more at www.alten.se
^ permalink raw reply
* Re: [lm-sensors] [PATCH 0/5] net: hwmon fixes
From: Ben Hutchings @ 2013-11-25 18:56 UTC (permalink / raw)
To: Jean Delvare
Cc: Guenter Roeck, Nithin Nayak Sujir, e1000-devel, netdev,
Michael Chan, Bruce Allan, Jesse Brandeburg, lm-sensors,
Greg Rose, Jeff Kirsher, Don Skidmore, Carolyn Wyborny,
David S. Miller
In-Reply-To: <20131125192334.580400ef@endymion.delvare>
On Mon, 2013-11-25 at 19:23 +0100, Jean Delvare wrote:
> On Mon, 25 Nov 2013 17:15:50 +0000, Ben Hutchings wrote:
> > On Sat, 2013-11-23 at 09:07 -0800, Guenter Roeck wrote:
> > > Yes, I know about that one. It concluded that it would be too invasive
> > > and risky to try to fix it without access to hardware to test the results.
> > > That is why I said "fixes _most_ of the problems".
> > >
> > > As for why the attributes are created after registration, it was most likely
> > > because there was no API available to attach the sysfs attributes to
> > > the hwmon device in a clean way. The new APIs fix that.
> >
> > We don't attach them to the hwmon device either, and I would rather not
> > change that yet because lm-sensors 2 is still widely used.
>
> Mouahahahah.
>
> No, seriously, it's not.
RHEL 5 has it, and that is widely used - even with recent mainline
kernels, in some cases.
> And lm-sensors 2 doesn't even support your
> device so this is a totally moot point.
I thought it did work with arbitrary devices providing the right
attributes, but obviously I misremembered. So there's no reason not to
change. Thanks.
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] macvtap: fix tx_dropped counting error
From: Vlad Yasevich @ 2013-11-25 18:29 UTC (permalink / raw)
To: Jason Wang, davem, netdev, linux-kernel; +Cc: Michael S. Tsirkin, Eric Dumazet
In-Reply-To: <1385371144-11071-1-git-send-email-jasowang@redhat.com>
On 11/25/2013 04:19 AM, Jason Wang wrote:
> After commit 8ffab51b3dfc54876f145f15b351c41f3f703195
> (macvlan: lockless tx path), tx stat counter were converted to percpu stat
> structure. So we need use to this also for tx_dropped in macvtap. Otherwise, the
> management won't notice the dropping packet in macvtap tx path.
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Vlad Yasevich <vyasevic@redhat.com>
Acked-by: Vlad Yasevich <vyasevic@redhat.com>
-vlad
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/net/macvtap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index dc76670..0605da8 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -744,7 +744,7 @@ err:
> rcu_read_lock();
> vlan = rcu_dereference(q->vlan);
> if (vlan)
> - vlan->dev->stats.tx_dropped++;
> + this_cpu_inc(vlan->pcpu_stats->tx_dropped);
> rcu_read_unlock();
>
> return err;
>
^ permalink raw reply
* Re: [lm-sensors] [PATCH 0/5] net: hwmon fixes
From: Jean Delvare @ 2013-11-25 18:23 UTC (permalink / raw)
To: Ben Hutchings
Cc: Guenter Roeck, Nithin Nayak Sujir, e1000-devel, netdev,
Michael Chan, Bruce Allan, Jesse Brandeburg, lm-sensors,
Greg Rose, Jeff Kirsher, Don Skidmore, Carolyn Wyborny,
David S. Miller
In-Reply-To: <1385399750.1586.40.camel@bwh-desktop.uk.level5networks.com>
On Mon, 25 Nov 2013 17:15:50 +0000, Ben Hutchings wrote:
> On Sat, 2013-11-23 at 09:07 -0800, Guenter Roeck wrote:
> > Yes, I know about that one. It concluded that it would be too invasive
> > and risky to try to fix it without access to hardware to test the results.
> > That is why I said "fixes _most_ of the problems".
> >
> > As for why the attributes are created after registration, it was most likely
> > because there was no API available to attach the sysfs attributes to
> > the hwmon device in a clean way. The new APIs fix that.
>
> We don't attach them to the hwmon device either, and I would rather not
> change that yet because lm-sensors 2 is still widely used.
Mouahahahah.
No, seriously, it's not. And lm-sensors 2 doesn't even support your
device so this is a totally moot point.
--
Jean Delvare
^ permalink raw reply
* Re: bridge vlan filtering question
From: Vlad Yasevich @ 2013-11-25 18:19 UTC (permalink / raw)
To: Mike Rapoport, netdev
In-Reply-To: <CAF1J0HPkZgiLCY2eiUUWb+t8dJSr2SrUsPtCeHPOxRqU9G6TbA@mail.gmail.com>
On 11/25/2013 02:54 AM, Mike Rapoport wrote:
> Hi all,
>
> I'm trying to use brigde vlan filtering and I cannot get any traffic
> through the bridge.
> After looking at the code I've noticed that br_get_pvid is always
> returning VLAN_N_VID because VLAN_TAG_PRESENT is never set in the pvid
> field of net_port_vlans.
> Am I missing something or is this an actual bug?
>
It's a bug. It's been fixed upstream and has been queued to stable.
commit d1c6c708c4da9d104e0b7c116654cb449bff9b5f
Author: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Date: Wed Oct 16 17:07:15 2013 +0900
bridge: Fix the way the PVID is referenced
-vlad
^ permalink raw reply
* Re: [V2 PATCH] sctp: Restore 'resent' bit to avoid retransmitted chunks for RTT measurements
From: Vlad Yasevich @ 2013-11-25 18:17 UTC (permalink / raw)
To: Xufeng Zhang, nhorman, davem; +Cc: linux-sctp, netdev, linux-kernel
In-Reply-To: <1385350017-11324-1-git-send-email-xufeng.zhang@windriver.com>
On 11/24/2013 10:26 PM, Xufeng Zhang wrote:
> Currently retransmitted DATA chunks could also be used for
> RTT measurements since there are no flag to identify whether
> the transmitted DATA chunk is a new one or a retransmitted one.
> This problem is introduced by commit ae19c5486 ("sctp: remove
> 'resent' bit from the chunk") which inappropriately removed the
> 'resent' bit completely, instead of doing this, we should set
> the resent bit only for the retransmitted DATA chunks.
>
> Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Thanks
-vlad
> ---
> v1->v2:
> Rmoved initialization for resent bit.
> Combined two if clause
>
> include/net/sctp/structs.h | 1 +
> net/sctp/output.c | 3 ++-
> net/sctp/outqueue.c | 3 +++
> 3 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> index 2174d8d..ea0ca5f 100644
> --- a/include/net/sctp/structs.h
> +++ b/include/net/sctp/structs.h
> @@ -629,6 +629,7 @@ struct sctp_chunk {
> #define SCTP_NEED_FRTX 0x1
> #define SCTP_DONT_FRTX 0x2
> __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */
> + resent:1, /* Has this chunk ever been resent. */
> has_tsn:1, /* Does this chunk have a TSN yet? */
> has_ssn:1, /* Does this chunk have a SSN yet? */
> singleton:1, /* Only chunk in the packet? */
> diff --git a/net/sctp/output.c b/net/sctp/output.c
> index e650978..0e2644d 100644
> --- a/net/sctp/output.c
> +++ b/net/sctp/output.c
> @@ -474,10 +474,11 @@ int sctp_packet_transmit(struct sctp_packet *packet)
> * for a given destination transport address.
> */
>
> - if (!tp->rto_pending) {
> + if (!chunk->resent && !tp->rto_pending) {
> chunk->rtt_in_progress = 1;
> tp->rto_pending = 1;
> }
> +
> has_data = 1;
> }
>
> diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
> index 94df758..70f4f56 100644
> --- a/net/sctp/outqueue.c
> +++ b/net/sctp/outqueue.c
> @@ -446,6 +446,8 @@ void sctp_retransmit_mark(struct sctp_outq *q,
> transport->rto_pending = 0;
> }
>
> + chunk->resent = 1;
> +
> /* Move the chunk to the retransmit queue. The chunks
> * on the retransmit queue are always kept in order.
> */
> @@ -1375,6 +1377,7 @@ static void sctp_check_transmitted(struct sctp_outq *q,
> * instance).
> */
> if (!tchunk->tsn_gap_acked &&
> + !tchunk->resent &&
> tchunk->rtt_in_progress) {
> tchunk->rtt_in_progress = 0;
> rtt = jiffies - tchunk->sent_at;
>
^ permalink raw reply
* Re: [lm-sensors] [PATCH 5/5] ixgbe: Start temperature sensor attribute index with 1
From: Guenter Roeck @ 2013-11-25 18:08 UTC (permalink / raw)
To: Jean Delvare
Cc: netdev, Nithin Nayak Sujir, e1000-devel, Don Skidmore,
Bruce Allan, Jesse Brandeburg, lm-sensors, Greg Rose,
Jeff Kirsher, Michael Chan, Carolyn Wyborny, David S. Miller
In-Reply-To: <20131123140158.47ce529d@endymion.delvare>
On Sat, Nov 23, 2013 at 02:01:58PM +0100, Jean Delvare wrote:
> On Fri, 22 Nov 2013 22:08:01 -0800, Guenter Roeck wrote:
> > Per hwmon ABI, temperature sensor attribute index starts with 1, not 0.
> >
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> > drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c
> > index 3081974..e74ae36 100644
> > --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c
> > +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c
> > @@ -118,22 +118,22 @@ static int ixgbe_add_hwmon_attr(struct ixgbe_adapter *adapter,
> > case IXGBE_HWMON_TYPE_LOC:
> > ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_location;
> > snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
> > - "temp%u_label", offset);
> > + "temp%u_label", offset + 1);
> > break;
> > case IXGBE_HWMON_TYPE_TEMP:
> > ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_temp;
> > snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
> > - "temp%u_input", offset);
> > + "temp%u_input", offset + 1);
> > break;
> > case IXGBE_HWMON_TYPE_CAUTION:
> > ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_cautionthresh;
> > snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
> > - "temp%u_max", offset);
> > + "temp%u_max", offset + 1);
> > break;
> > case IXGBE_HWMON_TYPE_MAX:
> > ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_maxopthresh;
> > snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
> > - "temp%u_crit", offset);
> > + "temp%u_crit", offset + 1);
> > break;
> > default:
> > rc = -EPERM;
>
> Reviewed-by: Jean Delvare <khali@linux-fr.org>
>
Hi Jean,
thanks a lot for the reviews!
Guenter
^ permalink raw reply
* From: Mr Kenta Yoshi
From: kentalyoshiml @ 2013-11-25 17:44 UTC (permalink / raw)
To: Recipients
Dear Friend,
I would respectfully request that you keep the contents of this mail confidential and respect the integrity of the information you come by as a result of this email. I contact you independently and no one is informed of this communication.
I know this will be a surprise to you, i am contacting you from Japan due to your unique name you have with our deceased client who invested a lot of money in our bank here in Japan, I will want you to send me your full names again for proper verification process, to be sure i am contacting the right person.
Looking forward to your reply. I will advised you should contact me via this email; kentayoshimail@yahoo.co.jp
Regards,
Kenta Yoshi
^ permalink raw reply
* Re: [PATCH 0/5] net: hwmon fixes
From: Guenter Roeck @ 2013-11-25 17:48 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev, David S. Miller, Jeff Kirsher, Jesse Brandeburg,
Bruce Allan, Carolyn Wyborny, Don Skidmore, Greg Rose,
Nithin Nayak Sujir, Michael Chan, e1000-devel, lm-sensors
In-Reply-To: <1385399750.1586.40.camel@bwh-desktop.uk.level5networks.com>
On 11/25/2013 09:15 AM, Ben Hutchings wrote:
> On Sat, 2013-11-23 at 09:07 -0800, Guenter Roeck wrote:
>> On 11/23/2013 08:48 AM, Ben Hutchings wrote:
>>> On Fri, 2013-11-22 at 22:07 -0800, Guenter Roeck wrote:
>>>> The hwmon subsystem is used by various network drivers to report temperature
>>>> sensor and other information. Unfortunately, its use is often not correct.
>>>> Typical errors are that the mandatory name sysfs attribute is not created,
>>>> that the temperature sensor index starts with 0 instead of 1, and/or that
>>>> sysfs attributes are created after the hwmon device was created.
>>>
>>> As it happens, I was just looking at what we do in sfc
>>> (drivers/net/ethernet/sfc/mcdi_mon.c) and wondering why I made it create
>>> the hwmon device before the attributes. I think I avoided the other
>>> bugs though.
>>>
>> Hi Ben,
>>
>> Yes, I know about that one. It concluded that it would be too invasive
>> and risky to try to fix it without access to hardware to test the results.
>> That is why I said "fixes _most_ of the problems".
>>
>> As for why the attributes are created after registration, it was most likely
>> because there was no API available to attach the sysfs attributes to
>> the hwmon device in a clean way. The new APIs fix that.
>
> We don't attach them to the hwmon device either, and I would rather not
> change that yet because lm-sensors 2 is still widely used.
>
Hmm .. then there should be no good reason to create the attributes
only after hwmon registration.
As for lm-sensors 2 ... really ? Seems odd that people would use the
latest kernel with 5+ years old versions of applications / libraries.
but I guess the world is full of such oddities, so maybe I should not
be surprised.
Note that the drivers in the hwmon subsystem are expected to move
to the new API over time, and some of them already did. New drivers
will likely not work with lm-sensors 2. So it may be time for those
still using lm-sensors 2 to consider an update, at least if they plan
to use those drivers with the latest kernel.
Thanks,
Guenter
^ permalink raw reply
* Re: [PATCH 0/5] net: hwmon fixes
From: Ben Hutchings @ 2013-11-25 17:15 UTC (permalink / raw)
To: Guenter Roeck
Cc: netdev, David S. Miller, Jeff Kirsher, Jesse Brandeburg,
Bruce Allan, Carolyn Wyborny, Don Skidmore, Greg Rose,
Nithin Nayak Sujir, Michael Chan, e1000-devel, lm-sensors
In-Reply-To: <5290E0B9.1030606@roeck-us.net>
On Sat, 2013-11-23 at 09:07 -0800, Guenter Roeck wrote:
> On 11/23/2013 08:48 AM, Ben Hutchings wrote:
> > On Fri, 2013-11-22 at 22:07 -0800, Guenter Roeck wrote:
> >> The hwmon subsystem is used by various network drivers to report temperature
> >> sensor and other information. Unfortunately, its use is often not correct.
> >> Typical errors are that the mandatory name sysfs attribute is not created,
> >> that the temperature sensor index starts with 0 instead of 1, and/or that
> >> sysfs attributes are created after the hwmon device was created.
> >
> > As it happens, I was just looking at what we do in sfc
> > (drivers/net/ethernet/sfc/mcdi_mon.c) and wondering why I made it create
> > the hwmon device before the attributes. I think I avoided the other
> > bugs though.
> >
> Hi Ben,
>
> Yes, I know about that one. It concluded that it would be too invasive
> and risky to try to fix it without access to hardware to test the results.
> That is why I said "fixes _most_ of the problems".
>
> As for why the attributes are created after registration, it was most likely
> because there was no API available to attach the sysfs attributes to
> the hwmon device in a clean way. The new APIs fix that.
We don't attach them to the hwmon device either, and I would rather not
change that yet because lm-sensors 2 is still widely used.
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 1/1] xen-netback: include definition of csum_ipv6_magic
From: Ian Campbell @ 2013-11-25 16:54 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: Wei Liu, xen-devel, netdev, linux-kernel
In-Reply-To: <1385398354-21636-1-git-send-email-apw@canonical.com>
On Mon, 2013-11-25 at 16:52 +0000, Andy Whitcroft wrote:
> We are now using csum_ipv6_magic, include the appropriate header.
> Avoids the following error:
>
> drivers/net/xen-netback/netback.c:1313:4: error: implicit declaration of function 'csum_ipv6_magic' [-Werror=implicit-function-declaration]
> tcph->check = ~csum_ipv6_magic(&ipv6h->saddr,
>
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Thanks!
> ---
> drivers/net/xen-netback/netback.c | 1 +
> 1 file changed, 1 insertion(+)
>
> Found while trying to couple latest kernels for arm64 platforms.
> Looks like it got missed in the transition.
>
> -apw
>
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index 919b650..64f0e0d 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -39,6 +39,7 @@
> #include <linux/udp.h>
>
> #include <net/tcp.h>
> +#include <net/ip6_checksum.h>
>
> #include <xen/xen.h>
> #include <xen/events.h>
^ permalink raw reply
* [PATCH 1/1] xen-netback: include definition of csum_ipv6_magic
From: Andy Whitcroft @ 2013-11-25 16:52 UTC (permalink / raw)
To: Ian Campbell, Wei Liu, xen-devel; +Cc: Andy Whitcroft, netdev, linux-kernel
We are now using csum_ipv6_magic, include the appropriate header.
Avoids the following error:
drivers/net/xen-netback/netback.c:1313:4: error: implicit declaration of function 'csum_ipv6_magic' [-Werror=implicit-function-declaration]
tcph->check = ~csum_ipv6_magic(&ipv6h->saddr,
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
drivers/net/xen-netback/netback.c | 1 +
1 file changed, 1 insertion(+)
Found while trying to couple latest kernels for arm64 platforms.
Looks like it got missed in the transition.
-apw
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 919b650..64f0e0d 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -39,6 +39,7 @@
#include <linux/udp.h>
#include <net/tcp.h>
+#include <net/ip6_checksum.h>
#include <xen/xen.h>
#include <xen/events.h>
--
1.8.3.2
^ permalink raw reply related
* [PATCH] rtlwifi: rtl8188ee: Fix typo in code
From: Larry Finger @ 2013-11-25 16:45 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Larry Finger, netdev, David Binderman, Stable
The static analyser "cppcheck" shows the following typo:
drivers/net/wireless/rtlwifi/rtl8188ee/dm.c:1081]: (style) Same expression on both sides of '!='.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: David Binderman <dcb314@hotmail.com>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Stable <stable@vger.kernel.org> [3.10+]
---
drivers/net/wireless/rtlwifi/rtl8188ee/dm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c b/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c
index 21a5cf0..a6184b6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c
@@ -1078,7 +1078,7 @@ static void rtl88e_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
rtldm->swing_flag_ofdm = true;
}
- if (rtldm->swing_idx_cck != rtldm->swing_idx_cck) {
+ if (rtldm->swing_idx_cck_cur != rtldm->swing_idx_cck) {
rtldm->swing_idx_cck_cur = rtldm->swing_idx_cck;
rtldm->swing_flag_cck = true;
}
--
1.8.4
^ permalink raw reply related
* [PATCH] ipv6 addrconf: source address selection, Rule 7: Prefer temporary addresses (RFC 6724)
From: fx.lebail @ 2013-11-25 16:16 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, Francois-Xavier Le Bail
The RFC 6724 change the default recommendation for source address selection
Rule 7 to prefer temporary addresses rather than public addresses,
while providing an administrative override.
The administrative override is based on the prefer_src_public sysctl.
Signed-off-by: Francois-Xavier Le Bail <fx.lebail@yahoo.com>
---
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 3c12d9a..0f7ecaa 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -1256,13 +1256,15 @@ router_solicitations - INTEGER
use_tempaddr - INTEGER
Preference for Privacy Extensions (RFC3041).
<= 0 : disable Privacy Extensions
- == 1 : enable Privacy Extensions, but prefer public
- addresses over temporary addresses.
- > 1 : enable Privacy Extensions and prefer temporary
- addresses over public addresses.
+ >= 1 : enable Privacy Extensions and prefer temporary
+ addresses over public addresses (RFC 6724).
Default: 0 (for most devices)
-1 (for point-to-point devices and loopback devices)
+prefer_src_public - BOOLEAN
+ Prefer public addresses over temporary addresses.
+ Default: FALSE
+
temp_valid_lft - INTEGER
valid lifetime (in seconds) for temporary addresses.
Default: 604800 (7 days)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 5d89d1b..c90a1e6 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -49,6 +49,7 @@ struct ipv6_devconf {
__s32 force_tllao;
__s32 ndisc_notify;
__s32 suppress_frag_ndisc;
+ __s32 prefer_src_public;
void *sysctl;
};
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index 593b0e3..37dabcc 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -163,6 +163,7 @@ enum {
DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL,
DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
DEVCONF_SUPPRESS_FRAG_NDISC,
+ DEVCONF_PREFER_SRC_PUBLIC,
DEVCONF_MAX
};
diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
index 6d67213..0034b48 100644
--- a/include/uapi/linux/sysctl.h
+++ b/include/uapi/linux/sysctl.h
@@ -568,6 +568,7 @@ enum {
NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
NET_IPV6_PROXY_NDP=23,
NET_IPV6_ACCEPT_SOURCE_ROUTE=25,
+ NET_IPV6_PREFER_SRC_PUBLIC = 26,
__NET_IPV6_MAX
};
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 12c97d8..b0127cd 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -197,6 +197,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
.disable_ipv6 = 0,
.accept_dad = 1,
.suppress_frag_ndisc = 1,
+ .prefer_src_public = 0,
};
static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
@@ -233,6 +234,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
.disable_ipv6 = 0,
.accept_dad = 1,
.suppress_frag_ndisc = 1,
+ .prefer_src_public = 0,
};
/* Check if a valid qdisc is available */
@@ -1245,12 +1247,14 @@ static int ipv6_get_saddr_eval(struct net *net,
break;
case IPV6_SADDR_RULE_PRIVACY:
{
- /* Rule 7: Prefer public address
- * Note: prefer temporary address if use_tempaddr >= 2
+ /* Rule 7: Prefer temporary addresses (updated in RFC 6724)
+ * Note: test on use_tempaddr >= 1 to avoid changing previous
+ * behaviour using > 1 value for the same purpose
*/
int preftmp = dst->prefs & (IPV6_PREFER_SRC_PUBLIC|IPV6_PREFER_SRC_TMP) ?
!!(dst->prefs & IPV6_PREFER_SRC_TMP) :
- score->ifa->idev->cnf.use_tempaddr >= 2;
+ score->ifa->idev->cnf.use_tempaddr >= 1 &&
+ !score->ifa->idev->cnf.prefer_src_public;
ret = (!(score->ifa->flags & IFA_F_TEMPORARY)) ^ preftmp;
break;
}
@@ -4120,6 +4124,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
array[DEVCONF_FORCE_TLLAO] = cnf->force_tllao;
array[DEVCONF_NDISC_NOTIFY] = cnf->ndisc_notify;
array[DEVCONF_SUPPRESS_FRAG_NDISC] = cnf->suppress_frag_ndisc;
+ array[DEVCONF_PREFER_SRC_PUBLIC] = cnf->prefer_src_public;
}
static inline size_t inet6_ifla6_size(void)
@@ -4939,6 +4944,13 @@ static struct addrconf_sysctl_table
.proc_handler = proc_dointvec
},
{
+ .procname = "prefer_src_public",
+ .data = &ipv6_devconf.prefer_src_public,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+ {
/* sentinel */
}
},
^ permalink raw reply related
* Re: [PATCH v2 3/6] net: MOXA ART: add ethtool support
From: Ben Hutchings @ 2013-11-25 15:36 UTC (permalink / raw)
To: Jonas Jensen; +Cc: netdev, davem, linux-arm-kernel, linux-kernel, f.fainelli
In-Reply-To: <1385393228-22416-3-git-send-email-jonas.jensen@gmail.com>
On Mon, 2013-11-25 at 16:27 +0100, Jonas Jensen wrote:
> Add and assign ethtool_ops callback functions.
>
> Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
>
> Notes:
> Thanks for reviewing!
>
> Changes since v1:
>
> 1. declare MOXART_NUM_STATS with ARRAY_SIZE macro
> 2. don't initialise info->n_stats in moxart_get_drvinfo()
> 3. remove "if (!priv->phy_dev) return -ENODEV;"
> moxart_get_settings(), moxart_set_settings(), moxart_nway_reset()
>
> Applies to next-20131125
>
> drivers/net/ethernet/moxa/moxart_ether.c | 121 +++++++++++++++++++++++++++++++
> 1 file changed, 121 insertions(+)
>
> diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
> index 1b87034..cd46a23 100644
> --- a/drivers/net/ethernet/moxa/moxart_ether.c
> +++ b/drivers/net/ethernet/moxa/moxart_ether.c
> @@ -32,6 +32,10 @@
>
> #include "moxart_ether.h"
>
> +#define DRV_NAME "moxart-ethernet"
> +#define DRV_VERSION "0.2"
> +#define MOXART_NUM_STATS ARRAY_SIZE(ethtool_stats_keys)
> +
> static inline void moxart_emac_write(struct net_device *ndev,
> unsigned int reg, unsigned long value)
> {
> @@ -64,6 +68,122 @@ static int moxart_set_mac_address(struct net_device *ndev, void *addr)
> return 0;
> }
>
> +static struct {
> + const char str[ETH_GSTRING_LEN];
> +} ethtool_stats_keys[] = {
> + { "tx_ok_mcol_2to15" },
> + { "tx_ok_1col" },
> + { "rx_frame_pause" },
> + { "frame_align_err" },
> + { "err_col_late_16" },
> + { "err_col_16" },
> + { "rx_runt" },
> + { "late_col" },
> + { "crc_err" },
> + { "rx_ftl" },
> + { "rx_fifo_full" },
> + { "rx_col" },
> + { "rx_bcast" },
> + { "rx_mcast" },
> + { "rx_ok" },
> + { "tx_ok" },
> +};
> +
> +static void moxart_get_drvinfo(struct net_device *ndev,
> + struct ethtool_drvinfo *info)
> +{
> + strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
> + strlcpy(info->version, DRV_VERSION, sizeof(info->version));
> + strlcpy(info->bus_info, dev_name(&ndev->dev), sizeof(info->bus_info));
> +}
> +
> +static int moxart_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
> +{
> + struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> +
> + return phy_ethtool_gset(priv->phy_dev, cmd);
> +}
> +
> +static int moxart_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
> +{
> + struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> +
> + return phy_ethtool_sset(priv->phy_dev, cmd);
> +}
> +
> +static int moxart_nway_reset(struct net_device *ndev)
> +{
> + struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> +
> + return genphy_restart_aneg(priv->phy_dev);
> +}
> +
> +static void moxart_get_ethtool_stats(struct net_device *ndev,
> + struct ethtool_stats *estats,
> + u64 *tmp_stats)
> +{
> + struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> + u32 s;
> + int i = 0;
> +
> + s = readl(priv->base + REG_TX_COL_COUNTER);
> + tmp_stats[i++] = s & 0xffff0000;
> + tmp_stats[i++] = s & 0x0000ffff;
> + s = readl(priv->base + REG_RPF_AEP_COUNTER);
> + tmp_stats[i++] = s & 0xffff0000;
> + tmp_stats[i++] = s & 0x0000ffff;
> + s = readl(priv->base + REG_XM_PG_COUNTER);
> + tmp_stats[i++] = s & 0xffff0000;
> + tmp_stats[i++] = s & 0x0000ffff;
> + s = readl(priv->base + REG_RUNT_TLC_COUNTER);
> + tmp_stats[i++] = s & 0xffff0000;
> + tmp_stats[i++] = s & 0x0000ffff;
> + s = readl(priv->base + REG_CRC_FTL_COUNTER);
> + tmp_stats[i++] = s & 0xffff0000;
> + tmp_stats[i++] = s & 0x0000ffff;
> + s = readl(priv->base + REG_RLC_RCC_COUNTER);
> + tmp_stats[i++] = s & 0xffff0000;
> + tmp_stats[i++] = s & 0x0000ffff;
> + tmp_stats[i++] = readl(priv->base + REG_BROC_COUNTER);
> + tmp_stats[i++] = readl(priv->base + REG_MULCA_COUNTER);
> + tmp_stats[i++] = readl(priv->base + REG_XP_COUNTER);
> + tmp_stats[i++] = readl(priv->base + REG_RP_COUNTER);
> +}
> +
> +static int moxart_get_sset_count(struct net_device *netdev,
> + int string_set)
> +{
> + switch (string_set) {
> + case ETH_SS_STATS:
> + return MOXART_NUM_STATS;
> + default:
> + return -EINVAL;
> + }
> +}
> +
> +static void moxart_get_strings(struct net_device *dev, u32 stringset, u8 *data)
> +{
> + switch (stringset) {
> + case ETH_SS_STATS:
> + memcpy(data, ðtool_stats_keys, sizeof(ethtool_stats_keys));
> + break;
> + default:
> + WARN_ON(1);
> + break;
> + }
> +}
> +
> +static const struct ethtool_ops moxart_ethtool_ops = {
> + .set_settings = moxart_set_settings,
> + .get_settings = moxart_get_settings,
> + .get_drvinfo = moxart_get_drvinfo,
> + .nway_reset = moxart_nway_reset,
> + .get_link = ethtool_op_get_link,
> + .get_ethtool_stats = moxart_get_ethtool_stats,
> + .get_sset_count = moxart_get_sset_count,
> + .get_strings = moxart_get_strings,
> +};
> +
> static int moxart_do_ioctl(struct net_device *ndev, struct ifreq *ir, int cmd)
> {
> struct moxart_mac_priv_t *priv = netdev_priv(ndev);
> @@ -606,6 +726,7 @@ static int moxart_mac_probe(struct platform_device *pdev)
> ndev->irq = irq;
>
> SET_NETDEV_DEV(ndev, &pdev->dev);
> + SET_ETHTOOL_OPS(ndev, &moxart_ethtool_ops);
>
> ret = register_netdev(ndev);
> if (ret) {
--
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
* [PATCH v2 3/6] net: MOXA ART: add ethtool support
From: Jonas Jensen @ 2013-11-25 15:27 UTC (permalink / raw)
To: netdev
Cc: davem, linux-arm-kernel, linux-kernel, f.fainelli, bhutchings,
Jonas Jensen
In-Reply-To: <1385393228-22416-1-git-send-email-jonas.jensen@gmail.com>
Add and assign ethtool_ops callback functions.
Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
---
Notes:
Thanks for reviewing!
Changes since v1:
1. declare MOXART_NUM_STATS with ARRAY_SIZE macro
2. don't initialise info->n_stats in moxart_get_drvinfo()
3. remove "if (!priv->phy_dev) return -ENODEV;"
moxart_get_settings(), moxart_set_settings(), moxart_nway_reset()
Applies to next-20131125
drivers/net/ethernet/moxa/moxart_ether.c | 121 +++++++++++++++++++++++++++++++
1 file changed, 121 insertions(+)
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index 1b87034..cd46a23 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -32,6 +32,10 @@
#include "moxart_ether.h"
+#define DRV_NAME "moxart-ethernet"
+#define DRV_VERSION "0.2"
+#define MOXART_NUM_STATS ARRAY_SIZE(ethtool_stats_keys)
+
static inline void moxart_emac_write(struct net_device *ndev,
unsigned int reg, unsigned long value)
{
@@ -64,6 +68,122 @@ static int moxart_set_mac_address(struct net_device *ndev, void *addr)
return 0;
}
+static struct {
+ const char str[ETH_GSTRING_LEN];
+} ethtool_stats_keys[] = {
+ { "tx_ok_mcol_2to15" },
+ { "tx_ok_1col" },
+ { "rx_frame_pause" },
+ { "frame_align_err" },
+ { "err_col_late_16" },
+ { "err_col_16" },
+ { "rx_runt" },
+ { "late_col" },
+ { "crc_err" },
+ { "rx_ftl" },
+ { "rx_fifo_full" },
+ { "rx_col" },
+ { "rx_bcast" },
+ { "rx_mcast" },
+ { "rx_ok" },
+ { "tx_ok" },
+};
+
+static void moxart_get_drvinfo(struct net_device *ndev,
+ struct ethtool_drvinfo *info)
+{
+ strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+ strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+ strlcpy(info->bus_info, dev_name(&ndev->dev), sizeof(info->bus_info));
+}
+
+static int moxart_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+
+ return phy_ethtool_gset(priv->phy_dev, cmd);
+}
+
+static int moxart_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+
+ return phy_ethtool_sset(priv->phy_dev, cmd);
+}
+
+static int moxart_nway_reset(struct net_device *ndev)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+
+ return genphy_restart_aneg(priv->phy_dev);
+}
+
+static void moxart_get_ethtool_stats(struct net_device *ndev,
+ struct ethtool_stats *estats,
+ u64 *tmp_stats)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+ u32 s;
+ int i = 0;
+
+ s = readl(priv->base + REG_TX_COL_COUNTER);
+ tmp_stats[i++] = s & 0xffff0000;
+ tmp_stats[i++] = s & 0x0000ffff;
+ s = readl(priv->base + REG_RPF_AEP_COUNTER);
+ tmp_stats[i++] = s & 0xffff0000;
+ tmp_stats[i++] = s & 0x0000ffff;
+ s = readl(priv->base + REG_XM_PG_COUNTER);
+ tmp_stats[i++] = s & 0xffff0000;
+ tmp_stats[i++] = s & 0x0000ffff;
+ s = readl(priv->base + REG_RUNT_TLC_COUNTER);
+ tmp_stats[i++] = s & 0xffff0000;
+ tmp_stats[i++] = s & 0x0000ffff;
+ s = readl(priv->base + REG_CRC_FTL_COUNTER);
+ tmp_stats[i++] = s & 0xffff0000;
+ tmp_stats[i++] = s & 0x0000ffff;
+ s = readl(priv->base + REG_RLC_RCC_COUNTER);
+ tmp_stats[i++] = s & 0xffff0000;
+ tmp_stats[i++] = s & 0x0000ffff;
+ tmp_stats[i++] = readl(priv->base + REG_BROC_COUNTER);
+ tmp_stats[i++] = readl(priv->base + REG_MULCA_COUNTER);
+ tmp_stats[i++] = readl(priv->base + REG_XP_COUNTER);
+ tmp_stats[i++] = readl(priv->base + REG_RP_COUNTER);
+}
+
+static int moxart_get_sset_count(struct net_device *netdev,
+ int string_set)
+{
+ switch (string_set) {
+ case ETH_SS_STATS:
+ return MOXART_NUM_STATS;
+ default:
+ return -EINVAL;
+ }
+}
+
+static void moxart_get_strings(struct net_device *dev, u32 stringset, u8 *data)
+{
+ switch (stringset) {
+ case ETH_SS_STATS:
+ memcpy(data, ðtool_stats_keys, sizeof(ethtool_stats_keys));
+ break;
+ default:
+ WARN_ON(1);
+ break;
+ }
+}
+
+static const struct ethtool_ops moxart_ethtool_ops = {
+ .set_settings = moxart_set_settings,
+ .get_settings = moxart_get_settings,
+ .get_drvinfo = moxart_get_drvinfo,
+ .nway_reset = moxart_nway_reset,
+ .get_link = ethtool_op_get_link,
+ .get_ethtool_stats = moxart_get_ethtool_stats,
+ .get_sset_count = moxart_get_sset_count,
+ .get_strings = moxart_get_strings,
+};
+
static int moxart_do_ioctl(struct net_device *ndev, struct ifreq *ir, int cmd)
{
struct moxart_mac_priv_t *priv = netdev_priv(ndev);
@@ -606,6 +726,7 @@ static int moxart_mac_probe(struct platform_device *pdev)
ndev->irq = irq;
SET_NETDEV_DEV(ndev, &pdev->dev);
+ SET_ETHTOOL_OPS(ndev, &moxart_ethtool_ops);
ret = register_netdev(ndev);
if (ret) {
--
1.8.2.1
^ permalink raw reply related
* [PATCH v2 6/6] net: MOXA ART: use eth_mac_addr()
From: Jonas Jensen @ 2013-11-25 15:27 UTC (permalink / raw)
To: netdev
Cc: davem, linux-arm-kernel, linux-kernel, f.fainelli, bhutchings,
Jonas Jensen
In-Reply-To: <1385393228-22416-1-git-send-email-jonas.jensen@gmail.com>
Replace boilerplate in moxart_set_mac_address() with eth_mac_addr().
Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
---
Notes:
Applies to next-20131125
drivers/net/ethernet/moxa/moxart_ether.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index ef7a347..e6e42ee 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -57,12 +57,7 @@ static void moxart_update_mac_address(struct net_device *ndev)
static int moxart_set_mac_address(struct net_device *ndev, void *addr)
{
- struct sockaddr *address = addr;
-
- if (!is_valid_ether_addr(address->sa_data))
- return -EADDRNOTAVAIL;
-
- memcpy(ndev->dev_addr, address->sa_data, ndev->addr_len);
+ eth_mac_addr(ndev, addr);
moxart_update_mac_address(ndev);
return 0;
--
1.8.2.1
^ permalink raw reply related
* [PATCH v2 5/6] net: MOXA ART: generate random address
From: Jonas Jensen @ 2013-11-25 15:27 UTC (permalink / raw)
To: netdev
Cc: davem, linux-arm-kernel, linux-kernel, f.fainelli, bhutchings,
Jonas Jensen
In-Reply-To: <1385393228-22416-1-git-send-email-jonas.jensen@gmail.com>
The address register is zero:ed on boot, fill it with a randomly generated
address on probe.
Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
---
Notes:
Applies to next-20131125
drivers/net/ethernet/moxa/moxart_ether.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index d1c4a83..ef7a347 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -734,6 +734,12 @@ static int moxart_mac_probe(struct platform_device *pdev)
goto init_fail;
}
+ if (!is_valid_ether_addr(ndev->dev_addr)) {
+ eth_hw_addr_random(ndev);
+ netdev_info(ndev, "generated random MAC address %pM\n",
+ ndev->dev_addr);
+ }
+
netdev_dbg(ndev, "%s: IRQ=%d address=%pM\n",
__func__, ndev->irq, ndev->dev_addr);
--
1.8.2.1
^ permalink raw reply related
* [PATCH v2 4/6] net: MOXA ART: add IFF_LIVE_ADDR_CHANGE flag
From: Jonas Jensen @ 2013-11-25 15:27 UTC (permalink / raw)
To: netdev
Cc: davem, linux-arm-kernel, linux-kernel, f.fainelli, bhutchings,
Jonas Jensen
In-Reply-To: <1385393228-22416-1-git-send-email-jonas.jensen@gmail.com>
.ndo_set_mac_address hook callback already supports IFF_LIVE_ADDR_CHANGE
so add it to our flags.
Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
---
Notes:
Applies to next-20131125
drivers/net/ethernet/moxa/moxart_ether.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index cd46a23..d1c4a83 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -722,7 +722,7 @@ static int moxart_mac_probe(struct platform_device *pdev)
ether_setup(ndev);
ndev->netdev_ops = &moxart_netdev_ops;
netif_napi_add(ndev, &priv->napi, moxart_rx_poll, RX_DESC_NUM);
- ndev->priv_flags |= IFF_UNICAST_FLT;
+ ndev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
ndev->irq = irq;
SET_NETDEV_DEV(ndev, &pdev->dev);
--
1.8.2.1
^ permalink raw reply related
* [PATCH v2 2/6] net: MOXA ART: connect to PHY
From: Jonas Jensen @ 2013-11-25 15:27 UTC (permalink / raw)
To: netdev
Cc: davem, linux-arm-kernel, linux-kernel, f.fainelli, bhutchings,
Jonas Jensen
In-Reply-To: <1385393228-22416-1-git-send-email-jonas.jensen@gmail.com>
The kernel now has a MDIO bus driver and a phy_driver (RTL8201CP),
connect to this PHY using OF.
Signed-off-by: Jonas Jensen <jonas.jensen@gmail.com>
---
Notes:
Thanks for reviewing!
Changes since v1:
1. split ethtool support to separate patch
2. changes to devicetree binding document
3. add moxart_mac_update_duplex()
4. compare previous link state/speed/duplex on link adjust
5. use of_get_phy_mode() not PHY_INTERFACE_MODE_MII
6. bail on of_parse_phandle() failure
7. remove "if (!priv->phy_dev) return -ENODEV;"
moxart_do_ioctl()
8. remove "if (priv->phy_dev)"
moxart_mac_open(), moxart_mac_stop()
Applies to next-20131125
.../devicetree/bindings/net/moxa,moxart-mac.txt | 47 ++++++++++-
drivers/net/ethernet/moxa/moxart_ether.c | 92 +++++++++++++++++++++-
drivers/net/ethernet/moxa/moxart_ether.h | 2 +
3 files changed, 138 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt b/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
index 583418b..56f0374 100644
--- a/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
+++ b/Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
@@ -1,21 +1,64 @@
MOXA ART Ethernet Controller
+Integrated MDIO bus node:
+
+- compatible: "moxa,moxart-mdio"
+- Inherets from MDIO bus node binding[1]
+
+[1] Documentation/devicetree/bindings/net/phy.txt
+
+
+Ethernet node:
+
Required properties:
- compatible : Must be "moxa,moxart-mac"
- reg : Should contain register location and length
- interrupts : Should contain the mac interrupt number
+Optional Properties:
+
+- phy-handle : the phandle to a PHY node
+
+
Example:
+ mdio0: mdio@90900090 {
+ compatible = "moxa,moxart-mdio";
+ reg = <0x90900090 0x8>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethphy0: ethernet-phy@1 {
+ device_type = "ethernet-phy";
+ compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+ };
+
+ mdio1: mdio@92000090 {
+ compatible = "moxa,moxart-mdio";
+ reg = <0x92000090 0x8>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethphy1: ethernet-phy@1 {
+ device_type = "ethernet-phy";
+ compatible = "moxa,moxart-rtl8201cp", "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+ };
+
mac0: mac@90900000 {
compatible = "moxa,moxart-mac";
- reg = <0x90900000 0x100>;
+ reg = <0x90900000 0x90>;
interrupts = <25 0>;
+ phy-handle = <ðphy0>;
};
mac1: mac@92000000 {
compatible = "moxa,moxart-mac";
- reg = <0x92000000 0x100>;
+ reg = <0x92000000 0x90>;
interrupts = <27 0>;
+ phy-handle = <ðphy1>;
};
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index 3c14afd..1b87034 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -26,6 +26,9 @@
#include <linux/of_irq.h>
#include <linux/crc32.h>
#include <linux/crc32c.h>
+#include <linux/phy.h>
+#include <linux/of_mdio.h>
+#include <linux/of_net.h>
#include "moxart_ether.h"
@@ -61,6 +64,16 @@ static int moxart_set_mac_address(struct net_device *ndev, void *addr)
return 0;
}
+static int moxart_do_ioctl(struct net_device *ndev, struct ifreq *ir, int cmd)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+
+ if (!netif_running(ndev))
+ return -EINVAL;
+
+ return phy_mii_ioctl(priv->phy_dev, ir, cmd);
+}
+
static void moxart_mac_free_memory(struct net_device *ndev)
{
struct moxart_mac_priv_t *priv = netdev_priv(ndev);
@@ -110,6 +123,19 @@ static void moxart_mac_enable(struct net_device *ndev)
writel(priv->reg_maccr, priv->base + REG_MAC_CTRL);
}
+static void moxart_mac_update_duplex(struct net_device *ndev)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+
+ priv->reg_maccr &= ~(FULLDUP | ENRX_IN_HALFTX);
+ if (priv->duplex)
+ priv->reg_maccr |= FULLDUP;
+ else
+ priv->reg_maccr |= ENRX_IN_HALFTX;
+
+ writel(priv->reg_maccr, priv->base + REG_MAC_CTRL);
+}
+
static void moxart_mac_setup_desc_ring(struct net_device *ndev)
{
struct moxart_mac_priv_t *priv = netdev_priv(ndev);
@@ -169,6 +195,9 @@ static int moxart_mac_open(struct net_device *ndev)
moxart_update_mac_address(ndev);
moxart_mac_setup_desc_ring(ndev);
moxart_mac_enable(ndev);
+
+ phy_start(priv->phy_dev);
+
netif_start_queue(ndev);
netdev_dbg(ndev, "%s: IMR=0x%x, MACCR=0x%x\n",
@@ -184,6 +213,8 @@ static int moxart_mac_stop(struct net_device *ndev)
napi_disable(&priv->napi);
+ phy_stop(priv->phy_dev);
+
netif_stop_queue(ndev);
/* disable all interrupts */
@@ -429,12 +460,49 @@ static struct net_device_ops moxart_netdev_ops = {
.ndo_set_mac_address = moxart_set_mac_address,
.ndo_validate_addr = eth_validate_addr,
.ndo_change_mtu = eth_change_mtu,
+ .ndo_do_ioctl = moxart_do_ioctl,
};
+static void moxart_adjust_link(struct net_device *ndev)
+{
+ struct moxart_mac_priv_t *priv = netdev_priv(ndev);
+ unsigned long flags;
+ int status_change = 0;
+
+ if (priv->phy_dev->link) {
+ if (priv->speed != priv->phy_dev->speed) {
+ priv->speed = priv->phy_dev->speed;
+ status_change = 1;
+ }
+
+ if (priv->duplex != priv->phy_dev->duplex) {
+ spin_lock_irqsave(&priv->txlock, flags);
+
+ priv->duplex = priv->phy_dev->duplex;
+ moxart_mac_update_duplex(ndev);
+
+ spin_unlock_irqrestore(&priv->txlock, flags);
+ status_change = 1;
+ }
+ }
+
+ if (priv->link != priv->phy_dev->link) {
+ if (!priv->phy_dev->link) {
+ priv->speed = 0;
+ priv->duplex = -1;
+ }
+ priv->link = priv->phy_dev->link;
+ status_change = 1;
+ }
+
+ if (status_change)
+ phy_print_status(priv->phy_dev);
+}
+
static int moxart_mac_probe(struct platform_device *pdev)
{
struct device *p_dev = &pdev->dev;
- struct device_node *node = p_dev->of_node;
+ struct device_node *node = p_dev->of_node, *phy_node;
struct net_device *ndev;
struct moxart_mac_priv_t *priv;
struct resource *res;
@@ -455,6 +523,28 @@ static int moxart_mac_probe(struct platform_device *pdev)
priv = netdev_priv(ndev);
priv->ndev = ndev;
+ priv->link = 0;
+ priv->speed = 0;
+ priv->duplex = -1;
+
+ phy_node = of_parse_phandle(node, "phy-handle", 0);
+ if (!phy_node) {
+ dev_err(p_dev, "of_parse_phandle failed\n");
+ ret = -ENODEV;
+ goto init_fail;
+ }
+
+ if (phy_node) {
+ priv->phy_dev = of_phy_connect(priv->ndev, phy_node,
+ &moxart_adjust_link,
+ 0, of_get_phy_mode(node));
+ if (!priv->phy_dev) {
+ dev_err(p_dev, "of_phy_connect failed\n");
+ ret = -ENODEV;
+ goto init_fail;
+ }
+ }
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ndev->base_addr = res->start;
priv->base = devm_ioremap_resource(p_dev, res);
diff --git a/drivers/net/ethernet/moxa/moxart_ether.h b/drivers/net/ethernet/moxa/moxart_ether.h
index 2be9280..b8877bf 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.h
+++ b/drivers/net/ethernet/moxa/moxart_ether.h
@@ -297,6 +297,8 @@ struct moxart_mac_priv_t {
unsigned int reg_imr;
struct napi_struct napi;
struct net_device *ndev;
+ struct phy_device *phy_dev;
+ int speed, duplex, link;
dma_addr_t rx_base;
dma_addr_t rx_mapping[RX_DESC_NUM];
--
1.8.2.1
^ permalink raw reply related
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