* [PATCH NEXT 2/2] qlcnic: Remove validation for max tx and max rx queues
From: Amit Kumar Salecha @ 2011-02-21 11:58 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty, Rajesh Borundia
In-Reply-To: <1298289514-15671-1-git-send-email-amit.salecha@qlogic.com>
From: Rajesh Borundia <rajesh.borundia@qlogic.com>
Max rx queues and tx queues are governed by fimware.
So driver should not validate these values.
Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic.h | 4 ----
drivers/net/qlcnic/qlcnic_main.c | 6 ++----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index fa7f794..dc44564 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -1132,14 +1132,10 @@ struct qlcnic_eswitch {
#define MAX_BW 100 /* % of link speed */
#define MAX_VLAN_ID 4095
#define MIN_VLAN_ID 2
-#define MAX_TX_QUEUES 1
-#define MAX_RX_QUEUES 4
#define DEFAULT_MAC_LEARN 1
#define IS_VALID_VLAN(vlan) (vlan >= MIN_VLAN_ID && vlan < MAX_VLAN_ID)
#define IS_VALID_BW(bw) (bw <= MAX_BW)
-#define IS_VALID_TX_QUEUES(que) (que > 0 && que <= MAX_TX_QUEUES)
-#define IS_VALID_RX_QUEUES(que) (que > 0 && que <= MAX_RX_QUEUES)
struct qlcnic_pci_func_cfg {
u16 func_type;
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 3fd878c..92e6c62 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -3654,10 +3654,8 @@ validate_npar_config(struct qlcnic_adapter *adapter,
if (adapter->npars[pci_func].type != QLCNIC_TYPE_NIC)
return QL_STATUS_INVALID_PARAM;
- if (!IS_VALID_BW(np_cfg[i].min_bw)
- || !IS_VALID_BW(np_cfg[i].max_bw)
- || !IS_VALID_RX_QUEUES(np_cfg[i].max_rx_queues)
- || !IS_VALID_TX_QUEUES(np_cfg[i].max_tx_queues))
+ if (!IS_VALID_BW(np_cfg[i].min_bw) ||
+ !IS_VALID_BW(np_cfg[i].max_bw))
return QL_STATUS_INVALID_PARAM;
}
return 0;
--
1.7.3.2
^ permalink raw reply related
* [PATCH NEXT 1/2] qlcnic: fix type of module parameters
From: Amit Kumar Salecha @ 2011-02-21 11:58 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty
In-Reply-To: <1298289514-15671-1-git-send-email-amit.salecha@qlogic.com>
o Module parameters auto_fw_reset, use_msi, use_msi_x, qlcnic_mac_learn,
and load_fw_file should be of type bool not int.
o All module parameters should have qlcnic prefix.
o Remove unnecessary macro for value "1".
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic.h | 1 -
drivers/net/qlcnic/qlcnic_main.c | 46 +++++++++++++++++++-------------------
2 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 44e316f..fa7f794 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -867,7 +867,6 @@ struct qlcnic_nic_intr_coalesce {
#define LINKEVENT_LINKSPEED_MBPS 0
#define LINKEVENT_LINKSPEED_ENCODED 1
-#define AUTO_FW_RESET_ENABLED 0x01
/* firmware response header:
* 63:58 - message type
* 57:56 - owner
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 37c04b4..3fd878c 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -30,25 +30,26 @@ static const char qlcnic_driver_string[] = "QLogic 1/10 GbE "
"Converged/Intelligent Ethernet Driver v" QLCNIC_LINUX_VERSIONID;
static struct workqueue_struct *qlcnic_wq;
-static int qlcnic_mac_learn;
-module_param(qlcnic_mac_learn, int, 0444);
+static bool qlcnic_mac_learn;
+module_param(qlcnic_mac_learn, bool, 0444);
MODULE_PARM_DESC(qlcnic_mac_learn, "Mac Filter (0=disabled, 1=enabled)");
-static int use_msi = 1;
-module_param(use_msi, int, 0444);
-MODULE_PARM_DESC(use_msi, "MSI interrupt (0=disabled, 1=enabled");
+static bool qlcnic_use_msi = 1;
+module_param(qlcnic_use_msi, bool, 0444);
+MODULE_PARM_DESC(qlcnic_use_msi, "MSI interrupt (0=disabled, 1=enabled");
-static int use_msi_x = 1;
-module_param(use_msi_x, int, 0444);
-MODULE_PARM_DESC(use_msi_x, "MSI-X interrupt (0=disabled, 1=enabled");
+static bool qlcnic_use_msi_x = 1;
+module_param(qlcnic_use_msi_x, bool, 0444);
+MODULE_PARM_DESC(qlcnic_use_msi_x, "MSI-X interrupt (0=disabled, 1=enabled");
-static int auto_fw_reset = AUTO_FW_RESET_ENABLED;
-module_param(auto_fw_reset, int, 0644);
-MODULE_PARM_DESC(auto_fw_reset, "Auto firmware reset (0=disabled, 1=enabled");
+static bool qlcnic_auto_fw_reset = 1;
+module_param(qlcnic_auto_fw_reset, bool, 0644);
+MODULE_PARM_DESC(qlcnic_auto_fw_reset,
+ "Auto firmware reset (0=disabled, 1=enabled");
-static int load_fw_file;
-module_param(load_fw_file, int, 0444);
-MODULE_PARM_DESC(load_fw_file, "Load firmware from (0=flash, 1=file");
+static bool qlcnic_load_fw_file;
+module_param(qlcnic_load_fw_file, bool, 0444);
+MODULE_PARM_DESC(qlcnic_load_fw_file, "Load firmware from (0=flash, 1=file");
static int qlcnic_config_npars;
module_param(qlcnic_config_npars, int, 0444);
@@ -404,7 +405,7 @@ qlcnic_setup_intr(struct qlcnic_adapter *adapter)
/* fall through for msi */
}
- if (use_msi && !pci_enable_msi(pdev)) {
+ if (qlcnic_use_msi && !pci_enable_msi(pdev)) {
adapter->flags |= QLCNIC_MSI_ENABLED;
adapter->tgt_status_reg = qlcnic_get_ioaddr(adapter,
msi_tgt_status[adapter->ahw.pci_func]);
@@ -658,8 +659,8 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
adapter->max_rxd = MAX_RCV_DESCRIPTORS_1G;
}
- adapter->msix_supported = !!use_msi_x;
- adapter->rss_supported = !!use_msi_x;
+ adapter->msix_supported = qlcnic_use_msi_x;
+ adapter->rss_supported = qlcnic_use_msi_x;
adapter->num_txd = MAX_CMD_DESCRIPTORS;
@@ -972,7 +973,7 @@ qlcnic_start_firmware(struct qlcnic_adapter *adapter)
else if (!err)
goto check_fw_status;
- if (load_fw_file)
+ if (qlcnic_load_fw_file)
qlcnic_request_firmware(adapter);
else {
err = qlcnic_check_flash_fw_ver(adapter);
@@ -2959,8 +2960,7 @@ qlcnic_check_health(struct qlcnic_adapter *adapter)
if (adapter->need_fw_reset)
goto detach;
- if (adapter->reset_context &&
- auto_fw_reset == AUTO_FW_RESET_ENABLED) {
+ if (adapter->reset_context && qlcnic_auto_fw_reset) {
qlcnic_reset_hw_context(adapter);
adapter->netdev->trans_start = jiffies;
}
@@ -2973,7 +2973,7 @@ qlcnic_check_health(struct qlcnic_adapter *adapter)
qlcnic_dev_request_reset(adapter);
- if ((auto_fw_reset == AUTO_FW_RESET_ENABLED))
+ if (qlcnic_auto_fw_reset)
clear_bit(__QLCNIC_FW_ATTACHED, &adapter->state);
dev_info(&netdev->dev, "firmware hang detected\n");
@@ -2982,8 +2982,8 @@ detach:
adapter->dev_state = (state == QLCNIC_DEV_NEED_QUISCENT) ? state :
QLCNIC_DEV_NEED_RESET;
- if ((auto_fw_reset == AUTO_FW_RESET_ENABLED) &&
- !test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) {
+ if (qlcnic_auto_fw_reset &&
+ !test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) {
qlcnic_schedule_work(adapter, qlcnic_detach_work, 0);
QLCDB(adapter, DRV, "fw recovery scheduled.\n");
--
1.7.3.2
^ permalink raw reply related
* [PATCH NEXT 0/2]qlcnic: minor fixes
From: Amit Kumar Salecha @ 2011-02-21 11:58 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty
Hi,
Series of 2 minor fixes, apply them on net-next.
Accidentally 2nd patch sent twice, please ignore.
-Amit
^ permalink raw reply
* Re: Mass udp flow reboot linux with RealTek RTL-8169 Gigabit
From: Hans Nieser @ 2011-02-21 11:56 UTC (permalink / raw)
To: Francois Romieu; +Cc: netdev, linux-kernel
Francois Romieu wrote:
> Seblu <seblu@seblu.net> :
> [...]
> > I've applyed your patch on 2.6.38-rc5. Host have rebooted 2mn after udp start.
> > After this reboot, host is still on after 2 hour under a 1Gbit/s udp flow.
>
> Thanks for testing.
>
> > I attached a dmesg output before reboot. Do you need anything else?
>
> Mostly :
> 1. .config
> 2. the size of the udp packets and the mtu
>
> As an option :
> 3. a few seconds of 'vmstat 1' from the host under test
> 4. an 'ethtool -s eth0' from the host under test
> 5. /proc/interrupts from the host under test
> 6. lspci -tv
>
> Can you apply the two attached patches on top of the previous ones and
> give it a try ? The debug should not be too verbose if things are stationary
> enough.
>
<...>
Hi there, I just wanted to chime in on the discussion as I've been having similar
problems with similar hardware; I have a Gigabyte P55-USB3 motherboard
with an on-board Realtek NIC:
r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
r8169 0000:03:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
r8169 0000:03:00.0: setting latency timer to 64
r8169 0000:03:00.0: (unregistered net_device): unknown MAC, using family default
r8169 0000:03:00.0: irq 46 for MSI/MSI-X
r8169 0000:03:00.0: eth0: RTL8168b/8111b at 0xffffc9000001a000, 1c:6f:65:28:2f:2a, XID 0c100000 IRQ 46
A few days ago I noticed my machine had locked up while I was copying
some backup archives over the local gbit LAN over sftp. I then found out
that any kind of high-speed transfer to my machine would cause it to
lock up rather quickly (within seconds), wether that was via sftp, samba
or simply http (wget) from a webserver on my LAN. Slow(ish) transfers of
at most 120mbps don't seem to cause any issues, as I've been able to
download packages via my internet connection for updating my Gentoo
system for months without trouble.
I also found that on dmesg I would get hundreds of "r8169 0000:03:00.0:
eth0: link up" in the few seconds before my machine locks up (or
sometimes it just reboots - but never shutdowns unlike Sébastien).
I have managed to reproduce the hangs/reboots with the following
kernels:
2.6.38-rc5 (also including all three patches you posted in this thread)
2.6.37
2.6.36
With 2.6.36 it seems to take a bit longer to reproduce the hang/reboot
than it does with 2.6.37 and 2.6.38-rc5, and at some point I even got a
backtrace before it locked up (I suppose some stuff has scrolled off the
screen though, not sure how useful this is):
[<ffffffff814a3f8f>] page_fault+0x1f/0x30
[<ffffffff812c529a>] ? ahci_interrupt+0xea/0x700
[<ffffffff813b6901>] ? skb_checksum+0x51/0x2f0
[<ffffffff8108006a>] handle_IRQ_event+0x3a/0xd0
[<ffffffff8108211e>] handle_edge_irq+0xbe/0x170
[<ffffffff810052cd>] handle_irq+0x1d/0x30
[<ffffffff810047e7>] do_IRQ+0x67/0xf0
[<ffffffff814a3d53>] ret_from_intr+0x0/0xa
[<ffffffff8120110b>] ? memcpy+0xb/0xb0
[<ffffffff8120ce7e>] ? swiotlb_bounce+0x1e/0x40
[<ffffffff8120cedb>] ? swiotlb_tbl_sync_single+0x3b/0x70
[<ffffffff8120cf6b>] ? swiotlb_sync_single+0x5b/0x80
[<ffffffff8120d08c>] ? swiotlb_sync_single_for_cpu+0xc/0x10
[<ffffffff812c85da>] ? rtl8169_rx_interrupt+0x25a/0x550
[<ffffffff81046c9d>] ? update_process_times+0x5d/0x70
[<ffffffff812cb828>] ? rtl8169_poll+0x38/0x260
[<ffffffff813c0f0e>] ? net_rx_action+0x8e/0x1a0
[<ffffffff812caab1>] ? rtl8169_interrupt+0x101/0x350
[<ffffffff810404a6>] ? __do_softirq+0xa6/0x130
[<ffffffff8100320c>] ? call_softirq+0x1c/0x30
[<ffffffff8100527d>] ? do_softirq+0x4d/0x80
[<ffffffff8103fdad>] ? irq_exit+0x4d/0x50
[<ffffffff810047f0>] ? do_IRQ+0x70/0xf0
[<ffffffff814a3d53>] ? ret_from_intr+0x0/0xa
<EOI>
(I had to manually type this over so there may be typos in there)
On all the kernel versions on which I was able to reproduce the problem
my transer speed was also much slower than expected; somewhere around
10-20MiB/s (it seems to start out at 20MiB/s, then go down a bit to
<10MiB/s before the machine finally locks up, or sometimes the reverse
of this).
I was not able to reproduce the problem on 2.6.35.9, and managed to get
consistent transfer speeds of around 107MiB/s (using wget) with that
kernel. While I haven't spent too much time trying to reproduce it (just
a couple dozen of transfers of a 1GB file), at the very least it is much
harder to reproduce than on the newer kernels. There were also much less
'link up' messages on dmesg with this kernel, just one every few seconds
instead of dozens per second.
I'm not sure if it's worth the effort to try and git bisect between
2.6.35 and 2.6.36, but let me know if you think it is and I'll give it a
shot.
One other thing I observed (not sure if it's relevant, but just in case)
was that for all the kernels that I was able to reproduce the problem
with, the MSI irq was 46, while with 2.6.35.9 the MSI irq was 50.
I'll spend some more time this evening or tomorrow doing some more
testing and getting the other things you requested from Sébastien if you
think that useful to know in my case as well
Here is at least the output of lspci -tv:
lspci -tv:
-[0000:00]-+-00.0 Intel Corporation Core Processor DMI
+-03.0-[01]--+-00.0 ATI Technologies Inc Cypress [Radeon HD 5800 Series]
| \-00.1 ATI Technologies Inc Cypress HDMI Audio [Radeon HD 5800 Series]
+-08.0 Intel Corporation Core Processor System Management Registers
+-08.1 Intel Corporation Core Processor Semaphore and Scratchpad Registers
+-08.2 Intel Corporation Core Processor System Control and Status Registers
+-08.3 Intel Corporation Core Processor Miscellaneous Registers
+-10.0 Intel Corporation Core Processor QPI Link
+-10.1 Intel Corporation Core Processor QPI Routing and Protocol Registers
+-1a.0 Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller
+-1a.1 Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller
+-1a.2 Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller
+-1a.7 Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
+-1b.0 Intel Corporation 5 Series/3400 Series Chipset High Definition Audio
+-1c.0-[02]--+-00.0 JMicron Technology Corp. JMB362/JMB363 Serial ATA Controller
| \-00.1 JMicron Technology Corp. JMB362/JMB363 Serial ATA Controller
+-1c.1-[03]----00.0 Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
+-1c.2-[04]----00.0 NEC Corporation Device 0194
+-1d.0 Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller
+-1d.1 Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller
+-1d.2 Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller
+-1d.3 Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller
+-1d.7 Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
+-1e.0-[05]----04.0 Texas Instruments TSB12LV23 IEEE-1394 Controller
+-1f.0 Intel Corporation 5 Series Chipset LPC Interface Controller
+-1f.2 Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller
\-1f.3 Intel Corporation 5 Series/3400 Series Chipset SMBus Controller
and lspci -vvxxx for my device (the motherboard reported is incorrect, it's definitely a GA-P55-USB3):
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)
Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 46
Region 0: I/O ports at de00 [size=256]
Region 2: Memory at fbeff000 (64-bit, prefetchable) [size=4K]
Region 4: Memory at fbef8000 (64-bit, prefetchable) [size=16K]
[virtual] Expansion ROM at fbe00000 [disabled] [size=128K]
Capabilities: [40] Power Management version 3
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
Address: 00000000fee0f00c Data: 4189
Capabilities: [70] Express (v2) Endpoint, MSI 01
DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <512ns, L1 <64us
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 4096 bytes
DevSta: CorrErr+ UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 <512ns, L1 <64us
ClockPM+ Surprise- LLActRep- BwNot-
LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Not Supported, TimeoutDis+
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-
LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -6dB
Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
Vector table: BAR=4 offset=00000000
PBA: BAR=4 offset=00000800
Capabilities: [d0] Vital Product Data
Unknown small resource type 00, will not decode more.
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr+ BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
Capabilities: [140 v1] Virtual Channel
Caps: LPEVC=0 RefClk=100ns PATEntryBits=1
Arb: Fixed- WRR32- WRR64- WRR128-
Ctrl: ArbSelect=Fixed
Status: InProgress-
VC0: Caps: PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
Arb: Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
Ctrl: Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
Status: NegoPending- InProgress-
Capabilities: [160 v1] Device Serial Number 12-34-56-78-12-34-56-78
Kernel driver in use: r8169
00: ec 10 68 81 07 04 10 00 06 00 00 02 10 00 00 00
10: 01 de 00 00 00 00 00 00 0c f0 ef fb 00 00 00 00
20: 0c 80 ef fb 00 00 00 00 00 00 00 00 58 14 00 e0
30: 00 00 00 00 40 00 00 00 00 00 00 00 0b 01 00 00
40: 01 50 c3 ff 08 00 00 00 00 00 00 00 00 00 00 00
50: 05 70 81 00 0c f0 e0 fe 00 00 00 00 89 41 00 00
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
70: 10 b0 02 02 c1 8c 28 00 10 50 11 00 11 3c 07 00
80: 40 00 11 10 00 00 00 00 00 00 00 00 00 00 00 00
90: 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 11 d0 03 00 04 00 00 00 04 08 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 03 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^ permalink raw reply
* Re: [PATCH 2/2] DM9000B: Fix PHY power for network down/up
From: Sergei Shtylyov @ 2011-02-21 11:14 UTC (permalink / raw)
To: Henry Nestler; +Cc: netdev, tori, akpm, linux-arm-kernel
In-Reply-To: <4D618B5D.5040001@henry.nestler.mail.gmail.com>
Hello.
On 21-02-2011 0:45, Henry Nestler wrote:
> DM9000 revision B needs 1 ms delay after PHY power on (see spec), and PHY
> power must on in register
Couldn't parse that.
> DM9000_GPR before all other settings will change.
> Remember, that register DM9000_GPR was not changed by reset sequence.
> Without these fix the FIFO goes out of sync and sends wrong data after
s/these/this/
> sequence of "ifconfig ethX down ; sleep 3 ; ifconfig ethX up".
[...]
> diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
> index 2d4c4fc..5925569 100644
> --- a/drivers/net/dm9000.c
> +++ b/drivers/net/dm9000.c
[...]
> @@ -1194,6 +1191,10 @@ dm9000_open(struct net_device *dev)
> if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev))
> return -EAGAIN;
>
> + /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */
> + iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */
> + udelay(1000); /* delay needs by DM9000B */
Why not mdelay(1)?
WBR, Sergei
^ permalink raw reply
* RE: [PATCH v2 2/2] r8169: Support RTL8105E
From: hayeswang @ 2011-02-21 9:17 UTC (permalink / raw)
To: 'Francois Romieu'; +Cc: netdev, linux-kernel
In-Reply-To: <20110221073328.GA12326@electric-eye.fr.zoreil.com>
> -----Original Message-----
> From: Francois Romieu [mailto:romieu@fr.zoreil.com]
> Sent: Monday, February 21, 2011 3:33 PM
> To: Hayeswang
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 2/2] r8169: Support RTL8105E
>
> > @@ -267,6 +272,12 @@ enum rtl8168_8101_registers {
> > #define EPHYAR_REG_MASK 0x1f
> > #define EPHYAR_REG_SHIFT 16
> > #define EPHYAR_DATA_MASK 0xffff
> > + DLLPR = 0xd0,
> > +#define PM_SWITCH (1 << 6)
> > + TWSI = 0xd2,
> > + MCU = 0xd3,
> > +#define EN_NDP (1 << 3)
> > +#define EN_OOB_RESET (1 << 2)
> > DBG_REG = 0xd1,
> > #define FIX_NAK_1 (1 << 4)
> > #define FIX_NAK_2 (1 << 3)
>
> Please pack them in increasing order and it will be perfect
> (i.e. 0xd0, 0xd1, 0xd2, 0xd3 instead of current 0xd0, 0xd2
> (?), 0xd3, 0xd1).
It's my mistake. I would fix that.
>
> > + rtl_writephy(tp, 0x1f, 0x0000);
> > + rtl_writephy(tp, 0x18, 0x0310);
> > + msleep(100);
> > +
> > + if (rtl_apply_firmware(tp, FIRMWARE_8105E_1) < 0)
> > + netif_warn(tp, probe, tp->dev, "unable to apply
> firmware patch\n");
> > +
> > + rtl_writephy_batch(tp, phy_reg_init,
> ARRAY_SIZE(phy_reg_init)); }
>
> The "if (RTL_R8(0xef) & 0x08)" and "if (RTL_R8(0xef) &
> 0x010)" conditionals from the previous iteration have been
> removed. If it is done on purpose, a short explanation or
> notification in the description of the patch is always welcome.
>
These two conditions are using for customization. I remove them and use the
default settings.
Best Regards,
Hayes
^ permalink raw reply
* Re: [PATCH] CAN: add controller hardware name for Softing cards
From: Marc Kleine-Budde @ 2011-02-21 9:13 UTC (permalink / raw)
To: Kurt Van Dijck; +Cc: netdev
In-Reply-To: <20110221090421.GF328@e-circ.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]
On 02/21/2011 10:04 AM, Kurt Van Dijck wrote:
> I just found that the controller hardware name is not set for the Softing
> driver. After this patch, "$ ip -d link show" looks nicer.
>
> Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Marc
> ---
> diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
> index 5157e15..aeea9f9 100644
> --- a/drivers/net/can/softing/softing_main.c
> +++ b/drivers/net/can/softing/softing_main.c
> @@ -633,6 +633,7 @@ static const struct net_device_ops softing_netdev_ops = {
> };
>
> static const struct can_bittiming_const softing_btr_const = {
> + .name = "softing",
> .tseg1_min = 1,
> .tseg1_max = 16,
> .tseg2_min = 1,
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply
* [PATCH] CAN: add controller hardware name for Softing cards
From: Kurt Van Dijck @ 2011-02-21 9:04 UTC (permalink / raw)
To: netdev
I just found that the controller hardware name is not set for the Softing
driver. After this patch, "$ ip -d link show" looks nicer.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
---
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
index 5157e15..aeea9f9 100644
--- a/drivers/net/can/softing/softing_main.c
+++ b/drivers/net/can/softing/softing_main.c
@@ -633,6 +633,7 @@ static const struct net_device_ops softing_netdev_ops = {
};
static const struct can_bittiming_const softing_btr_const = {
+ .name = "softing",
.tseg1_min = 1,
.tseg1_max = 16,
.tseg2_min = 1,
^ permalink raw reply related
* Re: [PATCH v2 2/2] r8169: Support RTL8105E
From: Francois Romieu @ 2011-02-21 7:33 UTC (permalink / raw)
To: Hayes Wang; +Cc: netdev, linux-kernel
In-Reply-To: <1298018085-1370-2-git-send-email-hayeswang@realtek.com>
Hayes Wang <hayeswang@realtek.com> :
> Support the new chips for RTL8105E
>
> Signed-off-by: Hayes Wang <hayeswang@realtek.com>
> ---
> drivers/net/r8169.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 90 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
> index 9eaf78f..ffe6b00 100644
> --- a/drivers/net/r8169.c
> +++ b/drivers/net/r8169.c
[...]
> @@ -267,6 +272,12 @@ enum rtl8168_8101_registers {
> #define EPHYAR_REG_MASK 0x1f
> #define EPHYAR_REG_SHIFT 16
> #define EPHYAR_DATA_MASK 0xffff
> + DLLPR = 0xd0,
> +#define PM_SWITCH (1 << 6)
> + TWSI = 0xd2,
> + MCU = 0xd3,
> +#define EN_NDP (1 << 3)
> +#define EN_OOB_RESET (1 << 2)
> DBG_REG = 0xd1,
> #define FIX_NAK_1 (1 << 4)
> #define FIX_NAK_2 (1 << 3)
Please pack them in increasing order and it will be perfect
(i.e. 0xd0, 0xd1, 0xd2, 0xd3 instead of current 0xd0, 0xd2 (?), 0xd3, 0xd1).
[...]
> @@ -2435,6 +2452,33 @@ static void rtl8102e_hw_phy_config(struct rtl8169_private *tp)
> rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
> }
>
> +static void rtl8105e_hw_phy_config(struct rtl8169_private *tp)
> +{
> + static const struct phy_reg phy_reg_init[] = {
> + {0x1f, 0x0005},
> + {0x1a, 0x0000},
> + {0x1f, 0x0000},
> +
> + {0x1f, 0x0004},
> + {0x1c, 0x0000},
> + {0x1f, 0x0000},
> +
> + {0x1f, 0x0001},
> + {0x15, 0x7701},
> + {0x1f, 0x0000}
^^ ^^
Minor nit: please insert spaces (as in similar declarations).
> + };
> +
> + /* Diable ALDPS before ram code */
^^ Missing "b".
> + rtl_writephy(tp, 0x1f, 0x0000);
> + rtl_writephy(tp, 0x18, 0x0310);
> + msleep(100);
> +
> + if (rtl_apply_firmware(tp, FIRMWARE_8105E_1) < 0)
> + netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
> +
> + rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
> +}
The "if (RTL_R8(0xef) & 0x08)" and "if (RTL_R8(0xef) & 0x010)" conditionals
from the previous iteration have been removed. If it is done on purpose, a
short explanation or notification in the description of the patch is always
welcome.
--
Ueimor
^ permalink raw reply
* Re: linux-next: build warning after merge of the driver-core tree
From: Greg KH @ 2011-02-21 6:32 UTC (permalink / raw)
To: Stephen Rothwell
Cc: linux-next, linux-kernel, Marc Kleine-Budde, Ilya Yanok,
David Miller, netdev
In-Reply-To: <20110221170226.c43175f7.sfr@canb.auug.org.au>
On Mon, Feb 21, 2011 at 05:02:26PM +1100, Stephen Rothwell wrote:
> Hi Greg,
>
> After merging the driver-core tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
>
> drivers/net/dnet.c: In function 'dnet_mii_init':
> drivers/net/dnet.c:340: warning: passing argument 1 of 'platform_set_drvdata' from incompatible pointer type
> include/linux/platform_device.h:138: note: expected 'struct platform_device *' but argument is of type 'struct net_device *'
>
> Revealed by commit 71d642908d4e8e7a2a4a6e0490432e719ff466d5 ("Driver
> core: convert platform_{get,set}_drvdata to static inline functions").
> Introduced by commit 4796417417a62e2ae83d92cb92e1ecf9ec67b5f5 ("dnet:
> Dave DNET ethernet controller driver (updated)").
It sounds like the driver is wrong here :(
thanks,
greg k-h
^ permalink raw reply
* [PATCH]drivers:isdn:istream.c Fix typo pice to piece
From: Justin P. Mattock @ 2011-02-21 6:31 UTC (permalink / raw)
To: trivial; +Cc: mac, isdn, netdev, linux-kernel, Justin P. Mattock
The below patch changes a typo "pice" to "piece"
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
---
drivers/isdn/hardware/eicon/istream.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/isdn/hardware/eicon/istream.c b/drivers/isdn/hardware/eicon/istream.c
index 18f8798..7bd5baa 100644
--- a/drivers/isdn/hardware/eicon/istream.c
+++ b/drivers/isdn/hardware/eicon/istream.c
@@ -62,7 +62,7 @@ void diva_xdi_provide_istream_info (ADAPTER* a,
stream interface.
If synchronous service was requested, then function
does return amount of data written to stream.
- 'final' does indicate that pice of data to be written is
+ 'final' does indicate that piece of data to be written is
final part of frame (necessary only by structured datatransfer)
return 0 if zero lengh packet was written
return -1 if stream is full
--
1.6.5.2.180.gc5b3e
^ permalink raw reply related
* Re: [PATCH] ipv4: add DiffServ priority based routing
From: Philip Prindeville @ 2011-02-21 6:01 UTC (permalink / raw)
To: Benny Amorsen; +Cc: David Miller, torsten.schmidt, netdev
In-Reply-To: <m3tyslyej6.fsf@ursa.amorsen.dk>
On 3/12/10 3:18 AM, Benny Amorsen wrote:
> David Miller<davem@davemloft.net> writes:
>
>> Look, this doesn't work. QoS handling and policy belongs in the
>> egress point to the network, it's the only way to control this
>> properly and prevent abuse.
> First, QoS is important even within the network. Modern switches come
> pre-configured with sane defaults which ensure that e.g. EF marked
> packets get priority over non-EF-marked packets. Cisco, HP, and
> Linksys-Cisco at least provide a decent out-of-the-box configuration.
>
> This can obviously be abused, but the solution there is the same as in
> network abuses: Either apply the LART or change the configuration of the
> switches to be less trusting. We haven't, so far, had a customer where
> the LART was necessary, much less had to reconfigure a switch.
>
> So why not let Linux provide the same out-of-the-box experience as the
> switches do? If the trust is abused Linux provides lots of tools to make
> it less trusting or even to punish the abusers.
>
>
> /Benny
For those who want to use DiffServ as the out-of-the-box default configuration, and trust the marking on their traffic, I don't understand why certain folks are so adamant about not supporting this.
Torsten's patch to allow rt_tos2priority() to use IPTOS_PRECEDENCE() instead seemed reasonable.
Especially in a network using 802.1p or 802.1q encapsulation.
^ permalink raw reply
* linux-next: build warning after merge of the driver-core tree
From: Stephen Rothwell @ 2011-02-21 6:02 UTC (permalink / raw)
To: Greg KH
Cc: linux-next, linux-kernel, Marc Kleine-Budde, Ilya Yanok,
David Miller, netdev
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
Hi Greg,
After merging the driver-core tree, today's linux-next build (x86_64
allmodconfig) produced this warning:
drivers/net/dnet.c: In function 'dnet_mii_init':
drivers/net/dnet.c:340: warning: passing argument 1 of 'platform_set_drvdata' from incompatible pointer type
include/linux/platform_device.h:138: note: expected 'struct platform_device *' but argument is of type 'struct net_device *'
Revealed by commit 71d642908d4e8e7a2a4a6e0490432e719ff466d5 ("Driver
core: convert platform_{get,set}_drvdata to static inline functions").
Introduced by commit 4796417417a62e2ae83d92cb92e1ecf9ec67b5f5 ("dnet:
Dave DNET ethernet controller driver (updated)").
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: Ethernet over GRE and vlans
From: Herbert Xu @ 2011-02-21 5:38 UTC (permalink / raw)
To: Jonathan Thibault; +Cc: netdev
In-Reply-To: <4D43A296.4040906@navigue.com>
On Sat, Jan 29, 2011 at 12:16:06AM -0500, Jonathan Thibault wrote:
>
> Is it wrong on my part to expect such behaviour from gretap devices
> or is this simply not possible/implemented yet?
I don't see why this shouldn't work, so it might be a bug or
misconfiguration. How did you setup gre1.1 and gre2.2?
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* [PATCH] cls_u32: fix sparse warnings
From: Stephen Hemminger @ 2011-02-21 2:14 UTC (permalink / raw)
To: David Miller, jamal; +Cc: netdev
The variable _data is used in asm-generic to define sections
which causes sparse warnings, so just rename the variable.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
net/sched/cls_u32.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/net/sched/cls_u32.c 2011-02-20 17:50:45.469140817 -0800
+++ b/net/sched/cls_u32.c 2011-02-20 17:51:40.205778673 -0800
@@ -134,12 +134,12 @@ next_knode:
for (i = n->sel.nkeys; i > 0; i--, key++) {
int toff = off + key->off + (off2 & key->offmask);
- __be32 *data, _data;
+ __be32 *data, hdata;
if (skb_headroom(skb) + toff > INT_MAX)
goto out;
- data = skb_header_pointer(skb, toff, 4, &_data);
+ data = skb_header_pointer(skb, toff, 4, &hdata);
if (!data)
goto out;
if ((*data ^ key->val) & key->mask) {
@@ -187,10 +187,10 @@ check_terminal:
ht = n->ht_down;
sel = 0;
if (ht->divisor) {
- __be32 *data, _data;
+ __be32 *data, hdata;
data = skb_header_pointer(skb, off + n->sel.hoff, 4,
- &_data);
+ &hdata);
if (!data)
goto out;
sel = ht->divisor & u32_hash_fold(*data, &n->sel,
@@ -202,11 +202,11 @@ check_terminal:
if (n->sel.flags & (TC_U32_OFFSET | TC_U32_VAROFFSET)) {
off2 = n->sel.off + 3;
if (n->sel.flags & TC_U32_VAROFFSET) {
- __be16 *data, _data;
+ __be16 *data, hdata;
data = skb_header_pointer(skb,
off + n->sel.offoff,
- 2, &_data);
+ 2, &hdata);
if (!data)
goto out;
off2 += ntohs(n->sel.offmask & *data) >>
^ permalink raw reply
* Re: libmnl limitation...
From: David Miller @ 2011-02-20 22:38 UTC (permalink / raw)
To: pablo; +Cc: netdev
In-Reply-To: <4D61964E.3090705@netfilter.org>
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Sun, 20 Feb 2011 23:31:42 +0100
> On 20/02/11 23:25, Pablo Neira Ayuso wrote:
>> On 20/02/11 22:41, David Miller wrote:
>>>
>>> Unfortunately, libmnl only allows setting socket options
>>> that are of SOL_NETLINK.
>>>
>>> This precludes setting socket options such as SO_ATTACH_FILTER
>>> which need to be of level SOL_SOCKET.
>>>
>>> It seems to be a mistake to have hard-coded the socket level
>>> instead of simply letting the user specify it :-/
>>
>> Indeed, I'm going to obsolete the current function and provide a new
>> one. Sorry.
>
> Actually, we can obsolete mnl_setsockopt(...), which is silly BTW, and
> we can use mnl_socket_get_fd(...) with setsockopt(...).
Sure.
^ permalink raw reply
* Re: [PATCH] route_bench: Filter out all responses.
From: David Miller @ 2011-02-20 22:32 UTC (permalink / raw)
To: pablo; +Cc: netdev
In-Reply-To: <4D61957F.5060905@netfilter.org>
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Sun, 20 Feb 2011 23:28:15 +0100
> You can use:
>
> extern int mnl_socket_get_fd(const struct mnl_socket *nl);
>
> Thus, you can invoke setsockopt directly ;-).
Thank you, I didn't notice that interface.
I'll check in the following.
--------------------
route_bench: Remove knowledge of libmnl internals, not needed.
Since mnl_socket_get_fd() exists, we can use that.
Thanks to Pablo.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
route_bench.c | 13 ++-----------
1 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/route_bench.c b/route_bench.c
index 6c6b525..063b15e 100644
--- a/route_bench.c
+++ b/route_bench.c
@@ -24,16 +24,6 @@
#include <linux/rtnetlink.h>
#include <linux/filter.h>
-/* XXX Ugly knowledge of internals, but there is currently no way
- * XXX provided by the libmnl library to set socket options that are
- * XXX of level other than SOL_NETLINK. And we need to set one of
- * XXX level SOL_SOCKET to install the socket filter.
- */
-struct mnl_socket {
- int fd;
- struct sockaddr_nl addr;
-};
-
static int usage(void)
{
printf("usage: route_bench [ -o ] [ -l count ]\n");
@@ -178,7 +168,8 @@ static int do_bench(int count, in_addr_t src_addr, in_addr_t dst_addr,
portid = mnl_socket_get_portid(nl);
- err = setsockopt(nl->fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter));
+ err = setsockopt(mnl_socket_get_fd(nl), SOL_SOCKET,
+ SO_ATTACH_FILTER, &filter, sizeof(filter));
if (err) {
perror("setsockopt");
return -1;
--
1.7.4.1
^ permalink raw reply related
* Re: libmnl limitation...
From: Pablo Neira Ayuso @ 2011-02-20 22:31 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <4D6194C2.5020202@netfilter.org>
On 20/02/11 23:25, Pablo Neira Ayuso wrote:
> On 20/02/11 22:41, David Miller wrote:
>>
>> Unfortunately, libmnl only allows setting socket options
>> that are of SOL_NETLINK.
>>
>> This precludes setting socket options such as SO_ATTACH_FILTER
>> which need to be of level SOL_SOCKET.
>>
>> It seems to be a mistake to have hard-coded the socket level
>> instead of simply letting the user specify it :-/
>
> Indeed, I'm going to obsolete the current function and provide a new
> one. Sorry.
Actually, we can obsolete mnl_setsockopt(...), which is silly BTW, and
we can use mnl_socket_get_fd(...) with setsockopt(...).
^ permalink raw reply
* Re: [PATCH] route_bench: Filter out all responses.
From: Pablo Neira Ayuso @ 2011-02-20 22:28 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20110220.140450.48516784.davem@davemloft.net>
On 20/02/11 23:04, David Miller wrote:
>
> Install a socket filter to reduce the pure netlink overhead.
>
> Unfortunately the libmnl library does not provide a way to
> set socket options that are of level other than SOL_NETLINK.
>
> So we hack it by knowing some things about libmnl internals.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>
> The knowledge of libmnl internals is unfortunate, but there
> is currently no other way to do this.
>
> route_bench.c | 33 +++++++++++++++++++++++++--------
> 1 files changed, 25 insertions(+), 8 deletions(-)
>
> diff --git a/route_bench.c b/route_bench.c
> index c75ea45..6c6b525 100644
> --- a/route_bench.c
> +++ b/route_bench.c
> @@ -22,6 +22,17 @@
> #include <linux/if.h>
> #include <linux/if_link.h>
> #include <linux/rtnetlink.h>
> +#include <linux/filter.h>
> +
> +/* XXX Ugly knowledge of internals, but there is currently no way
> + * XXX provided by the libmnl library to set socket options that are
> + * XXX of level other than SOL_NETLINK. And we need to set one of
> + * XXX level SOL_SOCKET to install the socket filter.
> + */
> +struct mnl_socket {
> + int fd;
> + struct sockaddr_nl addr;
> +};
>
> static int usage(void)
> {
> @@ -139,8 +150,10 @@ static int do_bench(int count, in_addr_t src_addr, in_addr_t dst_addr,
> unsigned int mark, unsigned int iif)
> {
> char send_buf[MNL_SOCKET_BUFFER_SIZE];
> - char recv_buf[MNL_SOCKET_BUFFER_SIZE];
> unsigned int min, sec, frac, tmp;
> + struct sock_filter insns = { .code = BPF_RET | BPF_K,
> + .k = 0 };
> + struct sock_fprog filter = { .len = 1, .filter = &insns, };
> struct bench_state *s = &state;
> struct timeval start_time;
> struct timeval end_time;
> @@ -148,7 +161,7 @@ static int do_bench(int count, in_addr_t src_addr, in_addr_t dst_addr,
> struct nlmsghdr *nlh;
> unsigned int portid;
> struct rtmsg *rtm;
> - int i;
> + int i, err;
>
> init_bench_state(s);
>
> @@ -165,10 +178,15 @@ static int do_bench(int count, in_addr_t src_addr, in_addr_t dst_addr,
>
> portid = mnl_socket_get_portid(nl);
>
> + err = setsockopt(nl->fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter));
> + if (err) {
> + perror("setsockopt");
> + return -1;
> + }
> +
You can use:
extern int mnl_socket_get_fd(const struct mnl_socket *nl);
Thus, you can invoke setsockopt directly ;-).
^ permalink raw reply
* Re: libmnl limitation...
From: Pablo Neira Ayuso @ 2011-02-20 22:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20110220.134128.115926805.davem@davemloft.net>
On 20/02/11 22:41, David Miller wrote:
>
> Unfortunately, libmnl only allows setting socket options
> that are of SOL_NETLINK.
>
> This precludes setting socket options such as SO_ATTACH_FILTER
> which need to be of level SOL_SOCKET.
>
> It seems to be a mistake to have hard-coded the socket level
> instead of simply letting the user specify it :-/
Indeed, I'm going to obsolete the current function and provide a new
one. Sorry.
^ permalink raw reply
* [PATCH] route_bench: Filter out all responses.
From: David Miller @ 2011-02-20 22:04 UTC (permalink / raw)
To: netdev; +Cc: pablo
Install a socket filter to reduce the pure netlink overhead.
Unfortunately the libmnl library does not provide a way to
set socket options that are of level other than SOL_NETLINK.
So we hack it by knowing some things about libmnl internals.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
The knowledge of libmnl internals is unfortunate, but there
is currently no other way to do this.
route_bench.c | 33 +++++++++++++++++++++++++--------
1 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/route_bench.c b/route_bench.c
index c75ea45..6c6b525 100644
--- a/route_bench.c
+++ b/route_bench.c
@@ -22,6 +22,17 @@
#include <linux/if.h>
#include <linux/if_link.h>
#include <linux/rtnetlink.h>
+#include <linux/filter.h>
+
+/* XXX Ugly knowledge of internals, but there is currently no way
+ * XXX provided by the libmnl library to set socket options that are
+ * XXX of level other than SOL_NETLINK. And we need to set one of
+ * XXX level SOL_SOCKET to install the socket filter.
+ */
+struct mnl_socket {
+ int fd;
+ struct sockaddr_nl addr;
+};
static int usage(void)
{
@@ -139,8 +150,10 @@ static int do_bench(int count, in_addr_t src_addr, in_addr_t dst_addr,
unsigned int mark, unsigned int iif)
{
char send_buf[MNL_SOCKET_BUFFER_SIZE];
- char recv_buf[MNL_SOCKET_BUFFER_SIZE];
unsigned int min, sec, frac, tmp;
+ struct sock_filter insns = { .code = BPF_RET | BPF_K,
+ .k = 0 };
+ struct sock_fprog filter = { .len = 1, .filter = &insns, };
struct bench_state *s = &state;
struct timeval start_time;
struct timeval end_time;
@@ -148,7 +161,7 @@ static int do_bench(int count, in_addr_t src_addr, in_addr_t dst_addr,
struct nlmsghdr *nlh;
unsigned int portid;
struct rtmsg *rtm;
- int i;
+ int i, err;
init_bench_state(s);
@@ -165,10 +178,15 @@ static int do_bench(int count, in_addr_t src_addr, in_addr_t dst_addr,
portid = mnl_socket_get_portid(nl);
+ err = setsockopt(nl->fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter));
+ if (err) {
+ perror("setsockopt");
+ return -1;
+ }
+
gettimeofday(&start_time, NULL);
for (i = 0; i < count; i++) {
unsigned int seq;
- int ret;
nlh = mnl_nlmsg_put_header(send_buf);
nlh->nlmsg_type = RTM_GETROUTE;
@@ -197,11 +215,10 @@ static int do_bench(int count, in_addr_t src_addr, in_addr_t dst_addr,
perror("mnl_socket_sendto");
return -1;
}
- ret = mnl_socket_recvfrom(nl, recv_buf, sizeof(recv_buf));
- if (ret < 0) {
- perror("mnl_sock_recvfrom");
- return -1;
- }
+
+ /* No need to do a receive, as the socket filter rejects
+ * all packets.
+ */
advance_bench_state(s);
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 2/2] DM9000B: Fix PHY power for network down/up
From: Henry Nestler @ 2011-02-20 21:45 UTC (permalink / raw)
To: netdev; +Cc: akpm, tori, linux-arm-kernel
DM9000 revision B needs 1 ms delay after PHY power on (see spec), and PHY
power must on in register DM9000_GPR before all other settings will change.
Remember, that register DM9000_GPR was not changed by reset sequence.
Without these fix the FIFO goes out of sync and sends wrong data after
sequence of "ifconfig ethX down ; sleep 3 ; ifconfig ethX up".
---
Kernel version 2.6.38-rc5
drivers/net/dm9000.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 2d4c4fc..5925569 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -802,10 +802,7 @@ dm9000_init_dm9000(struct net_device *dev)
/* Checksum mode */
dm9000_set_rx_csum_unlocked(dev, db->rx_csum);
- /* GPIO0 on pre-activate PHY */
- iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */
iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */
- iow(db, DM9000_GPR, 0); /* Enable PHY */
ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0;
@@ -1194,6 +1191,10 @@ dm9000_open(struct net_device *dev)
if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev))
return -EAGAIN;
+ /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */
+ iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */
+ udelay(1000); /* delay needs by DM9000B */
+
/* Initialize DM9000 board */
dm9000_reset(db);
dm9000_init_dm9000(dev);
^ permalink raw reply related
* [PATCH 1/2] DM9000B: Fix reg_save after spin_lock in dm9000_timeout
From: Henry Nestler @ 2011-02-20 21:44 UTC (permalink / raw)
To: netdev; +Cc: trivial, akpm, tori
The spin_lock should hold before reading register.
---
Kernel version 2.6.38-rc5
drivers/net/dm9000.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 2d4c4fc..2bbd496 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -852,8 +852,8 @@ static void dm9000_timeout(struct net_device *dev)
unsigned long flags;
/* Save previous register address */
- reg_save = readb(db->io_addr);
spin_lock_irqsave(&db->lock, flags);
+ reg_save = readb(db->io_addr);
netif_stop_queue(dev);
dm9000_reset(db);
^ permalink raw reply related
* [PATCH net-next 0/6] be2net: patch series
From: Ajit Khaparde @ 2011-02-20 21:42 UTC (permalink / raw)
To: netdev, davem
Patch series for the be2net driver.
[1/6] be2net: add new counters to display via ethtool stats
[2/6] be2net: fixes in ethtool selftest
[3/6] be2net: variable name change
[4/6] be2net: fix to ignore transparent vlan ids wrongly indicated by NIC
[5/6] be2net: add code to display temperature of ASIC
[6/6] be2net: use hba_port_num instead of port_num
Please Apply.
Thanks
-Ajit
^ permalink raw reply
* [PATCH net-next 5/6] be2net: add code to display temperature of ASIC
From: Ajit Khaparde @ 2011-02-20 21:42 UTC (permalink / raw)
To: netdev, davem
Add support to display temperature of ASIC via ethtool -S
From: Somnath K <somnath.kotur@emulex.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
---
drivers/net/benet/be.h | 7 ++++++
drivers/net/benet/be_cmds.c | 44 ++++++++++++++++++++++++++++++++++++++++
drivers/net/benet/be_cmds.h | 16 ++++++++++++++
drivers/net/benet/be_ethtool.c | 11 ++++++++-
4 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 7bf8dd4..46b951f 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -225,6 +225,10 @@ struct be_rx_obj {
u32 cache_line_barrier[15];
};
+struct be_drv_stats {
+ u8 be_on_die_temperature;
+};
+
struct be_vf_cfg {
unsigned char vf_mac_addr[ETH_ALEN];
u32 vf_if_handle;
@@ -234,6 +238,7 @@ struct be_vf_cfg {
};
#define BE_INVALID_PMAC_ID 0xffffffff
+
struct be_adapter {
struct pci_dev *pdev;
struct net_device *netdev;
@@ -269,6 +274,7 @@ struct be_adapter {
u32 big_page_size; /* Compounded page size shared by rx wrbs */
u8 msix_vec_next_idx;
+ struct be_drv_stats drv_stats;
struct vlan_group *vlan_grp;
u16 vlans_added;
@@ -281,6 +287,7 @@ struct be_adapter {
struct be_dma_mem stats_cmd;
/* Work queue used to perform periodic tasks like getting statistics */
struct delayed_work work;
+ u16 work_counter;
/* Ethtool knobs and info */
bool rx_csum; /* BE card must perform rx-checksumming */
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 59d25ac..ff62aae 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -18,6 +18,9 @@
#include "be.h"
#include "be_cmds.h"
+/* Must be a power of 2 or else MODULO will BUG_ON */
+static int be_get_temp_freq = 32;
+
static void be_mcc_notify(struct be_adapter *adapter)
{
struct be_queue_info *mccq = &adapter->mcc_obj.q;
@@ -1069,6 +1072,9 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
struct be_sge *sge;
int status = 0;
+ if (MODULO(adapter->work_counter, be_get_temp_freq) == 0)
+ be_cmd_get_die_temperature(adapter);
+
spin_lock_bh(&adapter->mcc_lock);
wrb = wrb_from_mccq(adapter);
@@ -1136,6 +1142,44 @@ err:
return status;
}
+/* Uses synchronous mcc */
+int be_cmd_get_die_temperature(struct be_adapter *adapter)
+{
+ struct be_mcc_wrb *wrb;
+ struct be_cmd_req_get_cntl_addnl_attribs *req;
+ int status;
+
+ spin_lock_bh(&adapter->mcc_lock);
+
+ wrb = wrb_from_mccq(adapter);
+ if (!wrb) {
+ status = -EBUSY;
+ goto err;
+ }
+ req = embedded_payload(wrb);
+
+ be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0,
+ OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES);
+
+ be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
+ OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES, sizeof(*req));
+
+ status = be_mcc_notify_wait(adapter);
+ if (!status) {
+ struct be_cmd_resp_get_cntl_addnl_attribs *resp =
+ embedded_payload(wrb);
+ adapter->drv_stats.be_on_die_temperature =
+ resp->on_die_temperature;
+ }
+ /* If IOCTL fails once, do not bother issuing it again */
+ else
+ be_get_temp_freq = 0;
+
+err:
+ spin_unlock_bh(&adapter->mcc_lock);
+ return status;
+}
+
/* Uses Mbox */
int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver)
{
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index a5af296..6e89de8 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -189,6 +189,7 @@ struct be_mcc_mailbox {
#define OPCODE_COMMON_GET_BEACON_STATE 70
#define OPCODE_COMMON_READ_TRANSRECV_DATA 73
#define OPCODE_COMMON_GET_PHY_DETAILS 102
+#define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121
#define OPCODE_ETH_RSS_CONFIG 1
#define OPCODE_ETH_ACPI_CONFIG 2
@@ -668,6 +669,20 @@ struct be_cmd_resp_get_stats {
struct be_hw_stats hw_stats;
};
+struct be_cmd_req_get_cntl_addnl_attribs {
+ struct be_cmd_req_hdr hdr;
+ u8 rsvd[8];
+};
+
+struct be_cmd_resp_get_cntl_addnl_attribs {
+ struct be_cmd_resp_hdr hdr;
+ u16 ipl_file_number;
+ u8 ipl_file_version;
+ u8 rsvd0;
+ u8 on_die_temperature; /* in degrees centigrade*/
+ u8 rsvd1[3];
+};
+
struct be_cmd_req_vlan_config {
struct be_cmd_req_hdr hdr;
u8 interface_id;
@@ -1099,4 +1114,5 @@ extern int be_cmd_get_phy_info(struct be_adapter *adapter,
struct be_dma_mem *cmd);
extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
extern void be_detect_dump_ue(struct be_adapter *adapter);
+extern int be_cmd_get_die_temperature(struct be_adapter *adapter);
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 0833cbd..4766693 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -27,7 +27,7 @@ struct be_ethtool_stat {
};
enum {NETSTAT, PORTSTAT, MISCSTAT, DRVSTAT_TX, DRVSTAT_RX, ERXSTAT,
- PMEMSTAT};
+ PMEMSTAT, DRVSTAT};
#define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \
offsetof(_struct, field)
#define NETSTAT_INFO(field) #field, NETSTAT,\
@@ -46,6 +46,9 @@ enum {NETSTAT, PORTSTAT, MISCSTAT, DRVSTAT_TX, DRVSTAT_RX, ERXSTAT,
FIELDINFO(struct be_erx_stats, field)
#define PMEMSTAT_INFO(field) #field, PMEMSTAT,\
FIELDINFO(struct be_pmem_stats, field)
+#define DRVSTAT_INFO(field) #field, DRVSTAT,\
+ FIELDINFO(struct be_drv_stats, \
+ field)
static const struct be_ethtool_stat et_stats[] = {
{NETSTAT_INFO(rx_packets)},
@@ -105,7 +108,8 @@ static const struct be_ethtool_stat et_stats[] = {
{MISCSTAT_INFO(rx_drops_mtu)},
{MISCSTAT_INFO(port0_jabber_events)},
{MISCSTAT_INFO(port1_jabber_events)},
- {PMEMSTAT_INFO(eth_red_drops)}
+ {PMEMSTAT_INFO(eth_red_drops)},
+ {DRVSTAT_INFO(be_on_die_temperature)}
};
#define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats)
@@ -285,6 +289,9 @@ be_get_ethtool_stats(struct net_device *netdev,
case PMEMSTAT:
p = &hw_stats->pmem;
break;
+ case DRVSTAT:
+ p = &adapter->drv_stats;
+ break;
}
p = (u8 *)p + et_stats[i].offset;
--
1.7.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