* Re: [PATCH] TI DaVinci EMAC: delay DaVinci EMAC initialization
From: Kevin Hilman @ 2009-08-25 11:21 UTC (permalink / raw)
To: Sudhakar Rajashekhara; +Cc: netdev, davinci-linux-open-source, davem
In-Reply-To: <1250714395-9588-1-git-send-email-sudhakar.raj@ti.com>
Sudhakar Rajashekhara <sudhakar.raj@ti.com> writes:
> On TI's DA850/OMAP-L138 EVM, MAC address is stored in SPI
> flash which is accessed using MTD interface.
>
> This patch delays the initialization of DaVinci EMAC driver
> by changing module_init to late_initcall. This helps SPI and
> MTD drivers to get initialized before EMAC thereby enabling
> EMAC driver to read the MAC address while booting and use it.
>
> Tested with NFS on DM644x, DM6467, DA830/OMAP-L137 and
> DA850/OMAP-L138 EVMs.
>
> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> Reviewed-by: Chaithrika U S <chaithrika@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
> ---
> drivers/net/davinci_emac.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
> index 12fd446..5e6652b 100644
> --- a/drivers/net/davinci_emac.c
> +++ b/drivers/net/davinci_emac.c
> @@ -2817,7 +2817,7 @@ static int __init davinci_emac_init(void)
> {
> return platform_driver_register(&davinci_emac_driver);
> }
> -module_init(davinci_emac_init);
> +late_initcall(davinci_emac_init);
>
> /**
> * davinci_emac_exit: EMAC driver module exit
> --
> 1.5.6
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
^ permalink raw reply
* Re: iproute2 / tbf with large burst seems broken again
From: Denys Fedoryschenko @ 2009-08-25 11:16 UTC (permalink / raw)
To: Jarek Poplawski; +Cc: netdev
In-Reply-To: <20090825094120.GA11478@ff.dom.local>
Done, tested, it doesn't stale and fix the issue but:
PPPoE_146 ~ # ./tc qdisc del dev ppp13 root;./tc qdisc add dev ppp13 root tbf
rate 96000 burst 2048000 latency 500ms
This one is ok
PPPoE_146 ~ # ./tc -s -d qdisc show dev ppp13
qdisc tbf 8005: root rate 96000bit burst 2000Kb/8 mpu 0b lat 500.0ms
Sent 55260 bytes 65 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
qdisc ingress ffff: parent ffff:fff1 ----------------
Sent 641055 bytes 2485 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
PPPoE_146 ~ # ./tc qdisc del dev ppp13 root;./tc qdisc add dev ppp13 root tbf
rate 96000 burst 4096000 latency 500ms
But this one maybe will overflow because of limitations in iproute2.
PPoE_146 ~ # ./tc -s -d qdisc show dev ppp13
qdisc tbf 8004: root rate 96000bit burst 797465b/8 mpu 0b lat 275.4s
Sent 82867 bytes 123 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
qdisc ingress ffff: parent ffff:fff1 ----------------
Sent 506821 bytes 1916 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
So maybe all of that just wrong way of using TBF.
At same time this means, if HTB and policers in filters done same way, that
QoS in Linux cannot do similar to squid delay pools feature:
First 10Mb give with 1Mbit/s, then slow 64Kbit/s. If user use less than 64K -
recharge with that unused bandwidth a "10 Mb / 1Mbit bucket".
On Tuesday 25 August 2009 12:41:20 Jarek Poplawski wrote:
> On Tue, Aug 25, 2009 at 09:00:35AM +0000, Jarek Poplawski wrote:
> > On Tue, Aug 25, 2009 at 08:43:06AM +0000, Jarek Poplawski wrote:
> > ...
> >
> > > since these 64 bits will be needed soon for higher rates anyway, I
> > > guess we could try some change like the patch below, if you find it
> > > works for you (I didn't test it yet.)
>
> I hope this time it works...
>
> Jarek P.
>
> --- (take 2)
>
> net/sched/sch_tbf.c | 14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
> index e22dfe8..7d0fe69 100644
> --- a/net/sched/sch_tbf.c
> +++ b/net/sched/sch_tbf.c
> @@ -108,8 +108,8 @@ struct tbf_sched_data
> struct qdisc_rate_table *P_tab;
>
> /* Variables */
> - long tokens; /* Current number of B tokens */
> - long ptokens; /* Current number of P tokens */
> + u32 tokens; /* Current number of B tokens */
> + u32 ptokens; /* Current number of P tokens */
> psched_time_t t_c; /* Time check-point */
> struct Qdisc *qdisc; /* Inner qdisc, default - bfifo queue */
> struct qdisc_watchdog watchdog; /* Watchdog timer */
> @@ -160,21 +160,21 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
>
> if (skb) {
> psched_time_t now;
> - long toks;
> - long ptoks = 0;
> + long long toks;
> + long long ptoks = 0;
> unsigned int len = qdisc_pkt_len(skb);
>
> now = psched_get_time();
> - toks = psched_tdiff_bounded(now, q->t_c, q->buffer);
> + toks = min_t(u32, now - q->t_c, q->buffer);
>
> if (q->P_tab) {
> ptoks = toks + q->ptokens;
> - if (ptoks > (long)q->mtu)
> + if (ptoks > q->mtu)
> ptoks = q->mtu;
> ptoks -= L2T_P(q, len);
> }
> toks += q->tokens;
> - if (toks > (long)q->buffer)
> + if (toks > q->buffer)
> toks = q->buffer;
> toks -= L2T(q, len);
^ permalink raw reply
* Re: [PATCH v2] sctp: fix the check for path failure detection
From: Luo Chunbo @ 2009-08-25 8:22 UTC (permalink / raw)
To: Wei Yongjun; +Cc: davem, netdev, linux-sctp, linux-kernel
In-Reply-To: <4A93949B.2020404@cn.fujitsu.com>
On Tue, 2009-08-25 at 15:36 +0800, Wei Yongjun wrote:
> Chunbo Luo wrote:
> > The transport error count should be incremented when an outstanding
> > HB is not acknowledged. And the path failure detection should be done
> > before sending out the HB.
> >
> > Signed-off-by: Chunbo Luo <chunbo.luo@windriver.com>
> > ---
> > net/sctp/sm_sideeffect.c | 6 +++++-
> > net/sctp/sm_statefuns.c | 8 ++++----
> > 2 files changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
> > index 86426aa..fbdf4de 100644
> > --- a/net/sctp/sm_sideeffect.c
> > +++ b/net/sctp/sm_sideeffect.c
> > @@ -446,7 +446,11 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
> > if (transport->state != SCTP_UNCONFIRMED)
> > asoc->overall_error_count++;
> >
> > - if (transport->state != SCTP_INACTIVE &&
> > + /*
> > + * The transport error count is incremented when an outstanding HB
> > + * is not acknowledged.
> > + */
> >
>
> T3-rtx timer expires also need to increment error count.
Yes, T3-rtx timer expires need to increment error count.
>
> > + if (transport->hb_sent && transport->state != SCTP_INACTIVE &&
> > (transport->error_count++ >= transport->pathmaxrxt)) {
> > SCTP_DEBUG_PRINTK_IPADDR("transport_strike:association %p",
> > " transport IP: port:%d failed.\n",
> > diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> > index 7288192..7f77099 100644
> > --- a/net/sctp/sm_statefuns.c
> > +++ b/net/sctp/sm_statefuns.c
> > @@ -981,10 +981,6 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
> > */
> >
> > if (transport->param_flags & SPP_HB_ENABLE) {
> > - if (SCTP_DISPOSITION_NOMEM ==
> > - sctp_sf_heartbeat(ep, asoc, type, arg,
> > - commands))
> > - return SCTP_DISPOSITION_NOMEM;
> > /* Set transport error counter and association error counter
> > * when sending heartbeat.
> > */
> > @@ -992,6 +988,10 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
> > SCTP_TRANSPORT(transport));
> > sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_HB_SENT,
> > SCTP_TRANSPORT(transport));
> > + if (SCTP_DISPOSITION_NOMEM ==
> > + sctp_sf_heartbeat(ep, asoc, type, arg,
> > + commands))
> > + return SCTP_DISPOSITION_NOMEM;
> > }
> > sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE,
> > SCTP_TRANSPORT(transport));
> >
>
> How about this one:
It is ok to increment the error count. But the path failure detection
should be done before send HB. Otherwise, an extra HB chunk will be sent
out before the transport is marked DOWN . So the changes in
net/sctp/sm_statefuns.c is also needed.
>
> diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
> index 86426aa..fb723dd 100644
> --- a/net/sctp/sm_sideeffect.c
> +++ b/net/sctp/sm_sideeffect.c
> @@ -447,7 +447,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
> asoc->overall_error_count++;
>
> if (transport->state != SCTP_INACTIVE &&
> - (transport->error_count++ >= transport->pathmaxrxt)) {
> + (transport->error_count >= transport->pathmaxrxt)) {
> SCTP_DEBUG_PRINTK_IPADDR("transport_strike:association %p",
> " transport IP: port:%d failed.\n",
> asoc,
> @@ -468,6 +468,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
> * that indicates that we have an outstanding HB.
> */
> if (!is_hb || transport->hb_sent) {
> + transport->error_count++;
> transport->last_rto = transport->rto;
> transport->rto = min((transport->rto * 2), transport->asoc->rto_max);
> }
>
>
>
>
>
^ permalink raw reply
* Re: [PATCH 1/2] trace_events: fix napi's tracepoint
From: Neil Horman @ 2009-08-25 10:57 UTC (permalink / raw)
To: Ingo Molnar
Cc: Xiao Guangrong, Steven Rostedt, Frederic Weisbecker, Wei Yongjun,
David Miller, Netdev, LKML
In-Reply-To: <20090825075816.GB857@elte.hu>
On Tue, Aug 25, 2009 at 09:58:16AM +0200, Ingo Molnar wrote:
>
> * Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:
>
> > Currently, the napi's tracepoint works will is depend on
> > "DECLARE_TRACE" definiens in include/trace/define_trace.h,
> > like below:
> >
> > #include <trace/events/skb.h> // include define_trace.h
> > #include <trace/events/napi.h>
> >
> > there have error, if we remove "#include <trace/events/skb.h>"
> > or include napi.h in the front of include skb.h, It should
> > depend on the definiens in include/linux/tracepoint.h and we
> > can remove the "DECLARE_TRACE" definiens in
> > include/trace/define_trace.h, because "TRACE_EVENT" not use it
> >
> > Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
> > ---
> > include/trace/define_trace.h | 4 ----
> > net/core/net-traces.c | 4 +++-
> > 2 files changed, 3 insertions(+), 5 deletions(-)
>
> This will collide with tracing bits in the networking tree. The
> skb-tracing plugin there should be turned into proper TRACE_EVENT()
> tracepoints.
>
> Neil was away for some time but i think soon we should see some
> movement here.
>
> Ingo
>
Thank you Ingo, yes, I'm back from the beach now and will look at this shortly.
I concur, we should just convert the napi_poll tracepoint to be defined via the
TRACE_EVENT macro, same as the kfree_skb tracepoint. Xaio would you like to
take care of that, or shall I?
Best
Neil
^ permalink raw reply
* [PATCH] sit: allow ip fragmentation when using nopmtudisc to fix package loss
From: Sascha Hlusiak @ 2009-08-25 10:48 UTC (permalink / raw)
To: netdev; +Cc: Sascha Hlusiak
if tunnel parameters have frag_off set to IP_DF, pmtudisc on the ipv4 link
will be performed by deriving the mtu from the ipv4 link and setting the
DF-Flag of the encapsulating IPv4 Header. If fragmentation is needed on the
way, the IPv4 pmtu gets adjusted, the ipv6 package will be resent eventually,
using the new and lower mtu and everyone is happy.
If the frag_off parameter is unset, the mtu for the tunnel will be derived
from the tunnel device or the ipv6 pmtu, which might be higher than the ipv4
pmtu. In that case we must allow the fragmentation of the IPv4 packet because
the IPv6 mtu wouldn't 'learn' from the adjusted IPv4 pmtu, resulting in
frequent icmp_frag_needed and package loss on the IPv6 layer.
This patch allows fragmentation when tunnel was created with parameter
nopmtudisc, like in ipip/gre tunnels.
Signed-off-by: Sascha Hlusiak <contact@saschahlusiak.de>
---
net/ipv6/sit.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 98b7327..386f1e9 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -778,7 +778,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
iph->version = 4;
iph->ihl = sizeof(struct iphdr)>>2;
if (mtu > IPV6_MIN_MTU)
- iph->frag_off = htons(IP_DF);
+ iph->frag_off = tiph->frag_off;
else
iph->frag_off = 0;
--
1.6.4
^ permalink raw reply related
* Re: iproute2 / tbf with large burst seems broken again
From: Denys Fedoryschenko @ 2009-08-25 10:29 UTC (permalink / raw)
To: Jarek Poplawski; +Cc: netdev
In-Reply-To: <20090825094120.GA11478@ff.dom.local>
Thanks a lot for your help!
I will try now.
On Tuesday 25 August 2009 12:41:20 Jarek Poplawski wrote:
> On Tue, Aug 25, 2009 at 09:00:35AM +0000, Jarek Poplawski wrote:
> > On Tue, Aug 25, 2009 at 08:43:06AM +0000, Jarek Poplawski wrote:
> > ...
> >
> > > since these 64 bits will be needed soon for higher rates anyway, I
> > > guess we could try some change like the patch below, if you find it
> > > works for you (I didn't test it yet.)
>
> I hope this time it works...
>
> Jarek P.
>
> --- (take 2)
>
> net/sched/sch_tbf.c | 14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
> index e22dfe8..7d0fe69 100644
> --- a/net/sched/sch_tbf.c
> +++ b/net/sched/sch_tbf.c
> @@ -108,8 +108,8 @@ struct tbf_sched_data
> struct qdisc_rate_table *P_tab;
>
> /* Variables */
> - long tokens; /* Current number of B tokens */
> - long ptokens; /* Current number of P tokens */
> + u32 tokens; /* Current number of B tokens */
> + u32 ptokens; /* Current number of P tokens */
> psched_time_t t_c; /* Time check-point */
> struct Qdisc *qdisc; /* Inner qdisc, default - bfifo queue */
> struct qdisc_watchdog watchdog; /* Watchdog timer */
> @@ -160,21 +160,21 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
>
> if (skb) {
> psched_time_t now;
> - long toks;
> - long ptoks = 0;
> + long long toks;
> + long long ptoks = 0;
> unsigned int len = qdisc_pkt_len(skb);
>
> now = psched_get_time();
> - toks = psched_tdiff_bounded(now, q->t_c, q->buffer);
> + toks = min_t(u32, now - q->t_c, q->buffer);
>
> if (q->P_tab) {
> ptoks = toks + q->ptokens;
> - if (ptoks > (long)q->mtu)
> + if (ptoks > q->mtu)
> ptoks = q->mtu;
> ptoks -= L2T_P(q, len);
> }
> toks += q->tokens;
> - if (toks > (long)q->buffer)
> + if (toks > q->buffer)
> toks = q->buffer;
> toks -= L2T(q, len);
^ permalink raw reply
* Re: Kernel forwarding performance test regressions
From: Eric Dumazet @ 2009-08-25 9:47 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev, Robert Olsson
In-Reply-To: <20090819110010.53b630cd@nehalam>
Stephen Hemminger a écrit :
> Vyatta regularly runs RFC2544 performance tests as part of
> the QA release regression tests. These tests are run using
> a Spirent analyzer that sends packets at maximum rate and
> measures the number of packets received.
>
> The interesting (worst case) number is the forwarding percentage for
> minimum size Ethernet packets. For packets 1K and above all the packets
> get through but for smaller sizes the system can't keep up.
>
> The hardware is Dell based
> CPU is Intel Dual Core E2220 @ 2.40GHz (or 2.2GHz)
> NIC's are internal Broadcom (tg3).
>
> Size 2.6.23 2.6.24 2.6.26 2.6.29 2.6.30
> 64 14.% 20% 21% 17% 19%
> 128 22 33 34 28 32
> 256 37 52 58 49 54
> 512 67 85 83 85 85
> 1024 100 100 100 100 100
> 1280 100 100 100 100 100
> 1518 100 100 100 100 100
>
>
> Some other details:
> * Hardware change between 2.6.24 -> 2.6.26 numbers
> went from 2.2 to 2.4Ghz
>
> * no SMP affinity (or irqbalance) is done,
> numbers are significantly better if IRQ's are pinned.
> 2.6.26 goes from 20% to 32%
Thats strange, because at Giga flood level, we should be on NAPI mode,
ksoftirqd using 100% of one cpu. SMP affinities should not matter at all...
>
> * unidirectional numbers are 2X the bidirectional numbers:
> 2.6.26 goes from 20% to 40%
>
> * this is single stream (doesn't help/use multiqueue)
>
> * system loads iptables but does not use it, so each packet
> sees the overhead of null rules.
>
> So kernel 2.6.29 had an observable dip in performance
> which seems to be mostly recovered in 2.6.30.
>
> These are from our QA, not me so please don't ask me for
> "please rerun with XX enabled", go run the same test
> yourself with pktgen.
>
Unfortunatly I cannot reach line-rate with pktgen and small packets.
(Limit ~1012333pps 485Mb/sec on my test machine, 3GHz E5450 cpu)
It seems timestamping is too expensive on pktgen, even for "delay 0"
and only one device setup (next_to_run() doesnt have to select the 'best' device)
We probably can improve pktgen a litle bit, or use a faster timestamping...
oprofile results on pktgen machine (linux 2.6.30.5) :
CPU: Core 2, speed 3000.08 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (Unhalted core cycles) count 100000
samples cum. samples % cum. % symbol name
58137 58137 27.9549 27.9549 read_tsc
51487 109624 24.7573 52.7122 pktgen_thread_worker
33079 142703 15.9059 68.6181 getnstimeofday
15694 158397 7.5464 76.1645 getCurUs
11806 170203 5.6769 81.8413 do_gettimeofday
5852 176055 2.8139 84.6553 kthread_should_stop
5244 181299 2.5216 87.1768 kthread
4181 185480 2.0104 89.1872 mwait_idle
3837 189317 1.8450 91.0322 consume_skb
2217 191534 1.0660 92.0983 skb_dma_unmap
1599 193133 0.7689 92.8671 skb_dma_map
1389 194522 0.6679 93.5350 local_bh_enable_ip
1350 195872 0.6491 94.1842 nommu_map_page
1086 196958 0.5222 94.7064 mix_pool_bytes_extract
835 197793 0.4015 95.1079 apic_timer_interrupt
774 198567 0.3722 95.4801 irq_entries_start
450 199017 0.2164 95.6964 timer_stats_update_stats
404 199421 0.1943 95.8907 scheduler_tick
403 199824 0.1938 96.0845 find_busiest_group
336 200160 0.1616 96.2460 local_bh_disable
332 200492 0.1596 96.4057 rb_get_reader_page
329 200821 0.1582 96.5639 ring_buffer_consume
267 201088 0.1284 96.6923 add_timer_randomness
I experiment 0.1% drops around 635085pps 284Mb/sec, on my dev machine
(using vlan and bonding, bi-directional , output device = input device)
Some notes :
- Small packets hit the copybreak (mis)feature (that tg3 and other drivers use),
and we know this slow down forwarding. No real differences on small
packets anyway since we need to read packet to process it (one cache line)
- neigh_resolve_output() has a cost because
of atomic ops of read_lock_bh(&neigh->lock)/read_unlock_bh(&neigh->lock)
This might be a candidate for RCU conversion ?
- ip_rt_send_redirect() is quite expensive, even if send_redirect is set to 0, because
of in_dev_get()/in_dev_put() (two atomic ops that could be avoided : I submitted a patch)
^ permalink raw reply
* Re: iproute2 / tbf with large burst seems broken again
From: Jarek Poplawski @ 2009-08-25 9:41 UTC (permalink / raw)
To: Denys Fedoryschenko; +Cc: netdev
In-Reply-To: <20090825090035.GB7879@ff.dom.local>
On Tue, Aug 25, 2009 at 09:00:35AM +0000, Jarek Poplawski wrote:
> On Tue, Aug 25, 2009 at 08:43:06AM +0000, Jarek Poplawski wrote:
> ...
> > since these 64 bits will be needed soon for higher rates anyway, I
> > guess we could try some change like the patch below, if you find it
> > works for you (I didn't test it yet.)
I hope this time it works...
Jarek P.
--- (take 2)
net/sched/sch_tbf.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index e22dfe8..7d0fe69 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -108,8 +108,8 @@ struct tbf_sched_data
struct qdisc_rate_table *P_tab;
/* Variables */
- long tokens; /* Current number of B tokens */
- long ptokens; /* Current number of P tokens */
+ u32 tokens; /* Current number of B tokens */
+ u32 ptokens; /* Current number of P tokens */
psched_time_t t_c; /* Time check-point */
struct Qdisc *qdisc; /* Inner qdisc, default - bfifo queue */
struct qdisc_watchdog watchdog; /* Watchdog timer */
@@ -160,21 +160,21 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
if (skb) {
psched_time_t now;
- long toks;
- long ptoks = 0;
+ long long toks;
+ long long ptoks = 0;
unsigned int len = qdisc_pkt_len(skb);
now = psched_get_time();
- toks = psched_tdiff_bounded(now, q->t_c, q->buffer);
+ toks = min_t(u32, now - q->t_c, q->buffer);
if (q->P_tab) {
ptoks = toks + q->ptokens;
- if (ptoks > (long)q->mtu)
+ if (ptoks > q->mtu)
ptoks = q->mtu;
ptoks -= L2T_P(q, len);
}
toks += q->tokens;
- if (toks > (long)q->buffer)
+ if (toks > q->buffer)
toks = q->buffer;
toks -= L2T(q, len);
^ permalink raw reply related
* [PATCH v3] sctp: fix the check for path failure detection
From: Chunbo Luo @ 2009-08-25 9:07 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-sctp, linux-kernel, chunbo.luo, yjwei
The transport error count should be incremented when the the T3-rtx
timer expires or an outstanding HB is not acknowledged. In order to
avoid sending out an extra HB before marking the transport DOWN, the
path failure detection should be done before sending out HB.
Signed-off-by: Chunbo Luo <chunbo.luo@windriver.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
net/sctp/sm_sideeffect.c | 3 ++-
net/sctp/sm_statefuns.c | 8 ++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 86426aa..fb723dd 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -447,7 +447,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
asoc->overall_error_count++;
if (transport->state != SCTP_INACTIVE &&
- (transport->error_count++ >= transport->pathmaxrxt)) {
+ (transport->error_count >= transport->pathmaxrxt)) {
SCTP_DEBUG_PRINTK_IPADDR("transport_strike:association %p",
" transport IP: port:%d failed.\n",
asoc,
@@ -468,6 +468,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
* that indicates that we have an outstanding HB.
*/
if (!is_hb || transport->hb_sent) {
+ transport->error_count++;
transport->last_rto = transport->rto;
transport->rto = min((transport->rto * 2), transport->asoc->rto_max);
}
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 7288192..7f77099 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -981,10 +981,6 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
*/
if (transport->param_flags & SPP_HB_ENABLE) {
- if (SCTP_DISPOSITION_NOMEM ==
- sctp_sf_heartbeat(ep, asoc, type, arg,
- commands))
- return SCTP_DISPOSITION_NOMEM;
/* Set transport error counter and association error counter
* when sending heartbeat.
*/
@@ -992,6 +988,10 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
SCTP_TRANSPORT(transport));
sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_HB_SENT,
SCTP_TRANSPORT(transport));
+ if (SCTP_DISPOSITION_NOMEM ==
+ sctp_sf_heartbeat(ep, asoc, type, arg,
+ commands))
+ return SCTP_DISPOSITION_NOMEM;
}
sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE,
SCTP_TRANSPORT(transport));
--
1.6.4
^ permalink raw reply related
* Re: iproute2 / tbf with large burst seems broken again
From: Jarek Poplawski @ 2009-08-25 9:00 UTC (permalink / raw)
To: Denys Fedoryschenko; +Cc: netdev
In-Reply-To: <20090825084306.GA7879@ff.dom.local>
On Tue, Aug 25, 2009 at 08:43:06AM +0000, Jarek Poplawski wrote:
...
> since these 64 bits will be needed soon for higher rates anyway, I
> guess we could try some change like the patch below, if you find it
> works for you (I didn't test it yet.)
Hmm... Don't bother testing it! There is needed something more...
Jarek P.
> ---
>
> net/sched/sch_tbf.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
> index e22dfe8..2c74450 100644
> --- a/net/sched/sch_tbf.c
> +++ b/net/sched/sch_tbf.c
> @@ -160,8 +160,8 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
>
> if (skb) {
> psched_time_t now;
> - long toks;
> - long ptoks = 0;
> + long long toks;
> + long long ptoks = 0;
> unsigned int len = qdisc_pkt_len(skb);
>
> now = psched_get_time();
>
>
^ permalink raw reply
* Re: [PATCHv4 0/2] vhost: a kernel-level virtio server
From: Rusty Russell @ 2009-08-25 8:45 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: netdev, virtualization, kvm, linux-kernel, mingo, linux-mm, akpm,
hpa, gregory.haskins
In-Reply-To: <20090819150029.GA4236@redhat.com>
On Thu, 20 Aug 2009 12:30:29 am Michael S. Tsirkin wrote:
> Rusty, could you review and comment on the patches please? Since most
> of the code deals with virtio from host side, I think it will make sense
> to merge them through your tree. What do you think?
Yep, I've been waiting for all the other comments, then I got ill.
Now I'm all recovered, what better way to spend an evening than reviewing
fresh code?
New dir seems fine to me, too.
Thanks,
Rusty.
^ permalink raw reply
* Re: iproute2 / tbf with large burst seems broken again
From: Jarek Poplawski @ 2009-08-25 8:43 UTC (permalink / raw)
To: Denys Fedoryschenko; +Cc: netdev
In-Reply-To: <200908251034.09581.denys@visp.net.lb>
On Tue, Aug 25, 2009 at 10:34:09AM +0300, Denys Fedoryschenko wrote:
> On Tuesday 25 August 2009 09:22:03 Jarek Poplawski wrote:
>
> >
> > Right, it's about an overflow and it was expected (theoretically) for
> > very low rates (as for current times) while doing this resolution
> > change. Probably this kind of warning should be useful if we expect
> > there're more people who can actually use something like this yet ;-)
> >
> > Alas INT_MAX could still be not enough to prevent similar issues
> > because in tbf_dequeue such a value (buffer) is increased with tokens.
> > I guess we could try to change some variables to 64 bits there, but
> > the main question is why anybody needs such strange settings today?
> > Did you try e.g. to browse Internet with that rate and the buffer
> > e.g. 1500kb or you punish some users only? ;-) Btw, why do you think
> > 'buffer 2000kb' is better "for you" with that rate than e.g. 20kb?
> >
> > Thanks,
> > Jarek P.
> Life in Lebanon:
> Backbone for ISP - $2200 per Mbit and higher.
>
> Accounts 256Kbit/s cost $66/month in some areas.
> 96 Kbits/s for people with low income costs cheaper.
>
> From government "alternative" solution - pay $20 for 2GB, but they charge
> (without any understandable notice for non-tech end-user) extra traffic :-)
> Some people ending month with bills $200/month. Surprise!
>
> Try to browse with 96Kbit/s? U can't actually on this days, with pages that
> weight up to 5-10Mbyte...
>
> The only solution - first 2-10Mbyte, for example, for user will be transferred
> on high speed, let's say 512Kbit/s, but if he put downloads - he will have
> his 96Kbit/s. If he just browse occasionally, his large bucket will
> be "recharged" with 96 Kbit/s, and next page will open again fast.
To make it clear: I didn't wonder about using 96Kbit rate nowdays
(I'm not that modern at all ;-), but 96Kbit with such a big buffer.
I didn't try this but I can imagine the burstiness; but maybe I still
need to figure out your trick...
> That's how this TBF configuration that i show works. But sure if it is
> difficult to solve i will implement something similar in userspace, that will
> track user consumption, and just change discipline settings... but sure it
> will be different thing. Actually because there is noone else complained
> about this except me, i guess i have to solve it by myself. Because better
> resolution for high bandwidth traffic shaping much more important even for
> me :-)
It shouldn't be so difficult just for 2000kb buffer here, but of course
there're some limits. "Noone else" doesn't matter here, because I know
there are not so much -rc networking testers beside you ;-)
There is some inconsistency in schedulers e.g. with using u32 buffers
in configs and 'long' variables to process them. Maybe there should
be some warnings in iproute like you suggested: feel free to send some
patch if you like (I still can't see my 'resolution' patches merged,
btw :-( ). Probably tc_core_time2big might be used for this. But,
since these 64 bits will be needed soon for higher rates anyway, I
guess we could try some change like the patch below, if you find it
works for you (I didn't test it yet.)
Jarek P.
---
net/sched/sch_tbf.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index e22dfe8..2c74450 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -160,8 +160,8 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
if (skb) {
psched_time_t now;
- long toks;
- long ptoks = 0;
+ long long toks;
+ long long ptoks = 0;
unsigned int len = qdisc_pkt_len(skb);
now = psched_get_time();
^ permalink raw reply related
* Re: Dave Miller's NYLUG paper on Multiqueue
From: David Miller @ 2009-08-25 8:20 UTC (permalink / raw)
To: krkumar2; +Cc: netdev
In-Reply-To: <OF183FE24E.2D1BB479-ON6525761D.0029177A-6525761D.0029719F@in.ibm.com>
From: Krishna Kumar2 <krkumar2@in.ibm.com>
Date: Tue, 25 Aug 2009 13:02:40 +0530
> I read some time back that this presentation paper would be available
> online, but I haven't been able to locate it till now. Does someone have
> a copy (or link) they can post?
http://vger.kernel.org/~davem/davem_nyc09.pdf
^ permalink raw reply
* Re: [PATCH 1/2] trace_events: fix napi's tracepoint
From: Ingo Molnar @ 2009-08-25 7:58 UTC (permalink / raw)
To: Xiao Guangrong, Neil Horman
Cc: Steven Rostedt, Frederic Weisbecker, Neil Horman, Wei Yongjun,
David Miller, Netdev, LKML
In-Reply-To: <4A93895F.4010708@cn.fujitsu.com>
* Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:
> Currently, the napi's tracepoint works will is depend on
> "DECLARE_TRACE" definiens in include/trace/define_trace.h,
> like below:
>
> #include <trace/events/skb.h> // include define_trace.h
> #include <trace/events/napi.h>
>
> there have error, if we remove "#include <trace/events/skb.h>"
> or include napi.h in the front of include skb.h, It should
> depend on the definiens in include/linux/tracepoint.h and we
> can remove the "DECLARE_TRACE" definiens in
> include/trace/define_trace.h, because "TRACE_EVENT" not use it
>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
> ---
> include/trace/define_trace.h | 4 ----
> net/core/net-traces.c | 4 +++-
> 2 files changed, 3 insertions(+), 5 deletions(-)
This will collide with tracing bits in the networking tree. The
skb-tracing plugin there should be turned into proper TRACE_EVENT()
tracepoints.
Neil was away for some time but i think soon we should see some
movement here.
Ingo
^ permalink raw reply
* Re: [PATCH v2] sctp: fix the check for path failure detection
From: Wei Yongjun @ 2009-08-25 7:36 UTC (permalink / raw)
To: Chunbo Luo; +Cc: davem, netdev, linux-sctp, linux-kernel
In-Reply-To: <1251106637-434-1-git-send-email-chunbo.luo@windriver.com>
Chunbo Luo wrote:
> The transport error count should be incremented when an outstanding
> HB is not acknowledged. And the path failure detection should be done
> before sending out the HB.
>
> Signed-off-by: Chunbo Luo <chunbo.luo@windriver.com>
> ---
> net/sctp/sm_sideeffect.c | 6 +++++-
> net/sctp/sm_statefuns.c | 8 ++++----
> 2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
> index 86426aa..fbdf4de 100644
> --- a/net/sctp/sm_sideeffect.c
> +++ b/net/sctp/sm_sideeffect.c
> @@ -446,7 +446,11 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
> if (transport->state != SCTP_UNCONFIRMED)
> asoc->overall_error_count++;
>
> - if (transport->state != SCTP_INACTIVE &&
> + /*
> + * The transport error count is incremented when an outstanding HB
> + * is not acknowledged.
> + */
>
T3-rtx timer expires also need to increment error count.
> + if (transport->hb_sent && transport->state != SCTP_INACTIVE &&
> (transport->error_count++ >= transport->pathmaxrxt)) {
> SCTP_DEBUG_PRINTK_IPADDR("transport_strike:association %p",
> " transport IP: port:%d failed.\n",
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index 7288192..7f77099 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -981,10 +981,6 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
> */
>
> if (transport->param_flags & SPP_HB_ENABLE) {
> - if (SCTP_DISPOSITION_NOMEM ==
> - sctp_sf_heartbeat(ep, asoc, type, arg,
> - commands))
> - return SCTP_DISPOSITION_NOMEM;
> /* Set transport error counter and association error counter
> * when sending heartbeat.
> */
> @@ -992,6 +988,10 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
> SCTP_TRANSPORT(transport));
> sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_HB_SENT,
> SCTP_TRANSPORT(transport));
> + if (SCTP_DISPOSITION_NOMEM ==
> + sctp_sf_heartbeat(ep, asoc, type, arg,
> + commands))
> + return SCTP_DISPOSITION_NOMEM;
> }
> sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE,
> SCTP_TRANSPORT(transport));
>
How about this one:
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 86426aa..fb723dd 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -447,7 +447,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
asoc->overall_error_count++;
if (transport->state != SCTP_INACTIVE &&
- (transport->error_count++ >= transport->pathmaxrxt)) {
+ (transport->error_count >= transport->pathmaxrxt)) {
SCTP_DEBUG_PRINTK_IPADDR("transport_strike:association %p",
" transport IP: port:%d failed.\n",
asoc,
@@ -468,6 +468,7 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
* that indicates that we have an outstanding HB.
*/
if (!is_hb || transport->hb_sent) {
+ transport->error_count++;
transport->last_rto = transport->rto;
transport->rto = min((transport->rto * 2), transport->asoc->rto_max);
}
^ permalink raw reply related
* Re: iproute2 / tbf with large burst seems broken again
From: Denys Fedoryschenko @ 2009-08-25 7:34 UTC (permalink / raw)
To: Jarek Poplawski; +Cc: netdev
In-Reply-To: <20090825062203.GA5381@ff.dom.local>
On Tuesday 25 August 2009 09:22:03 Jarek Poplawski wrote:
>
> Right, it's about an overflow and it was expected (theoretically) for
> very low rates (as for current times) while doing this resolution
> change. Probably this kind of warning should be useful if we expect
> there're more people who can actually use something like this yet ;-)
>
> Alas INT_MAX could still be not enough to prevent similar issues
> because in tbf_dequeue such a value (buffer) is increased with tokens.
> I guess we could try to change some variables to 64 bits there, but
> the main question is why anybody needs such strange settings today?
> Did you try e.g. to browse Internet with that rate and the buffer
> e.g. 1500kb or you punish some users only? ;-) Btw, why do you think
> 'buffer 2000kb' is better "for you" with that rate than e.g. 20kb?
>
> Thanks,
> Jarek P.
Life in Lebanon:
Backbone for ISP - $2200 per Mbit and higher.
Accounts 256Kbit/s cost $66/month in some areas.
96 Kbits/s for people with low income costs cheaper.
>From government "alternative" solution - pay $20 for 2GB, but they charge
(without any understandable notice for non-tech end-user) extra traffic :-)
Some people ending month with bills $200/month. Surprise!
Try to browse with 96Kbit/s? U can't actually on this days, with pages that
weight up to 5-10Mbyte...
The only solution - first 2-10Mbyte, for example, for user will be transferred
on high speed, let's say 512Kbit/s, but if he put downloads - he will have
his 96Kbit/s. If he just browse occasionally, his large bucket will
be "recharged" with 96 Kbit/s, and next page will open again fast.
That's how this TBF configuration that i show works. But sure if it is
difficult to solve i will implement something similar in userspace, that will
track user consumption, and just change discipline settings... but sure it
will be different thing. Actually because there is noone else complained
about this except me, i guess i have to solve it by myself. Because better
resolution for high bandwidth traffic shaping much more important even for
me :-)
^ permalink raw reply
* Dave Miller's NYLUG paper on Multiqueue
From: Krishna Kumar2 @ 2009-08-25 7:32 UTC (permalink / raw)
To: netdev
I read some time back that this presentation paper would be available
online, but I haven't been able to locate it till now. Does someone have
a copy (or link) they can post?
thanks,
- KK
^ permalink raw reply
* [PATCH 1/2] trace_events: fix napi's tracepoint
From: Xiao Guangrong @ 2009-08-25 6:49 UTC (permalink / raw)
To: Ingo Molnar
Cc: Steven Rostedt, Frederic Weisbecker, Neil Horman, Wei Yongjun,
David Miller, Netdev, LKML
In-Reply-To: <4A937EF5.4040505@cn.fujitsu.com>
Currently, the napi's tracepoint works will is depend on
"DECLARE_TRACE" definiens in include/trace/define_trace.h,
like below:
#include <trace/events/skb.h> // include define_trace.h
#include <trace/events/napi.h>
there have error, if we remove "#include <trace/events/skb.h>"
or include napi.h in the front of include skb.h, It should
depend on the definiens in include/linux/tracepoint.h and we
can remove the "DECLARE_TRACE" definiens in
include/trace/define_trace.h, because "TRACE_EVENT" not use it
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
include/trace/define_trace.h | 4 ----
net/core/net-traces.c | 4 +++-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index f7a7ae1..76e93bf 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -26,10 +26,6 @@
#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
DEFINE_TRACE(name)
-#undef DECLARE_TRACE
-#define DECLARE_TRACE(name, proto, args) \
- DEFINE_TRACE(name)
-
#undef TRACE_INCLUDE
#undef __TRACE_INCLUDE
diff --git a/net/core/net-traces.c b/net/core/net-traces.c
index f1e982c..42bda72 100644
--- a/net/core/net-traces.c
+++ b/net/core/net-traces.c
@@ -19,13 +19,15 @@
#include <linux/workqueue.h>
#include <linux/netlink.h>
#include <linux/net_dropmon.h>
+#include <linux/tracepoint.h>
#include <asm/unaligned.h>
#include <asm/bitops.h>
#define CREATE_TRACE_POINTS
#include <trace/events/skb.h>
-#include <trace/events/napi.h>
+
+DEFINE_TRACE(napi_poll);
EXPORT_TRACEPOINT_SYMBOL_GPL(kfree_skb);
--
1.6.1.2
^ permalink raw reply related
* Re: UDP multicast packet loss not reported if TX ring overrun?
From: Eric Dumazet @ 2009-08-25 6:46 UTC (permalink / raw)
Cc: Christoph Lameter, Sridhar Samudrala, Nivedita Singhvi, netdev
In-Reply-To: <4A931ED3.1090206@gmail.com>
Eric Dumazet a écrit :
> Christoph Lameter a écrit :
>> On Mon, 17 Aug 2009, Sridhar Samudrala wrote:
>>
>>> On Mon, 2009-08-17 at 18:13 -0400, Christoph Lameter wrote:
>>>> On Mon, 17 Aug 2009, Sridhar Samudrala wrote:
>>>>
>>>>> What about ethtool -S ? Does it report any errors?
>>>> Neither. This is is a broadcom bnx2 NIC.
>>> Are you sure the packets are dropped at the sender?
>> Yes I am sending 400k messages from the app and the receiver only gets
>> 341k @300 byte (which is the line rate). There is no way that the 400k get
>> over the line. Also if I reduce SO_SNDBUF then both receiver and
>> sender get down to 341k.
>>
>> I added the output of ethtool -S at the end.
>>
>> The mcast tool can be had from http://gentwo.org/ll or from my directory
>> on www.kernel.org.
>>
>
> # gcc -v
> Using built-in specs.
> Target: i686-pc-linux-gnu
> Configured with: ../gcc-4.4.1/configure --enable-languages=c,c++ --prefix=/usr
> Thread model: posix
> gcc version 4.4.1 (GCC)
> # pwd
> /opt/src/lldiag-0.14
> # make
> gcc -Wall -omcast mcast.c -lrt -lm
> mcast.c: In function ‘set_ip’:
> mcast.c:121: warning: implicit declaration of function ‘htons’
> mcast.c: In function ‘build_pattern_array’:
> mcast.c:168: warning: implicit declaration of function ‘htonl’
> /tmp/cc4sYCDr.o: In function `lock':
> mcast.c:(.text+0xcad): undefined reference to `__sync_fetch_and_add_4'
> collect2: ld returned 1 exit status
> make: *** [mcast] Error 1
>
>
> I have no idea where is defined sync_fetch_and_add
>
Doh...
Dont bother, I had to add "-march=i686" to CFLAGS to get "xadd" support
^ permalink raw reply
* Re: [Bonding-devel] [PATCH net-next-2.6] bonding: introduce primary_lazy option
From: Jiri Pirko @ 2009-08-25 6:43 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: Nicolas de Pesloüan, netdev, davem, bonding-devel
In-Reply-To: <697.1251135317@death.nxdomain.ibm.com>
Mon, Aug 24, 2009 at 07:35:17PM CEST, fubar@us.ibm.com wrote:
>Jiri Pirko <jpirko@redhat.com> wrote:
>
>>Mon, Aug 24, 2009 at 05:07:18PM CEST, nicolas.2p.debian@free.fr wrote:
>>> Jiri Pirko wrote:
>>>> Thu, Aug 20, 2009 at 02:40:07PM CEST, nicolas.2p.debian@free.fr wrote:
>>> [--cut--]
>>>>> I suggest that instead of having a per bond "primary_lazy" option, we
>>>>> define a per slave option, describing whether this particular slave is
>>>>> "sticky when active" or not.
>>>>>
>>>>> The above setup would become :
>>>>>
>>>>> echo 1 > /sys/class/net/eth0/bonding/sticky_active
>>>>> echo 1 > /sys/class/net/eth1/bonding/sticky_active
>>>>> echo 0 > /sys/class/net/eth2/bonding/sticky_active
>>>>> echo eth0 > /sys/class/net/bond0/bonding/primary
>>>>>
>>>>> Or may be better, keeping the "weight" idea in mind, a per slave option
>>>>> "active_weight" that gives the weight of the slave, *when active*.
>>>>>
>>>>> The effective weight of a slave would become :
>>>>>
>>>>> effective_slave =
>>>>> (is_active ? user_supplied_active_weight ? user_supplied_weight) *
>>>>> natural_weight
>>>>>
>>>>> # Prefer eth0, then one of eth1 or eth2, then eth3.
>>>>> echo 1000 > /sys/class/net/eth0/bonding/weight
>>>>> echo 999 > /sys/class/net/eth1/bonding/weight
>>>>> echo 999 > /sys/class/net/eth2/bonding/weight
>>>>> echo 10 > /sys/class/net/eth3/bonding/weight
>>>>>
>>>>> # Do not switch back to primary eth0 if eth1 or eth2 is active.
>>>>> echo 1000 > /sys/class/net/eth1/bonding/active_weight
>>>>> echo 1000 > /sys/class/net/eth2/bonding/active_weight
>>>>>
>>>>> Every time one changes the user_supplied_weight, then
>>>>> user_supplied_active_weight must be reset to the same value. This
>>>>> way, if no special setup is done on active_weight, then the current
>>>>> normal
>>>>> behavior is achieved.
>>>>
>>>> I must say I like this approach. But it would be not trivial to implement this.
>>>> Therefore I would stick with your propose of extending primary lazy to 3 values
>>>> until the weight option is implemented.
>>>
>>> It sounds good for me. Later, if I eventually implement the weight
>>> option, it shouldn't be that hard to convert internally the primary_lazy
>>> setup to active_weight, the same way we plan to convert internally
>>> primary setup to weight setup.
>>>
>>> primary and primary_lazy are convenient for simple - two slaves only -
>>> configurations. weight and active_weight are for more advanced
>>> configurations. Keeping both configuration interface does sound user
>>> friendly.
>>
>>Ok, I agree.
>>
>>>
>>>> I'm going to implement your propose below.
>>>
>>> By the way, even if I'm not a native English speaker, I think that
>>> primary_lazy option should be named lazy_primary instead.
>>
>>Well I've intentionally put "primary" as a first word to amplify it's linked
>>with primary option... But...
>
> I'm still unclear as to why it's better to add another special
>case option to bonding instead of changing this in user space, other
>than it'd be a change to user space (initscripts / sysconfig).
>
> The way I see it, this patch is adding a mechanism that says,
>effectively, "make slave X the active slave, but do it only once."
>There is already a way to do that in bonding (sysfs, as above, or
>ifenslave -c); I am reluctant to add another without good reason.
Hello Jay.
As I already replied you once it's not only about selecting a slave at the
start. It's also about following:
Imagine you have bond with 3 slaves:
eth0 eth1 eth2
UP(curr) UP UP
DOWN UP(curr) UP
UP UP(curr) UP
UP DOWN UP(curr)
eth2 ends up being current active but we prefer eth0 (as primary interface).
This is not desirable and is solved by primary_lazy option.
Jirka
>
> I'm not necessarily against the "weight" business in general.
>For the purposes of this discussion, however, it's a big complex
>solution to a pretty simple problem, and the "weight" system still has
>to have special sauce added it to to handle this special case.
>
> Last, presuming for the moment that this goes forward as an
>option to bonding, I think this should be named something along the
>lines of "make_active" (or perhaps "make_active_once", but that's a bit
>long). The option has the effect of making the specified slave the
>active slave one time, then the option setting is cleared.
>
> -J
>
>---
> -Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply
* Re: iproute2 / tbf with large burst seems broken again
From: Jarek Poplawski @ 2009-08-25 6:22 UTC (permalink / raw)
To: Denys Fedoryschenko; +Cc: netdev
In-Reply-To: <200908250237.05017.denys@visp.net.lb>
On 25-08-2009 01:37, Denys Fedoryschenko wrote:
> Found issue, it seems tc_core_time2tick will overflow with increased
> resolution on large bucket values. But no idea how to fix it :-(
>
> I add a warning, something like
> unsigned tc_core_time2tick(unsigned time)
> {
> + long long temp = time*tick_in_usec;
> + if (temp > INT_MAX)
> + printf("tc_core_time2tick() overflow!\n");
> return time*tick_in_usec;
> }
>
> Maybe it is good to add in iproute2 mainstream, so user will be warned if
> buffer set too large? (and it will not set incorrect values, that lead to
> unpredictable results.
Right, it's about an overflow and it was expected (theoretically) for
very low rates (as for current times) while doing this resolution
change. Probably this kind of warning should be useful if we expect
there're more people who can actually use something like this yet ;-)
Alas INT_MAX could still be not enough to prevent similar issues
because in tbf_dequeue such a value (buffer) is increased with tokens.
I guess we could try to change some variables to 64 bits there, but
the main question is why anybody needs such strange settings today?
Did you try e.g. to browse Internet with that rate and the buffer
e.g. 1500kb or you punish some users only? ;-) Btw, why do you think
'buffer 2000kb' is better "for you" with that rate than e.g. 20kb?
Thanks,
Jarek P.
^ permalink raw reply
* Re: [PATCH 3/3] Save and restore UNIX socket peer credentials (v2)
From: Oren Laadan @ 2009-08-25 5:54 UTC (permalink / raw)
To: Dan Smith; +Cc: containers, netdev
In-Reply-To: <1251134884-24491-4-git-send-email-danms@us.ibm.com>
Added, thanks.
Dan Smith wrote:
> This saves the uid/gid of the sk_peercred structure in the checkpoint
> stream. On restart, it uses may_setuid() and may_setgid() to determine
> if the uid/gid from the checkpoint stream may be used.
>
> Changes in v3:
> - Fix error path when may_setuid() or may_setgid() fail
>
> Changes in v2:
> - Adjust for may_setgid() change
>
> Acked-by: Serge Hallyn <serue@us.ibm.com>
> Signed-off-by: Dan Smith <danms@us.ibm.com>
> ---
> include/linux/checkpoint_hdr.h | 2 ++
> net/unix/checkpoint.c | 30 +++++++++++++++++-------------
> 2 files changed, 19 insertions(+), 13 deletions(-)
>
> diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h
> index 4d5c22a..78f1f27 100644
> --- a/include/linux/checkpoint_hdr.h
> +++ b/include/linux/checkpoint_hdr.h
> @@ -414,6 +414,8 @@ struct ckpt_hdr_socket_unix {
> struct ckpt_hdr h;
> __s32 this;
> __s32 peer;
> + __u32 peercred_uid;
> + __u32 peercred_gid;
> __u32 flags;
> __u32 laddr_len;
> __u32 raddr_len;
> diff --git a/net/unix/checkpoint.c b/net/unix/checkpoint.c
> index 81252e3..4aff931 100644
> --- a/net/unix/checkpoint.c
> +++ b/net/unix/checkpoint.c
> @@ -3,6 +3,7 @@
> #include <linux/fs_struct.h>
> #include <linux/checkpoint.h>
> #include <linux/checkpoint_hdr.h>
> +#include <linux/user.h>
> #include <net/af_unix.h>
> #include <net/tcp_states.h>
>
> @@ -94,6 +95,9 @@ int unix_checkpoint(struct ckpt_ctx *ctx, struct socket *sock)
> goto out;
> }
>
> + un->peercred_uid = sock->sk->sk_peercred.uid;
> + un->peercred_gid = sock->sk->sk_peercred.gid;
> +
> ret = ckpt_write_obj(ctx, (struct ckpt_hdr *) un);
> if (ret < 0)
> goto out;
> @@ -217,19 +221,6 @@ static int unix_join(struct ckpt_ctx *ctx,
> unix_sk(a)->peer = b;
> unix_sk(b)->peer = a;
>
> - /* TODO:
> - * Checkpoint the credentials, restore them here if the values match
> - * the restored creds or we may_setuid()
> - */
> -
> - a->sk_peercred.pid = task_tgid_vnr(current);
> - a->sk_peercred.uid = ctx->realcred->uid;
> - a->sk_peercred.gid = ctx->realcred->gid;
> -
> - b->sk_peercred.pid = a->sk_peercred.pid;
> - b->sk_peercred.uid = a->sk_peercred.uid;
> - b->sk_peercred.gid = a->sk_peercred.gid;
> -
> if (!UNIX_ADDR_EMPTY(un->raddr_len))
> addr = unix_makeaddr(&un->raddr, un->raddr_len);
> else if (!UNIX_ADDR_EMPTY(un->laddr_len))
> @@ -295,6 +286,19 @@ static int unix_restore_connected(struct ckpt_ctx *ctx,
> goto out;
> }
>
> + this->sk_peercred.pid = task_tgid_vnr(current);
> +
> + if (may_setuid(ctx->realcred->user->user_ns, un->peercred_uid) &&
> + may_setgid(un->peercred_gid)) {
> + this->sk_peercred.uid = un->peercred_uid;
> + this->sk_peercred.gid = un->peercred_gid;
> + } else {
> + ckpt_debug("peercred %i:%i would require setuid",
> + un->peercred_uid, un->peercred_gid);
> + ret = -EPERM;
> + goto out;
> + }
> +
> /* Prime the socket's buffer limit with the maximum. These will be
> * overwritten with the values in the checkpoint stream in a later
> * phase.
^ permalink raw reply
* Re: [PATCH 2/3] Expose may_setuid() in user.h and add may_setgid() (v2)
From: Oren Laadan @ 2009-08-25 5:53 UTC (permalink / raw)
To: Dan Smith; +Cc: containers, netdev, Serge Hallyn
In-Reply-To: <1251134884-24491-3-git-send-email-danms@us.ibm.com>
Added, thanks.
Dan Smith wrote:
> Make these helpers available to others.
>
> Changes in v2:
> - Avoid checking the groupinfo in ctx->realcred against the current in
> may_setgid()
>
> Cc: Serge Hallyn <serue@us.ibm.com>
> Signed-off-by: Dan Smith <danms@us.ibm.com>
> ---
> include/linux/user.h | 9 +++++++++
> kernel/user.c | 13 ++++++++++++-
> 2 files changed, 21 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/user.h b/include/linux/user.h
> index 68daf84..c231e9c 100644
> --- a/include/linux/user.h
> +++ b/include/linux/user.h
> @@ -1 +1,10 @@
> +#ifndef _LINUX_USER_H
> +#define _LINUX_USER_H
> +
> #include <asm/user.h>
> +#include <linux/sched.h>
> +
> +extern int may_setuid(struct user_namespace *ns, uid_t uid);
> +extern int may_setgid(gid_t gid);
> +
> +#endif
> diff --git a/kernel/user.c b/kernel/user.c
> index a535ed6..a78fde7 100644
> --- a/kernel/user.c
> +++ b/kernel/user.c
> @@ -604,7 +604,7 @@ int checkpoint_user(struct ckpt_ctx *ctx, void *ptr)
> return do_checkpoint_user(ctx, (struct user_struct *) ptr);
> }
>
> -static int may_setuid(struct user_namespace *ns, uid_t uid)
> +int may_setuid(struct user_namespace *ns, uid_t uid)
> {
> /*
> * this next check will one day become
> @@ -631,6 +631,17 @@ static int may_setuid(struct user_namespace *ns, uid_t uid)
> return 0;
> }
>
> +int may_setgid(gid_t gid)
> +{
> + if (capable(CAP_SETGID))
> + return 1;
> +
> + if (in_egroup_p(gid))
> + return 1;
> +
> + return 0;
> +}
> +
> static struct user_struct *do_restore_user(struct ckpt_ctx *ctx)
> {
> struct user_struct *u;
^ permalink raw reply
* Re: TSecr != 0 check in inet_lro.c
From: Eric Dumazet @ 2009-08-25 5:42 UTC (permalink / raw)
To: Octavian Purdila; +Cc: Jan-Bernd Themann, netdev, Christoph Raisch
In-Reply-To: <200908250054.50664.opurdila@ixiacom.com>
Octavian Purdila a écrit :
> Hi,
>
> We are seeing a performance issue with TSO/LRO which we tracked down to the
> TSecr !=0 check in lro_tcp_ip_check.
ouch...
>
> It happens when the LRO side's TSval wraps around and gets to 0. That triggers
> the TSO side to send packets with TSecr set to 0, which means that such
> packets won't be aggregated - and that will put a lot of burden on the stack
> which will result in lots of drops.
Probability of such event is 1 / 2^32 or so ?
>
> I'm failing to understand the purpose of this check. Any hints? :)
>
rfc1323 badly interpreted ?
I remember tsecr=0 was forbidden by Linux, while apparently rfc is not
so clear.
rfc1323 : 3.2
The Timestamp Echo Reply field (TSecr) is only valid if the ACK
bit is set in the TCP header; if it is valid, it echos a times-
tamp value that was sent by the remote TCP in the TSval field
of a Timestamps option. When TSecr is not valid, its value
must be zero. The TSecr value will generally be from the most
recent Timestamp option that was received; however, there are
exceptions that are explained below.
Note how this is not saying "a zero Tsecr value is not valid"
I could not find why : "When TSecr is not valid, its value
must be zero", and why we consider a zero value to be not meaningfull...
static inline void tcp_ack_update_rtt(struct sock *sk, const int flag,
const s32 seq_rtt)
{
const struct tcp_sock *tp = tcp_sk(sk);
/* Note that peer MAY send zero echo. In this case it is ignored. (rfc1323) */
if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr)
tcp_ack_saw_tstamp(sk, flag);
else if (seq_rtt >= 0)
tcp_ack_no_tstamp(sk, seq_rtt, flag);
}
static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
struct tcphdr *th, unsigned len)
{
struct tcp_sock *tp = tcp_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
int saved_clamp = tp->rx_opt.mss_clamp;
tcp_parse_options(skb, &tp->rx_opt, 0);
if (th->ack) {
...
if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr &&
!between(tp->rx_opt.rcv_tsecr, tp->retrans_stamp,
tcp_time_stamp)) {
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSACTIVEREJECTED);
goto reset_and_undo;
}
...
static inline void tcp_rcv_rtt_measure_ts(struct sock *sk,
const struct sk_buff *skb)
{
struct tcp_sock *tp = tcp_sk(sk);
if (tp->rx_opt.rcv_tsecr &&
(TCP_SKB_CB(skb)->end_seq -
TCP_SKB_CB(skb)->seq >= inet_csk(sk)->icsk_ack.rcv_mss))
tcp_rcv_rtt_update(tp, tcp_time_stamp - tp->rx_opt.rcv_tsecr, 0);
}
...
static inline int tcp_packet_delayed(struct tcp_sock *tp)
{
return !tp->retrans_stamp ||
(tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr &&
before(tp->rx_opt.rcv_tsecr, tp->retrans_stamp));
}
...
So we dont have a bit saying we received a tsecr, we use the
'if saw_tstamp AND tsecr is not null' convention...
^ permalink raw reply
* [PATCH NEXT 3/4] netxen: remove netxen_nic_niu.c
From: Dhananjay Phadke @ 2009-08-25 5:23 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1251177808-16450-1-git-send-email-dhananjay@netxen.com>
Consolidate all MAC/PHY access functions into netxen_nic_hw.c
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
---
drivers/net/netxen/Makefile | 2 +-
drivers/net/netxen/netxen_nic.h | 27 +++-
drivers/net/netxen/netxen_nic_ctx.c | 38 +++++
drivers/net/netxen/netxen_nic_hw.c | 79 ++++++++++
drivers/net/netxen/netxen_nic_init.c | 10 +-
drivers/net/netxen/netxen_nic_niu.c | 275 ----------------------------------
6 files changed, 141 insertions(+), 290 deletions(-)
delete mode 100644 drivers/net/netxen/netxen_nic_niu.c
diff --git a/drivers/net/netxen/Makefile b/drivers/net/netxen/Makefile
index cf01a91..a70b682 100644
--- a/drivers/net/netxen/Makefile
+++ b/drivers/net/netxen/Makefile
@@ -31,4 +31,4 @@
obj-$(CONFIG_NETXEN_NIC) := netxen_nic.o
netxen_nic-y := netxen_nic_hw.o netxen_nic_main.o netxen_nic_init.o \
- netxen_nic_ethtool.o netxen_nic_niu.o netxen_nic_ctx.o
+ netxen_nic_ethtool.o netxen_nic_ctx.o
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 061e8aa..63e2f79 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -684,7 +684,19 @@ struct netxen_recv_context {
#define NX_CDRP_CMD_GET_STATISTICS 0x0000000f
#define NX_CDRP_CMD_DELETE_STATISTICS 0x00000010
#define NX_CDRP_CMD_SET_MTU 0x00000012
-#define NX_CDRP_CMD_MAX 0x00000013
+#define NX_CDRP_CMD_READ_PHY 0x00000013
+#define NX_CDRP_CMD_WRITE_PHY 0x00000014
+#define NX_CDRP_CMD_READ_HW_REG 0x00000015
+#define NX_CDRP_CMD_GET_FLOW_CTL 0x00000016
+#define NX_CDRP_CMD_SET_FLOW_CTL 0x00000017
+#define NX_CDRP_CMD_READ_MAX_MTU 0x00000018
+#define NX_CDRP_CMD_READ_MAX_LRO 0x00000019
+#define NX_CDRP_CMD_CONFIGURE_TOE 0x0000001a
+#define NX_CDRP_CMD_FUNC_ATTRIB 0x0000001b
+#define NX_CDRP_CMD_READ_PEXQ_PARAMETERS 0x0000001c
+#define NX_CDRP_CMD_GET_LIC_CAPABILITIES 0x0000001d
+#define NX_CDRP_CMD_READ_MAX_LRO_PER_BOARD 0x0000001e
+#define NX_CDRP_CMD_MAX 0x0000001f
#define NX_RCODE_SUCCESS 0
#define NX_RCODE_NO_HOST_MEM 1
@@ -1152,8 +1164,8 @@ struct netxen_adapter {
int (*set_mtu) (struct netxen_adapter *, int);
int (*set_promisc) (struct netxen_adapter *, u32);
void (*set_multi) (struct net_device *);
- int (*phy_read) (struct netxen_adapter *, long reg, u32 *);
- int (*phy_write) (struct netxen_adapter *, long reg, u32 val);
+ int (*phy_read) (struct netxen_adapter *, u32 reg, u32 *);
+ int (*phy_write) (struct netxen_adapter *, u32 reg, u32 val);
int (*init_port) (struct netxen_adapter *, int);
int (*stop_port) (struct netxen_adapter *);
@@ -1185,15 +1197,11 @@ struct netxen_adapter {
const struct firmware *fw;
};
-int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
- u32 mode);
int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port);
int netxen_niu_disable_xg_port(struct netxen_adapter *adapter);
-int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
- __u32 * readval);
-int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
- long reg, __u32 val);
+int nx_fw_cmd_query_phy(struct netxen_adapter *adapter, u32 reg, u32 *val);
+int nx_fw_cmd_set_phy(struct netxen_adapter *adapter, u32 reg, u32 val);
/* Functions available from netxen_nic_hw.c */
int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu);
@@ -1313,6 +1321,7 @@ int netxen_process_rcv_ring(struct nx_host_sds_ring *sds_ring, int max);
void netxen_p2_nic_set_multi(struct net_device *netdev);
void netxen_p3_nic_set_multi(struct net_device *netdev);
void netxen_p3_free_mac_list(struct netxen_adapter *adapter);
+int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode);
int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32);
int netxen_config_intr_coalesce(struct netxen_adapter *adapter);
int netxen_config_rss(struct netxen_adapter *adapter, int enable);
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c
index ef846b4..0f42ab9 100644
--- a/drivers/net/netxen/netxen_nic_ctx.c
+++ b/drivers/net/netxen/netxen_nic_ctx.c
@@ -380,6 +380,44 @@ nx_fw_cmd_destroy_tx_ctx(struct netxen_adapter *adapter)
}
}
+int
+nx_fw_cmd_query_phy(struct netxen_adapter *adapter, u32 reg, u32 *val)
+{
+ u32 rcode;
+
+ rcode = netxen_issue_cmd(adapter,
+ adapter->ahw.pci_func,
+ NXHAL_VERSION,
+ reg,
+ 0,
+ 0,
+ NX_CDRP_CMD_READ_PHY);
+
+ if (rcode != NX_RCODE_SUCCESS)
+ return -EIO;
+
+ return NXRD32(adapter, NX_ARG1_CRB_OFFSET);
+}
+
+int
+nx_fw_cmd_set_phy(struct netxen_adapter *adapter, u32 reg, u32 val)
+{
+ u32 rcode;
+
+ rcode = netxen_issue_cmd(adapter,
+ adapter->ahw.pci_func,
+ NXHAL_VERSION,
+ reg,
+ val,
+ 0,
+ NX_CDRP_CMD_WRITE_PHY);
+
+ if (rcode != NX_RCODE_SUCCESS)
+ return -EIO;
+
+ return 0;
+}
+
static u64 ctx_addr_sig_regs[][3] = {
{NETXEN_NIC_REG(0x188), NETXEN_NIC_REG(0x18c), NETXEN_NIC_REG(0x1c0)},
{NETXEN_NIC_REG(0x190), NETXEN_NIC_REG(0x194), NETXEN_NIC_REG(0x1c4)},
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index cbfe44c..1a8ad62 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -348,6 +348,35 @@ netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem)
val = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem)));
}
+int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
+{
+ if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
+ NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1+(0x10000*port), 0x1447);
+ NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0+(0x10000*port), 0x5);
+ }
+
+ return 0;
+}
+
+/* Disable an XG interface */
+int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
+{
+ __u32 mac_cfg;
+ u32 port = adapter->physical_port;
+
+ if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
+ return 0;
+
+ if (port > NETXEN_NIU_MAX_XG_PORTS)
+ return -EINVAL;
+
+ mac_cfg = 0;
+ if (NXWR32(adapter,
+ NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg))
+ return -EIO;
+ return 0;
+}
+
#define NETXEN_UNICAST_ADDR(port, index) \
(NETXEN_UNICAST_ADDR_BASE+(port*32)+(index*8))
#define NETXEN_MCAST_ADDR(port, index) \
@@ -357,6 +386,56 @@ netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem)
#define MAC_LO(addr) \
((addr[5] << 16) | (addr[4] << 8) | (addr[3]))
+int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
+{
+ __u32 reg;
+ u32 port = adapter->physical_port;
+
+ if (port > NETXEN_NIU_MAX_XG_PORTS)
+ return -EINVAL;
+
+ reg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port));
+ if (mode == NETXEN_NIU_PROMISC_MODE)
+ reg = (reg | 0x2000UL);
+ else
+ reg = (reg & ~0x2000UL);
+
+ if (mode == NETXEN_NIU_ALLMULTI_MODE)
+ reg = (reg | 0x1000UL);
+ else
+ reg = (reg & ~0x1000UL);
+
+ NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg);
+
+ return 0;
+}
+
+int netxen_p2_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr)
+{
+ u32 mac_hi, mac_lo;
+ u32 reg_hi, reg_lo;
+
+ u8 phy = adapter->physical_port;
+
+ if (phy >= NETXEN_NIU_MAX_XG_PORTS)
+ return -EINVAL;
+
+ mac_lo = ((u32)addr[0] << 16) | ((u32)addr[1] << 24);
+ mac_hi = addr[2] | ((u32)addr[3] << 8) |
+ ((u32)addr[4] << 16) | ((u32)addr[5] << 24);
+
+ reg_lo = NETXEN_NIU_XGE_STATION_ADDR_0_1 + (0x10000 * phy);
+ reg_hi = NETXEN_NIU_XGE_STATION_ADDR_0_HI + (0x10000 * phy);
+
+ /* write twice to flush */
+ if (NXWR32(adapter, reg_lo, mac_lo) || NXWR32(adapter, reg_hi, mac_hi))
+ return -EIO;
+ if (NXWR32(adapter, reg_lo, mac_lo) || NXWR32(adapter, reg_hi, mac_hi))
+ return -EIO;
+
+ return 0;
+}
+
static int
netxen_nic_enable_mcast_filter(struct netxen_adapter *adapter)
{
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 313cd26..8d4aa6f 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -328,17 +328,17 @@ void netxen_initialize_adapter_ops(struct netxen_adapter *adapter)
adapter->macaddr_set = netxen_p2_nic_set_mac_addr;
adapter->set_multi = netxen_p2_nic_set_multi;
adapter->set_mtu = netxen_nic_set_mtu_xgb;
- adapter->set_promisc = netxen_niu_xg_set_promiscuous_mode;
+ adapter->set_promisc = netxen_p2_nic_set_promisc;
} else {
adapter->set_mtu = nx_fw_cmd_set_mtu;
adapter->set_promisc = netxen_p3_nic_set_promisc;
adapter->macaddr_set = netxen_p3_nic_set_mac_addr;
adapter->set_multi = netxen_p3_nic_set_multi;
- }
- if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
- adapter->phy_read = netxen_niu_gbe_phy_read;
- adapter->phy_write = netxen_niu_gbe_phy_write;
+ if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
+ adapter->phy_read = nx_fw_cmd_query_phy;
+ adapter->phy_write = nx_fw_cmd_set_phy;
+ }
}
}
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
deleted file mode 100644
index 1392e89..0000000
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (C) 2003 - 2009 NetXen, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.
- *
- * Contact Information:
- * info@netxen.com
- * NetXen Inc,
- * 18922 Forge Drive
- * Cupertino, CA 95014-0701
- *
- */
-
-#include "netxen_nic.h"
-
-/*
- * netxen_niu_gbe_phy_read - read a register from the GbE PHY via
- * mii management interface.
- *
- * Note: The MII management interface goes through port 0.
- * Individual phys are addressed as follows:
- * @param phy [15:8] phy id
- * @param reg [7:0] register number
- *
- * @returns 0 on success
- * -1 on error
- *
- */
-int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
- __u32 * readval)
-{
- long timeout = 0;
- long result = 0;
- long restore = 0;
- long phy = adapter->physical_port;
- __u32 address;
- __u32 command;
- __u32 status;
- __u32 mac_cfg0;
-
- if (netxen_phy_lock(adapter) != 0)
- return -1;
-
- /*
- * MII mgmt all goes through port 0 MAC interface,
- * so it cannot be in reset
- */
-
- mac_cfg0 = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0));
- if (netxen_gb_get_soft_reset(mac_cfg0)) {
- __u32 temp;
- temp = 0;
- netxen_gb_tx_reset_pb(temp);
- netxen_gb_rx_reset_pb(temp);
- netxen_gb_tx_reset_mac(temp);
- netxen_gb_rx_reset_mac(temp);
- if (NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0), temp))
- return -EIO;
- restore = 1;
- }
-
- address = 0;
- netxen_gb_mii_mgmt_reg_addr(address, reg);
- netxen_gb_mii_mgmt_phy_addr(address, phy);
- if (NXWR32(adapter, NETXEN_NIU_GB_MII_MGMT_ADDR(0), address))
- return -EIO;
- command = 0; /* turn off any prior activity */
- if (NXWR32(adapter, NETXEN_NIU_GB_MII_MGMT_COMMAND(0), command))
- return -EIO;
- /* send read command */
- netxen_gb_mii_mgmt_set_read_cycle(command);
- if (NXWR32(adapter, NETXEN_NIU_GB_MII_MGMT_COMMAND(0), command))
- return -EIO;
-
- status = 0;
- do {
- status = NXRD32(adapter, NETXEN_NIU_GB_MII_MGMT_INDICATE(0));
- timeout++;
- } while ((netxen_get_gb_mii_mgmt_busy(status)
- || netxen_get_gb_mii_mgmt_notvalid(status))
- && (timeout++ < NETXEN_NIU_PHY_WAITMAX));
-
- if (timeout < NETXEN_NIU_PHY_WAITMAX) {
- *readval = NXRD32(adapter, NETXEN_NIU_GB_MII_MGMT_STATUS(0));
- result = 0;
- } else
- result = -1;
-
- if (restore)
- if (NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0), mac_cfg0))
- return -EIO;
- netxen_phy_unlock(adapter);
- return result;
-}
-
-/*
- * netxen_niu_gbe_phy_write - write a register to the GbE PHY via
- * mii management interface.
- *
- * Note: The MII management interface goes through port 0.
- * Individual phys are addressed as follows:
- * @param phy [15:8] phy id
- * @param reg [7:0] register number
- *
- * @returns 0 on success
- * -1 on error
- *
- */
-int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg,
- __u32 val)
-{
- long timeout = 0;
- long result = 0;
- long restore = 0;
- long phy = adapter->physical_port;
- __u32 address;
- __u32 command;
- __u32 status;
- __u32 mac_cfg0;
-
- /*
- * MII mgmt all goes through port 0 MAC interface, so it
- * cannot be in reset
- */
-
- mac_cfg0 = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0));
- if (netxen_gb_get_soft_reset(mac_cfg0)) {
- __u32 temp;
- temp = 0;
- netxen_gb_tx_reset_pb(temp);
- netxen_gb_rx_reset_pb(temp);
- netxen_gb_tx_reset_mac(temp);
- netxen_gb_rx_reset_mac(temp);
-
- if (NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0), temp))
- return -EIO;
- restore = 1;
- }
-
- command = 0; /* turn off any prior activity */
- if (NXWR32(adapter, NETXEN_NIU_GB_MII_MGMT_COMMAND(0), command))
- return -EIO;
-
- address = 0;
- netxen_gb_mii_mgmt_reg_addr(address, reg);
- netxen_gb_mii_mgmt_phy_addr(address, phy);
- if (NXWR32(adapter, NETXEN_NIU_GB_MII_MGMT_ADDR(0), address))
- return -EIO;
-
- if (NXWR32(adapter, NETXEN_NIU_GB_MII_MGMT_CTRL(0), val))
- return -EIO;
-
- status = 0;
- do {
- status = NXRD32(adapter, NETXEN_NIU_GB_MII_MGMT_INDICATE(0));
- timeout++;
- } while ((netxen_get_gb_mii_mgmt_busy(status))
- && (timeout++ < NETXEN_NIU_PHY_WAITMAX));
-
- if (timeout < NETXEN_NIU_PHY_WAITMAX)
- result = 0;
- else
- result = -EIO;
-
- /* restore the state of port 0 MAC in case we tampered with it */
- if (restore)
- if (NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0), mac_cfg0))
- return -EIO;
-
- return result;
-}
-
-int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
-{
- if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
- NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1+(0x10000*port), 0x1447);
- NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0+(0x10000*port), 0x5);
- }
-
- return 0;
-}
-
-/* Disable an XG interface */
-int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
-{
- __u32 mac_cfg;
- u32 port = adapter->physical_port;
-
- if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
- return 0;
-
- if (port > NETXEN_NIU_MAX_XG_PORTS)
- return -EINVAL;
-
- mac_cfg = 0;
- if (NXWR32(adapter,
- NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg))
- return -EIO;
- return 0;
-}
-
-int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
- u32 mode)
-{
- __u32 reg;
- u32 port = adapter->physical_port;
-
- if (port > NETXEN_NIU_MAX_XG_PORTS)
- return -EINVAL;
-
- reg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port));
- if (mode == NETXEN_NIU_PROMISC_MODE)
- reg = (reg | 0x2000UL);
- else
- reg = (reg & ~0x2000UL);
-
- if (mode == NETXEN_NIU_ALLMULTI_MODE)
- reg = (reg | 0x1000UL);
- else
- reg = (reg & ~0x1000UL);
-
- NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg);
-
- return 0;
-}
-
-int netxen_p2_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr)
-{
- u32 mac_hi, mac_lo;
- u32 reg_hi, reg_lo;
-
- u8 phy = adapter->physical_port;
- u8 phy_count = (adapter->ahw.port_type == NETXEN_NIC_XGBE) ?
- NETXEN_NIU_MAX_XG_PORTS : NETXEN_NIU_MAX_GBE_PORTS;
-
- if (phy >= phy_count)
- return -EINVAL;
-
- mac_lo = ((u32)addr[0] << 16) | ((u32)addr[1] << 24);
- mac_hi = addr[2] | ((u32)addr[3] << 8) |
- ((u32)addr[4] << 16) | ((u32)addr[5] << 24);
-
- if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
- reg_lo = NETXEN_NIU_XGE_STATION_ADDR_0_1 + (0x10000 * phy);
- reg_hi = NETXEN_NIU_XGE_STATION_ADDR_0_HI + (0x10000 * phy);
- } else {
- reg_lo = NETXEN_NIU_GB_STATION_ADDR_1(phy);
- reg_hi = NETXEN_NIU_GB_STATION_ADDR_0(phy);
- }
-
- /* write twice to flush */
- if (NXWR32(adapter, reg_lo, mac_lo) || NXWR32(adapter, reg_hi, mac_hi))
- return -EIO;
- if (NXWR32(adapter, reg_lo, mac_lo) || NXWR32(adapter, reg_hi, mac_hi))
- return -EIO;
-
- return 0;
-}
--
1.6.0.2
^ 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