* [PATCH 13/13] net: atm: use seq_list_foo() helpers
From: Li Zefan @ 2010-02-09 9:21 UTC (permalink / raw)
To: David Miller; +Cc: Andrew Morton, LKML, netdev@vger.kernel.org
In-Reply-To: <4B712849.9040400@cn.fujitsu.com>
Simplify seq_file code.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
net/atm/proc.c | 2 +-
net/atm/resources.c | 18 ++----------------
2 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/net/atm/proc.c b/net/atm/proc.c
index ab8419a..c0c3a79 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -236,7 +236,7 @@ static int atm_dev_seq_show(struct seq_file *seq, void *v)
"Itf Type ESI/\"MAC\"addr "
"AAL(TX,err,RX,err,drop) ... [refcnt]\n";
- if (v == SEQ_START_TOKEN)
+ if (v == &atm_devs)
seq_puts(seq, atm_dev_banner);
else {
struct atm_dev *dev = list_entry(v, struct atm_dev, dev_list);
diff --git a/net/atm/resources.c b/net/atm/resources.c
index f4091d6..bbd01b0 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -454,21 +454,10 @@ done:
return error;
}
-static inline void *dev_get_idx(loff_t left)
-{
- struct list_head *p;
-
- list_for_each(p, &atm_devs) {
- if (!--left)
- break;
- }
- return (p != &atm_devs) ? p : NULL;
-}
-
void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos)
{
mutex_lock(&atm_dev_mutex);
- return *pos ? dev_get_idx(*pos) : SEQ_START_TOKEN;
+ return seq_list_start_head(&atm_devs, *pos);
}
void atm_dev_seq_stop(struct seq_file *seq, void *v)
@@ -478,8 +467,5 @@ void atm_dev_seq_stop(struct seq_file *seq, void *v)
void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
- ++*pos;
- v = (v == SEQ_START_TOKEN)
- ? atm_devs.next : ((struct list_head *)v)->next;
- return (v == &atm_devs) ? NULL : v;
+ return seq_list_next(v, &atm_devs, pos);
}
--
1.6.3
^ permalink raw reply related
* e1000e-1.1.2 Compile errors with 2.4.37 and gcc 2.95.3
From: Marco Schwarz @ 2010-02-09 9:58 UTC (permalink / raw)
To: e1000-devel, netdev
Hi,
I get the following output when trying to compile e1000e-1.1.2 with Linux Kernel 2.4.37 and gcc 2.95.3 (e1000-8.0.16 compiles fine):
gcc -DDRIVER_E1000E -DDRIVER_NAME=e1000e -DDRIVER_NAME_CAPS=E1000E -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall -I/lib/modules/2.4.37/build/include -I. -DMODVERSIONS -DEXPORT_SYMTAB -include /lib/modules/2.4.37/build/include/linux/modversions.h -Wno-sign-compare -fno-strict-aliasing -c -o netdev.o netdev.c
In file included from netdev.c:51:
e1000.h:144: warning: unnamed struct/union that defines no instances
e1000.h:148: warning: unnamed struct/union that defines no instances
netdev.c: In function `e1000_alloc_rx_buffers_ps':
netdev.c:522: structure has no member named `ps_pages'
netdev.c:511: warning: `ps_page' might be used uninitialized in this function
netdev.c: In function `e1000_put_txbuf':
netdev.c:859: structure has no member named `length'
netdev.c: In function `e1000_print_hw_hang':
netdev.c:875: structure has no member named `next_to_watch'
netdev.c:906: structure has no member named `time_stamp'
netdev.c:919: warning: pointer type mismatch in conditional expression
netdev.c:919: parse error before `;'
netdev.c: In function `e1000_clean_tx_irq':
netdev.c:940: structure has no member named `next_to_watch'
netdev.c:979: structure has no member named `next_to_watch'
netdev.c:1010: structure has no member named `time_stamp'
netdev.c:935: warning: `eop' might be used uninitialized in this function
netdev.c: In function `e1000_clean_rx_irq_ps':
netdev.c:1124: structure has no member named `ps_pages'
netdev.c:1154: structure has no member named `ps_pages'
netdev.c:1044: warning: `ps_page' might be used uninitialized in this function
netdev.c: In function `e1000_clean_jumbo_rx_irq':
netdev.c:1362: warning: pointer type mismatch in conditional expression
netdev.c:1362: parse error before `;'
netdev.c: In function `e1000_clean_rx_ring':
netdev.c:1441: structure has no member named `ps_pages'
netdev.c:1405: warning: `ps_page' might be used uninitialized in this function
netdev.c: In function `e1000e_set_interrupt_capability':
netdev.c:1876: warning: pointer type mismatch in conditional expression
netdev.c:1876: parse error before `;'
netdev.c:1887: warning: pointer type mismatch in conditional expression
netdev.c:1887: parse error before `;'
netdev.c: In function `e1000e_setup_tx_resources':
netdev.c:2182: warning: pointer type mismatch in conditional expression
netdev.c:2182: parse error before `;'
netdev.c: In function `e1000e_setup_rx_resources':
netdev.c:2206: structure has no member named `ps_pages'
netdev.c:2209: structure has no member named `ps_pages'
netdev.c:2232: structure has no member named `ps_pages'
netdev.c:2236: warning: pointer type mismatch in conditional expression
netdev.c:2236: parse error before `;'
netdev.c: In function `e1000e_free_rx_resources':
netdev.c:2305: structure has no member named `ps_pages'
netdev.c: In function `e1000_alloc_queues':
netdev.c:2466: warning: pointer type mismatch in conditional expression
netdev.c:2466: parse error before `;'
netdev.c: In function `e1000e_reset':
netdev.c:3296: warning: pointer type mismatch in conditional expression
netdev.c:3296: parse error before `;'
netdev.c: In function `e1000_test_msi_interrupt':
netdev.c:3545: warning: pointer type mismatch in conditional expression
netdev.c:3545: parse error before `;'
netdev.c: In function `e1000_test_msi':
netdev.c:3599: warning: pointer type mismatch in conditional expression
netdev.c:3599: parse error before `;'
netdev.c: In function `e1000_open':
netdev.c:3680: warning: pointer type mismatch in conditional expression
netdev.c:3680: parse error before `;'
netdev.c: In function `e1000_phy_read_status':
netdev.c:3982: warning: pointer type mismatch in conditional expression
netdev.c:3982: parse error before `;'
netdev.c: In function `e1000_has_link':
netdev.c:4058: warning: pointer type mismatch in conditional expression
netdev.c:4058: parse error before `;'
netdev.c: In function `e1000_watchdog_task':
netdev.c:4143: warning: pointer type mismatch in conditional expression
netdev.c:4143: parse error before `;'
netdev.c: In function `e1000_tx_csum':
netdev.c:4428: structure has no member named `time_stamp'
netdev.c:4429: structure has no member named `next_to_watch'
netdev.c: In function `e1000_tx_map':
netdev.c:4460: structure has no member named `length'
netdev.c:4462: structure has no member named `time_stamp'
netdev.c:4471: structure has no member named `next_to_watch'
netdev.c:4492: structure has no member named `length'
netdev.c:4493: structure has no member named `time_stamp'
netdev.c:4503: structure has no member named `next_to_watch'
netdev.c:4521: structure has no member named `next_to_watch'
netdev.c: In function `e1000_tx_queue':
netdev.c:4578: structure has no member named `length'
netdev.c: In function `e1000_change_mtu':
netdev.c:4870: warning: pointer type mismatch in conditional expression
netdev.c:4870: parse error before `;'
netdev.c:4877: warning: pointer type mismatch in conditional expression
netdev.c:4877: parse error before `;'
netdev.c: In function `e1000_init_phy_wakeup':
netdev.c:5064: warning: pointer type mismatch in conditional expression
netdev.c:5064: parse error before `;'
netdev.c:5071: warning: pointer type mismatch in conditional expression
netdev.c:5071: parse error before `;'
netdev.c:5077: warning: pointer type mismatch in conditional expression
netdev.c:5077: parse error before `;'
netdev.c: In function `e1000_probe':
netdev.c:5754: warning: pointer type mismatch in conditional expression
netdev.c:5754: parse error before `;'
netdev.c:5796: warning: pointer type mismatch in conditional expression
netdev.c:5796: parse error before `;'
netdev.c:5806: warning: pointer type mismatch in conditional expression
netdev.c:5806: parse error before `;'
make: *** [netdev.o] Error 1
Best regards,
Marco
--
Marco Schwarz
Softwareentwicklung
Mönchsgasse 10a
67346 Speyer
Tel 06232 602926
Fax 012120 247701
Mobil 0151 22633892
^ permalink raw reply
* [PATCH 10/13] net: x25: use seq_list_foo() helpers
From: Li Zefan @ 2010-02-09 9:20 UTC (permalink / raw)
To: David Miller; +Cc: Andrew Morton, LKML, netdev@vger.kernel.org
In-Reply-To: <4B712849.9040400@cn.fujitsu.com>
Simplify seq_file code.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
net/x25/x25_proc.c | 84 +++++-----------------------------------------------
1 files changed, 8 insertions(+), 76 deletions(-)
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c
index c4cd322..7ff3737 100644
--- a/net/x25/x25_proc.c
+++ b/net/x25/x25_proc.c
@@ -25,49 +25,17 @@
#include <net/x25.h>
#ifdef CONFIG_PROC_FS
-static __inline__ struct x25_route *x25_get_route_idx(loff_t pos)
-{
- struct list_head *route_entry;
- struct x25_route *rt = NULL;
-
- list_for_each(route_entry, &x25_route_list) {
- rt = list_entry(route_entry, struct x25_route, node);
- if (!pos--)
- goto found;
- }
- rt = NULL;
-found:
- return rt;
-}
static void *x25_seq_route_start(struct seq_file *seq, loff_t *pos)
__acquires(x25_route_list_lock)
{
- loff_t l = *pos;
-
read_lock_bh(&x25_route_list_lock);
- return l ? x25_get_route_idx(--l) : SEQ_START_TOKEN;
+ return seq_list_start_head(&x25_route_list, *pos);
}
static void *x25_seq_route_next(struct seq_file *seq, void *v, loff_t *pos)
{
- struct x25_route *rt;
-
- ++*pos;
- if (v == SEQ_START_TOKEN) {
- rt = NULL;
- if (!list_empty(&x25_route_list))
- rt = list_entry(x25_route_list.next,
- struct x25_route, node);
- goto out;
- }
- rt = v;
- if (rt->node.next != &x25_route_list)
- rt = list_entry(rt->node.next, struct x25_route, node);
- else
- rt = NULL;
-out:
- return rt;
+ return seq_list_next(v, &x25_route_list, pos);
}
static void x25_seq_route_stop(struct seq_file *seq, void *v)
@@ -78,9 +46,9 @@ static void x25_seq_route_stop(struct seq_file *seq, void *v)
static int x25_seq_route_show(struct seq_file *seq, void *v)
{
- struct x25_route *rt;
+ struct x25_route *rt = list_entry(v, struct x25_route, node);
- if (v == SEQ_START_TOKEN) {
+ if (v == &x25_route_list) {
seq_puts(seq, "Address Digits Device\n");
goto out;
}
@@ -146,51 +114,16 @@ out:
return 0;
}
-static __inline__ struct x25_forward *x25_get_forward_idx(loff_t pos)
-{
- struct x25_forward *f;
- struct list_head *entry;
-
- list_for_each(entry, &x25_forward_list) {
- f = list_entry(entry, struct x25_forward, node);
- if (!pos--)
- goto found;
- }
-
- f = NULL;
-found:
- return f;
-}
-
static void *x25_seq_forward_start(struct seq_file *seq, loff_t *pos)
__acquires(x25_forward_list_lock)
{
- loff_t l = *pos;
-
read_lock_bh(&x25_forward_list_lock);
- return l ? x25_get_forward_idx(--l) : SEQ_START_TOKEN;
+ return seq_list_start_head(&x25_forward_list, *pos);
}
static void *x25_seq_forward_next(struct seq_file *seq, void *v, loff_t *pos)
{
- struct x25_forward *f;
-
- ++*pos;
- if (v == SEQ_START_TOKEN) {
- f = NULL;
- if (!list_empty(&x25_forward_list))
- f = list_entry(x25_forward_list.next,
- struct x25_forward, node);
- goto out;
- }
- f = v;
- if (f->node.next != &x25_forward_list)
- f = list_entry(f->node.next, struct x25_forward, node);
- else
- f = NULL;
-out:
- return f;
-
+ return seq_list_next(v, &x25_forward_list, pos);
}
static void x25_seq_forward_stop(struct seq_file *seq, void *v)
@@ -201,9 +134,9 @@ static void x25_seq_forward_stop(struct seq_file *seq, void *v)
static int x25_seq_forward_show(struct seq_file *seq, void *v)
{
- struct x25_forward *f;
+ struct x25_forward *f = list_entry(v, struct x25_forward, node);
- if (v == SEQ_START_TOKEN) {
+ if (v == &x25_forward_list) {
seq_printf(seq, "lci dev1 dev2\n");
goto out;
}
@@ -212,7 +145,6 @@ static int x25_seq_forward_show(struct seq_file *seq, void *v)
seq_printf(seq, "%d %-10s %-10s\n",
f->lci, f->dev1->name, f->dev2->name);
-
out:
return 0;
}
--
1.6.3
^ permalink raw reply related
* Re: e1000e-1.1.2 Compile errors with 2.4.37 and gcc 2.95.3
From: Ben Hutchings @ 2010-02-09 11:21 UTC (permalink / raw)
To: Marco Schwarz; +Cc: e1000-devel, netdev
In-Reply-To: <20100209095803.236980@gmx.net>
On Tue, 2010-02-09 at 10:58 +0100, Marco Schwarz wrote:
> Hi,
>
> I get the following output when trying to compile e1000e-1.1.2 with Linux Kernel 2.4.37 and gcc 2.95.3 (e1000-8.0.16 compiles fine):
[...]
netdev only deals with recent 2.6 kernels. I'm amazed that Intel still
wastes time on 2.4.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [PATCH 1/7] be2net: remove unused pci device id
From: Ajit Khaparde @ 2010-02-09 11:28 UTC (permalink / raw)
To: davem, netdev
We are not going to use this device id.
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
drivers/net/benet/be.h | 6 ++----
drivers/net/benet/be_main.c | 1 -
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 5bc7459..2420131 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -44,16 +44,14 @@
#define BE_DEVICE_ID1 0x211
#define BE_DEVICE_ID2 0x221
#define OC_DEVICE_ID1 0x700
-#define OC_DEVICE_ID2 0x701
-#define OC_DEVICE_ID3 0x710
+#define OC_DEVICE_ID2 0x710
static inline char *nic_name(struct pci_dev *pdev)
{
switch (pdev->device) {
case OC_DEVICE_ID1:
- case OC_DEVICE_ID2:
return OC_NAME;
- case OC_DEVICE_ID3:
+ case OC_DEVICE_ID2:
return OC_NAME1;
case BE_DEVICE_ID2:
return BE3_NAME;
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 626b76c..f9e18eb 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -34,7 +34,6 @@ static DEFINE_PCI_DEVICE_TABLE(be_dev_ids) = {
{ PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID2) },
{ PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID1) },
{ PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID2) },
- { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID3) },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, be_dev_ids);
--
1.6.3.3
^ permalink raw reply related
* [PATCH 2/7] be2net: bug fix for flashing the BladeEngine3 ASIC
From: Ajit Khaparde @ 2010-02-09 11:30 UTC (permalink / raw)
To: davem, netdev
Now flashing both BE2 and BE3 devices is supported.
From: Naresh G <nareshg@serverengines.com>
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
drivers/net/benet/be_cmds.c | 9 +-
drivers/net/benet/be_cmds.h | 3 +-
drivers/net/benet/be_hw.h | 119 +++++++++++++++-------
drivers/net/benet/be_main.c | 239 +++++++++++++++++++++++--------------------
4 files changed, 217 insertions(+), 153 deletions(-)
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index fee6eee..5fd9567 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1374,7 +1374,7 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
u32 flash_type, u32 flash_opcode, u32 buf_size)
{
struct be_mcc_wrb *wrb;
- struct be_cmd_write_flashrom *req = cmd->va;
+ struct be_cmd_write_flashrom *req;
struct be_sge *sge;
int status;
@@ -1408,7 +1408,8 @@ err:
return status;
}
-int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc)
+int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
+ int offset)
{
struct be_mcc_wrb *wrb;
struct be_cmd_write_flashrom *req;
@@ -1429,9 +1430,9 @@ int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc)
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_READ_FLASHROM, sizeof(*req)+4);
- req->params.op_type = cpu_to_le32(FLASHROM_TYPE_REDBOOT);
+ req->params.op_type = cpu_to_le32(IMG_TYPE_REDBOOT);
req->params.op_code = cpu_to_le32(FLASHROM_OPER_REPORT);
- req->params.offset = 0x3FFFC;
+ req->params.offset = offset;
req->params.data_buf_size = 0x4;
status = be_mcc_notify_wait(adapter);
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index 13b33c8..c97d773 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -917,7 +917,8 @@ extern int be_cmd_read_port_type(struct be_adapter *adapter, u32 port,
extern int be_cmd_write_flashrom(struct be_adapter *adapter,
struct be_dma_mem *cmd, u32 flash_oper,
u32 flash_opcode, u32 buf_size);
-extern int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc);
+int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
+ int offset);
extern int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
struct be_dma_mem *nonemb_cmd);
extern int be_cmd_fw_init(struct be_adapter *adapter);
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h
index e2b3bef..bb2ae6f 100644
--- a/drivers/net/benet/be_hw.h
+++ b/drivers/net/benet/be_hw.h
@@ -99,6 +99,63 @@
/* Number of entries posted */
#define DB_MCCQ_NUM_POSTED_SHIFT (16) /* bits 16 - 29 */
+/* Flashrom related descriptors */
+#define IMAGE_TYPE_FIRMWARE 160
+#define IMAGE_TYPE_BOOTCODE 224
+#define IMAGE_TYPE_OPTIONROM 32
+
+#define NUM_FLASHDIR_ENTRIES 32
+
+#define IMG_TYPE_ISCSI_ACTIVE 0
+#define IMG_TYPE_REDBOOT 1
+#define IMG_TYPE_BIOS 2
+#define IMG_TYPE_PXE_BIOS 3
+#define IMG_TYPE_FCOE_BIOS 8
+#define IMG_TYPE_ISCSI_BACKUP 9
+#define IMG_TYPE_FCOE_FW_ACTIVE 10
+#define IMG_TYPE_FCOE_FW_BACKUP 11
+#define IMG_TYPE_NCSI_BITFILE 13
+#define IMG_TYPE_NCSI_8051 14
+
+#define FLASHROM_OPER_FLASH 1
+#define FLASHROM_OPER_SAVE 2
+#define FLASHROM_OPER_REPORT 4
+
+#define FLASH_IMAGE_MAX_SIZE_g2 (1310720) /* Max firmware image sz */
+#define FLASH_BIOS_IMAGE_MAX_SIZE_g2 (262144) /* Max OPTION ROM img sz */
+#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 (262144) /* Max Redboot image sz */
+#define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max fw image size */
+#define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM img sz */
+#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */
+
+#define FLASH_NCSI_MAGIC (0x16032009)
+#define FLASH_NCSI_DISABLED (0)
+#define FLASH_NCSI_ENABLED (1)
+
+#define FLASH_NCSI_BITFILE_HDR_OFFSET (0x600000)
+
+/* Offsets for components on Flash. */
+#define FLASH_iSCSI_PRIMARY_IMAGE_START_g2 (1048576)
+#define FLASH_iSCSI_BACKUP_IMAGE_START_g2 (2359296)
+#define FLASH_FCoE_PRIMARY_IMAGE_START_g2 (3670016)
+#define FLASH_FCoE_BACKUP_IMAGE_START_g2 (4980736)
+#define FLASH_iSCSI_BIOS_START_g2 (7340032)
+#define FLASH_PXE_BIOS_START_g2 (7864320)
+#define FLASH_FCoE_BIOS_START_g2 (524288)
+#define FLASH_REDBOOT_START_g2 (0)
+
+#define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 (2097152)
+#define FLASH_iSCSI_BACKUP_IMAGE_START_g3 (4194304)
+#define FLASH_FCoE_PRIMARY_IMAGE_START_g3 (6291456)
+#define FLASH_FCoE_BACKUP_IMAGE_START_g3 (8388608)
+#define FLASH_iSCSI_BIOS_START_g3 (12582912)
+#define FLASH_PXE_BIOS_START_g3 (13107200)
+#define FLASH_FCoE_BIOS_START_g3 (13631488)
+#define FLASH_REDBOOT_START_g3 (262144)
+
+
+
+
/*
* BE descriptors: host memory data structures whose formats
* are hardwired in BE silicon.
@@ -107,6 +164,7 @@
#define EQ_ENTRY_VALID_MASK 0x1 /* bit 0 */
#define EQ_ENTRY_RES_ID_MASK 0xFFFF /* bits 16 - 31 */
#define EQ_ENTRY_RES_ID_SHIFT 16
+
struct be_eq_entry {
u32 evt;
};
@@ -221,41 +279,6 @@ struct be_eth_rx_compl {
u32 dw[4];
};
-/* Flashrom related descriptors */
-#define IMAGE_TYPE_FIRMWARE 160
-#define IMAGE_TYPE_BOOTCODE 224
-#define IMAGE_TYPE_OPTIONROM 32
-
-#define NUM_FLASHDIR_ENTRIES 32
-
-#define FLASHROM_TYPE_ISCSI_ACTIVE 0
-#define FLASHROM_TYPE_REDBOOT 1
-#define FLASHROM_TYPE_BIOS 2
-#define FLASHROM_TYPE_PXE_BIOS 3
-#define FLASHROM_TYPE_FCOE_BIOS 8
-#define FLASHROM_TYPE_ISCSI_BACKUP 9
-#define FLASHROM_TYPE_FCOE_FW_ACTIVE 10
-#define FLASHROM_TYPE_FCOE_FW_BACKUP 11
-
-#define FLASHROM_OPER_FLASH 1
-#define FLASHROM_OPER_SAVE 2
-#define FLASHROM_OPER_REPORT 4
-
-#define FLASH_IMAGE_MAX_SIZE (1310720) /* Max firmware image size */
-#define FLASH_BIOS_IMAGE_MAX_SIZE (262144) /* Max OPTION ROM image sz */
-#define FLASH_REDBOOT_IMAGE_MAX_SIZE (262144) /* Max redboot image sz */
-
-/* Offsets for components on Flash. */
-#define FLASH_iSCSI_PRIMARY_IMAGE_START (1048576)
-#define FLASH_iSCSI_BACKUP_IMAGE_START (2359296)
-#define FLASH_FCoE_PRIMARY_IMAGE_START (3670016)
-#define FLASH_FCoE_BACKUP_IMAGE_START (4980736)
-#define FLASH_iSCSI_BIOS_START (7340032)
-#define FLASH_PXE_BIOS_START (7864320)
-#define FLASH_FCoE_BIOS_START (524288)
-#define FLASH_REDBOOT_START (32768)
-#define FLASH_REDBOOT_ISM_START (0)
-
struct controller_id {
u32 vendor;
u32 device;
@@ -263,7 +286,20 @@ struct controller_id {
u32 subdevice;
};
-struct flash_file_hdr {
+struct flash_comp {
+ unsigned long offset;
+ int optype;
+ int size;
+};
+
+struct image_hdr {
+ u32 imageid;
+ u32 imageoffset;
+ u32 imagelength;
+ u32 image_checksum;
+ u8 image_version[32];
+};
+struct flash_file_hdr_g2 {
u8 sign[32];
u32 cksum;
u32 antidote;
@@ -275,6 +311,17 @@ struct flash_file_hdr {
u8 build[24];
};
+struct flash_file_hdr_g3 {
+ u8 sign[52];
+ u8 ufi_version[4];
+ u32 file_len;
+ u32 cksum;
+ u32 antidote;
+ u32 num_imgs;
+ u8 build[24];
+ u8 rsvd[32];
+};
+
struct flash_section_hdr {
u32 format_rev;
u32 cksum;
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index f9e18eb..1d773db 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1797,15 +1797,19 @@ char flash_cookie[2][16] = {"*** SE FLAS",
"H DIRECTORY *** "};
static bool be_flash_redboot(struct be_adapter *adapter,
- const u8 *p)
+ const u8 *p, u32 img_start, int image_size,
+ int hdr_size)
{
u32 crc_offset;
u8 flashed_crc[4];
int status;
- crc_offset = FLASH_REDBOOT_START + FLASH_REDBOOT_IMAGE_MAX_SIZE - 4
- + sizeof(struct flash_file_hdr) - 32*1024;
+
+ crc_offset = hdr_size + img_start + image_size - 4;
+
p += crc_offset;
- status = be_cmd_get_flash_crc(adapter, flashed_crc);
+
+ status = be_cmd_get_flash_crc(adapter, flashed_crc,
+ (img_start + image_size - 4));
if (status) {
dev_err(&adapter->pdev->dev,
"could not get crc from flash, not flashing redboot\n");
@@ -1817,102 +1821,124 @@ static bool be_flash_redboot(struct be_adapter *adapter,
return false;
else
return true;
-
}
-static int be_flash_image(struct be_adapter *adapter,
+static int be_flash_data(struct be_adapter *adapter,
const struct firmware *fw,
- struct be_dma_mem *flash_cmd, u32 flash_type)
+ struct be_dma_mem *flash_cmd, int num_of_images)
+
{
- int status;
- u32 flash_op, image_offset = 0, total_bytes, image_size = 0;
+ int status = 0, i, filehdr_size = 0;
+ u32 total_bytes = 0, flash_op;
int num_bytes;
const u8 *p = fw->data;
struct be_cmd_write_flashrom *req = flash_cmd->va;
-
- switch (flash_type) {
- case FLASHROM_TYPE_ISCSI_ACTIVE:
- image_offset = FLASH_iSCSI_PRIMARY_IMAGE_START;
- image_size = FLASH_IMAGE_MAX_SIZE;
- break;
- case FLASHROM_TYPE_ISCSI_BACKUP:
- image_offset = FLASH_iSCSI_BACKUP_IMAGE_START;
- image_size = FLASH_IMAGE_MAX_SIZE;
- break;
- case FLASHROM_TYPE_FCOE_FW_ACTIVE:
- image_offset = FLASH_FCoE_PRIMARY_IMAGE_START;
- image_size = FLASH_IMAGE_MAX_SIZE;
- break;
- case FLASHROM_TYPE_FCOE_FW_BACKUP:
- image_offset = FLASH_FCoE_BACKUP_IMAGE_START;
- image_size = FLASH_IMAGE_MAX_SIZE;
- break;
- case FLASHROM_TYPE_BIOS:
- image_offset = FLASH_iSCSI_BIOS_START;
- image_size = FLASH_BIOS_IMAGE_MAX_SIZE;
- break;
- case FLASHROM_TYPE_FCOE_BIOS:
- image_offset = FLASH_FCoE_BIOS_START;
- image_size = FLASH_BIOS_IMAGE_MAX_SIZE;
- break;
- case FLASHROM_TYPE_PXE_BIOS:
- image_offset = FLASH_PXE_BIOS_START;
- image_size = FLASH_BIOS_IMAGE_MAX_SIZE;
- break;
- case FLASHROM_TYPE_REDBOOT:
- if (!be_flash_redboot(adapter, fw->data))
- return 0;
- image_offset = FLASH_REDBOOT_ISM_START;
- image_size = FLASH_REDBOOT_IMAGE_MAX_SIZE;
- break;
- default:
- return 0;
+ struct flash_comp *pflashcomp;
+
+ struct flash_comp gen3_flash_types[8] = {
+ { FLASH_iSCSI_PRIMARY_IMAGE_START_g3, IMG_TYPE_ISCSI_ACTIVE,
+ FLASH_IMAGE_MAX_SIZE_g3},
+ { FLASH_REDBOOT_START_g3, IMG_TYPE_REDBOOT,
+ FLASH_REDBOOT_IMAGE_MAX_SIZE_g3},
+ { FLASH_iSCSI_BIOS_START_g3, IMG_TYPE_BIOS,
+ FLASH_BIOS_IMAGE_MAX_SIZE_g3},
+ { FLASH_PXE_BIOS_START_g3, IMG_TYPE_PXE_BIOS,
+ FLASH_BIOS_IMAGE_MAX_SIZE_g3},
+ { FLASH_FCoE_BIOS_START_g3, IMG_TYPE_FCOE_BIOS,
+ FLASH_BIOS_IMAGE_MAX_SIZE_g3},
+ { FLASH_iSCSI_BACKUP_IMAGE_START_g3, IMG_TYPE_ISCSI_BACKUP,
+ FLASH_IMAGE_MAX_SIZE_g3},
+ { FLASH_FCoE_PRIMARY_IMAGE_START_g3, IMG_TYPE_FCOE_FW_ACTIVE,
+ FLASH_IMAGE_MAX_SIZE_g3},
+ { FLASH_FCoE_BACKUP_IMAGE_START_g3, IMG_TYPE_FCOE_FW_BACKUP,
+ FLASH_IMAGE_MAX_SIZE_g3}
+ };
+ struct flash_comp gen2_flash_types[8] = {
+ { FLASH_iSCSI_PRIMARY_IMAGE_START_g2, IMG_TYPE_ISCSI_ACTIVE,
+ FLASH_IMAGE_MAX_SIZE_g2},
+ { FLASH_REDBOOT_START_g2, IMG_TYPE_REDBOOT,
+ FLASH_REDBOOT_IMAGE_MAX_SIZE_g2},
+ { FLASH_iSCSI_BIOS_START_g2, IMG_TYPE_BIOS,
+ FLASH_BIOS_IMAGE_MAX_SIZE_g2},
+ { FLASH_PXE_BIOS_START_g2, IMG_TYPE_PXE_BIOS,
+ FLASH_BIOS_IMAGE_MAX_SIZE_g2},
+ { FLASH_FCoE_BIOS_START_g2, IMG_TYPE_FCOE_BIOS,
+ FLASH_BIOS_IMAGE_MAX_SIZE_g2},
+ { FLASH_iSCSI_BACKUP_IMAGE_START_g2, IMG_TYPE_ISCSI_BACKUP,
+ FLASH_IMAGE_MAX_SIZE_g2},
+ { FLASH_FCoE_PRIMARY_IMAGE_START_g2, IMG_TYPE_FCOE_FW_ACTIVE,
+ FLASH_IMAGE_MAX_SIZE_g2},
+ { FLASH_FCoE_BACKUP_IMAGE_START_g2, IMG_TYPE_FCOE_FW_BACKUP,
+ FLASH_IMAGE_MAX_SIZE_g2}
+ };
+
+ if (adapter->generation == BE_GEN3) {
+ pflashcomp = gen3_flash_types;
+ filehdr_size = sizeof(struct flash_file_hdr_g3);
+ } else {
+ pflashcomp = gen2_flash_types;
+ filehdr_size = sizeof(struct flash_file_hdr_g2);
}
-
- p += sizeof(struct flash_file_hdr) + image_offset;
- if (p + image_size > fw->data + fw->size)
+ for (i = 0; i < 8; i++) {
+ if ((pflashcomp[i].optype == IMG_TYPE_REDBOOT) &&
+ (!be_flash_redboot(adapter, fw->data,
+ pflashcomp[i].offset, pflashcomp[i].size,
+ filehdr_size)))
+ continue;
+ p = fw->data;
+ p += filehdr_size + pflashcomp[i].offset
+ + (num_of_images * sizeof(struct image_hdr));
+ if (p + pflashcomp[i].size > fw->data + fw->size)
return -1;
-
- total_bytes = image_size;
-
- while (total_bytes) {
- if (total_bytes > 32*1024)
- num_bytes = 32*1024;
- else
- num_bytes = total_bytes;
- total_bytes -= num_bytes;
-
- if (!total_bytes)
- flash_op = FLASHROM_OPER_FLASH;
- else
- flash_op = FLASHROM_OPER_SAVE;
- memcpy(req->params.data_buf, p, num_bytes);
- p += num_bytes;
- status = be_cmd_write_flashrom(adapter, flash_cmd,
- flash_type, flash_op, num_bytes);
- if (status) {
- dev_err(&adapter->pdev->dev,
- "cmd to write to flash rom failed. type/op %d/%d\n",
- flash_type, flash_op);
- return -1;
+ total_bytes = pflashcomp[i].size;
+ while (total_bytes) {
+ if (total_bytes > 32*1024)
+ num_bytes = 32*1024;
+ else
+ num_bytes = total_bytes;
+ total_bytes -= num_bytes;
+
+ if (!total_bytes)
+ flash_op = FLASHROM_OPER_FLASH;
+ else
+ flash_op = FLASHROM_OPER_SAVE;
+ memcpy(req->params.data_buf, p, num_bytes);
+ p += num_bytes;
+ status = be_cmd_write_flashrom(adapter, flash_cmd,
+ pflashcomp[i].optype, flash_op, num_bytes);
+ if (status) {
+ dev_err(&adapter->pdev->dev,
+ "cmd to write to flash rom failed.\n");
+ return -1;
+ }
+ yield();
}
- yield();
}
-
return 0;
}
+static int get_ufigen_type(struct flash_file_hdr_g2 *fhdr)
+{
+ if (fhdr == NULL)
+ return 0;
+ if (fhdr->build[0] == '3')
+ return BE_GEN3;
+ else if (fhdr->build[0] == '2')
+ return BE_GEN2;
+ else
+ return 0;
+}
+
int be_load_fw(struct be_adapter *adapter, u8 *func)
{
char fw_file[ETHTOOL_FLASH_MAX_FILENAME];
const struct firmware *fw;
- struct flash_file_hdr *fhdr;
- struct flash_section_info *fsec = NULL;
+ struct flash_file_hdr_g2 *fhdr;
+ struct flash_file_hdr_g3 *fhdr3;
+ struct image_hdr *img_hdr_ptr = NULL;
struct be_dma_mem flash_cmd;
- int status;
+ int status, i = 0;
const u8 *p;
- bool entry_found = false;
- int flash_type;
char fw_ver[FW_VER_LEN];
char fw_cfg;
@@ -1930,34 +1956,9 @@ int be_load_fw(struct be_adapter *adapter, u8 *func)
goto fw_exit;
p = fw->data;
- fhdr = (struct flash_file_hdr *) p;
- if (memcmp(fhdr->sign, FW_FILE_HDR_SIGN, strlen(FW_FILE_HDR_SIGN))) {
- dev_err(&adapter->pdev->dev,
- "Firmware(%s) load error (signature did not match)\n",
- fw_file);
- status = -1;
- goto fw_exit;
- }
-
+ fhdr = (struct flash_file_hdr_g2 *) p;
dev_info(&adapter->pdev->dev, "Flashing firmware file %s\n", fw_file);
- p += sizeof(struct flash_file_hdr);
- while (p < (fw->data + fw->size)) {
- fsec = (struct flash_section_info *)p;
- if (!memcmp(flash_cookie, fsec->cookie, sizeof(flash_cookie))) {
- entry_found = true;
- break;
- }
- p += 32;
- }
-
- if (!entry_found) {
- status = -1;
- dev_err(&adapter->pdev->dev,
- "Flash cookie not found in firmware image\n");
- goto fw_exit;
- }
-
flash_cmd.size = sizeof(struct be_cmd_write_flashrom) + 32*1024;
flash_cmd.va = pci_alloc_consistent(adapter->pdev, flash_cmd.size,
&flash_cmd.dma);
@@ -1968,12 +1969,26 @@ int be_load_fw(struct be_adapter *adapter, u8 *func)
goto fw_exit;
}
- for (flash_type = FLASHROM_TYPE_ISCSI_ACTIVE;
- flash_type <= FLASHROM_TYPE_FCOE_FW_BACKUP; flash_type++) {
- status = be_flash_image(adapter, fw, &flash_cmd,
- flash_type);
- if (status)
- break;
+ if ((adapter->generation == BE_GEN3) &&
+ (get_ufigen_type(fhdr) == BE_GEN3)) {
+ fhdr3 = (struct flash_file_hdr_g3 *) fw->data;
+ for (i = 0; i < fhdr3->num_imgs; i++) {
+ img_hdr_ptr = (struct image_hdr *) (fw->data +
+ (sizeof(struct flash_file_hdr_g3) +
+ i * sizeof(struct image_hdr)));
+ if (img_hdr_ptr->imageid == 1) {
+ status = be_flash_data(adapter, fw,
+ &flash_cmd, fhdr3->num_imgs);
+ }
+
+ }
+ } else if ((adapter->generation == BE_GEN2) &&
+ (get_ufigen_type(fhdr) == BE_GEN2)) {
+ status = be_flash_data(adapter, fw, &flash_cmd, 0);
+ } else {
+ dev_err(&adapter->pdev->dev,
+ "UFI and Interface are not compatible for flashing\n");
+ status = -1;
}
pci_free_consistent(adapter->pdev, flash_cmd.size, flash_cmd.va,
--
1.6.3.3
^ permalink raw reply related
* [PATCH 3/7] be2net: bug fix in be_change_mtu
From: Ajit Khaparde @ 2010-02-09 11:32 UTC (permalink / raw)
To: davem, netdev
Current code allows the new mtu to cross the supported value.
This patch fixes the boundary checks.
From: Suresh R <sureshr@serverengines.com>
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
drivers/net/benet/be_main.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 1d773db..f1136a3 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -473,10 +473,12 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
{
struct be_adapter *adapter = netdev_priv(netdev);
if (new_mtu < BE_MIN_MTU ||
- new_mtu > BE_MAX_JUMBO_FRAME_SIZE) {
+ new_mtu > (BE_MAX_JUMBO_FRAME_SIZE -
+ (ETH_HLEN + ETH_FCS_LEN))) {
dev_info(&adapter->pdev->dev,
"MTU must be between %d and %d bytes\n",
- BE_MIN_MTU, BE_MAX_JUMBO_FRAME_SIZE);
+ BE_MIN_MTU,
+ (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN)));
return -EINVAL;
}
dev_info(&adapter->pdev->dev, "MTU changed from %d to %d bytes\n",
--
1.6.3.3
^ permalink raw reply related
* [PATCH 4/7] be2net: minor code optimizations
From: Ajit Khaparde @ 2010-02-09 11:34 UTC (permalink / raw)
To: davem, netdev
Couple of code optimizations in the Rx path (to avoid a memset).
From: Sathya P <sathyap@serverengines.com>
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
drivers/net/benet/be_main.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index f1136a3..107de6d 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -635,9 +635,11 @@ get_rx_page_info(struct be_adapter *adapter, u16 frag_idx)
rx_page_info = &adapter->rx_obj.page_info_tbl[frag_idx];
BUG_ON(!rx_page_info->page);
- if (rx_page_info->last_page_user)
+ if (rx_page_info->last_page_user) {
pci_unmap_page(adapter->pdev, pci_unmap_addr(rx_page_info, bus),
adapter->big_page_size, PCI_DMA_FROMDEVICE);
+ rx_page_info->last_page_user = false;
+ }
atomic_dec(&rxq->used);
return rx_page_info;
@@ -705,7 +707,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
skb->data_len = curr_frag_len - hdr_len;
skb->tail += hdr_len;
}
- memset(page_info, 0, sizeof(*page_info));
+ page_info->page = NULL;
if (pktsize <= rx_frag_size) {
BUG_ON(num_rcvd != 1);
@@ -738,7 +740,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
skb->len += curr_frag_len;
skb->data_len += curr_frag_len;
- memset(page_info, 0, sizeof(*page_info));
+ page_info->page = NULL;
}
BUG_ON(j > MAX_SKB_FRAGS);
--
1.6.3.3
^ permalink raw reply related
* Re: netconsole dumbs the system
From: Ferenc Wagner @ 2010-02-09 11:34 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
In-Reply-To: <87iqa74f2s.fsf@tac.ki.iif.hu>
Ferenc Wagner <wferi@niif.hu> writes:
> # modprobe netconsole netconsole=@10.0.0.6/eth0,@10.0.0.7/
>
> that kills off the consoles: past kernel messages start pouring over all
> consoles, the new network console included, then it suddenly dies off in
> the middle, with one more line on the VC than sent to the network. At
> this point, the machine still responds to ping, the keyboard leds work,
> but otherwise it's impossible to interact with it. No SysRq, even.
> Being in the initramfs, there are no network services to test. If I
> load netconsole in the running system, there isn't much backlog to pour
> out, and the problem doesn't appear. What could be wrong here?
I really shouldn't harass public mailing lists while running to the
train. So. This happens on 2.6.32.7, and has nothing to do with
bonding or vlans. Stopping early in the initramfs (before any network
setup) and starting netconsole brings down the console for good. This
time I ran with an IPMI SoL console:
[...]
[ 34.315957] sd 1:0:0:0: [sdc] Assuming drive cache: write through
[ 34.354246] sd 1:0:0:0: [sdc] Attached SCSI disk
(initramfs) modprobe netconsole netconsole=@10.0.0.6/eth0,@10.0.0.4/
[ 786.966032] netconsole: local port 6665
[ 786.988917] netconsole: local IP 10.0.0.6
[ 787.012829] netconsole: interface eth0
[ 787.035185] netconsole: remote port 6666
[ 787.058583] netconsole: remote IP 10.0.0.4
[ 787.083022] netconsole: remote ethernet address ff:ff:ff:ff:ff:ff
[ 787.119428] netconsole: device eth0 not up yet, forcing it
[ 787.202838] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 788.200104] tg3: eth0: Link is up at 1000 Mbps, full duplex.
[ 788.233896] tg3: eth0: Flow control is off for TX and off for RX.
[ 788.270419] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 2.6.32.7 (wferi@rs22) (gcc version 4.3.2 (Debian 4.3.2-1.1) ) #1 SMP Sun Feb 7 14:35:57 CET 2010
[...]
[ 16.320885] sd 1:0:0:0: [sdc] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 16.363561] sd 1:0:0:0: [sdc] Sense Key : Not Ready [current]
[ 16.398490] sd 1:0:0:0: [sdc] Add. Sense: Logical unit not ready, manual intervention required
Killed
(initramfs) cat /proc/modules
netconsole 8307 1 - Loading 0xf83d6000
configfs 15052 2 netconsole, Live 0xf83c5000
sd_mod 25601 0 - Live 0xf83ad000
crc_t10dif 1012 1 sd_mod, Live 0xf839a000
usbhid 26560 0 - Live 0xf8320000
hid 50453 1 usbhid, Live 0xf82e8000
ata_generic 2015 0 - Live 0xf7fe9000
ata_piix 17009 0 - Live 0xf7fdd000
libata 113304 2 ata_generic,ata_piix, Live 0xf7fa4000
uhci_hcd 15893 0 - Live 0xf7f51000
mptspi 9545 0 - Live 0xf7f3f000
mptscsih 13672 1 mptspi, Live 0xf7f2c000
ide_pci_generic 1924 0 - Live 0xf7f1d000
mptbase 42788 2 mptspi,mptscsih, Live 0xf7f06000
ehci_hcd 26986 0 - Live 0xf7ee5000
qla2xxx 180864 0 - Live 0xf7e9b000
piix 3556 0 - Live 0xf7e57000
scsi_transport_spi 14722 1 mptspi, Live 0xf7e37000
tg3 87833 0 - Live 0xf7e10000
scsi_transport_fc 28295 1 qla2xxx, Live 0xf7dd8000
scsi_tgt 6834 1 scsi_transport_fc, Live 0xf7dba000
scsi_mod 100649 8 sd_mod,libata,mptspi,mptscsih,qla2xxx,scsi_transport_spi,scsi_transport_fc,scsi_tgt, Live 0xf7d2a000
ide_core 63358 2 ide_pci_generic,piix, Live 0xf7cdd000
libphy 11178 1 tg3, Live 0xf7cb3000
usbcore 97786 4 usbhid,uhci_hcd,ehci_hcd, Live 0xf7c81000
nls_base 4541 1 usbcore, Live 0xf7c4d000
button 3598 0 - Live 0xf7c42000
thermal 9198 0 - Live 0xf7c34000
fan 2590 0 - Live 0xf7c26000
thermal_sys 9378 2 thermal,fan, Live 0xf7c19000
(initramfs) modpro
That is, after the "Killed" message (which I don't quite get, is that
related to the modprobe command?) I was still able to issue a command,
and to start typing another one. Then came silence... And not all
kernel messages were sent through the network, only the first part of
it, as the timestamps show.
--
Thanks,
Feri.
^ permalink raw reply
* [PATCH 5/7] be2net: fix to limit max vlans supported in certain skews
From: Ajit Khaparde @ 2010-02-09 11:34 UTC (permalink / raw)
To: davem, netdev
In certain skews the ASIC can support only 16 vlans per interface.
Once the limit is crossed, the ASIC is programmed in vlan promiscuous mode.
Switch off the vlan promiscuous mode once the number of vlans
falls back to the max vlans supported.
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
drivers/net/benet/be.h | 3 ++-
drivers/net/benet/be_main.c | 30 +++++++++++++++++-------------
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 2420131..476a5c4 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -250,7 +250,8 @@ struct be_adapter {
bool rx_post_starved; /* Zero rx frags have been posted to BE */
struct vlan_group *vlan_grp;
- u16 num_vlans;
+ u16 vlans_added;
+ u16 max_vlans; /* Number of vlans supported */
u8 vlan_tag[VLAN_GROUP_ARRAY_LEN];
struct be_dma_mem mc_cmd_mem;
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 107de6d..c4af647 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -488,17 +488,16 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
}
/*
- * if there are BE_NUM_VLANS_SUPPORTED or lesser number of VLANS configured,
- * program them in BE. If more than BE_NUM_VLANS_SUPPORTED are configured,
- * set the BE in promiscuous VLAN mode.
+ * A max of 64 (BE_NUM_VLANS_SUPPORTED) vlans can be configured in BE.
+ * If the user configures more, place BE in vlan promiscuous mode.
*/
static int be_vid_config(struct be_adapter *adapter)
{
u16 vtag[BE_NUM_VLANS_SUPPORTED];
u16 ntags = 0, i;
- int status;
+ int status = 0;
- if (adapter->num_vlans <= BE_NUM_VLANS_SUPPORTED) {
+ if (adapter->vlans_added <= adapter->max_vlans) {
/* Construct VLAN Table to give to HW */
for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
if (adapter->vlan_tag[i]) {
@@ -532,21 +531,21 @@ static void be_vlan_add_vid(struct net_device *netdev, u16 vid)
{
struct be_adapter *adapter = netdev_priv(netdev);
- adapter->num_vlans++;
adapter->vlan_tag[vid] = 1;
-
- be_vid_config(adapter);
+ adapter->vlans_added++;
+ if (adapter->vlans_added <= (adapter->max_vlans + 1))
+ be_vid_config(adapter);
}
static void be_vlan_rem_vid(struct net_device *netdev, u16 vid)
{
struct be_adapter *adapter = netdev_priv(netdev);
- adapter->num_vlans--;
adapter->vlan_tag[vid] = 0;
-
vlan_group_set_device(adapter->vlan_grp, vid, NULL);
- be_vid_config(adapter);
+ adapter->vlans_added--;
+ if (adapter->vlans_added <= adapter->max_vlans)
+ be_vid_config(adapter);
}
static void be_set_multicast_list(struct net_device *netdev)
@@ -785,7 +784,7 @@ static void be_rx_compl_process(struct be_adapter *adapter,
skb->dev = adapter->netdev;
if (vlanf) {
- if (!adapter->vlan_grp || adapter->num_vlans == 0) {
+ if (!adapter->vlan_grp || adapter->vlans_added == 0) {
kfree_skb(skb);
return;
}
@@ -865,7 +864,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
vid = AMAP_GET_BITS(struct amap_eth_rx_compl, vlan_tag, rxcp);
vid = be16_to_cpu(vid);
- if (!adapter->vlan_grp || adapter->num_vlans == 0)
+ if (!adapter->vlan_grp || adapter->vlans_added == 0)
return;
vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid);
@@ -2240,6 +2239,11 @@ static int be_get_config(struct be_adapter *adapter)
memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);
memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);
+ if (adapter->cap & 0x400)
+ adapter->max_vlans = BE_NUM_VLANS_SUPPORTED/4;
+ else
+ adapter->max_vlans = BE_NUM_VLANS_SUPPORTED;
+
return 0;
}
--
1.6.3.3
^ permalink raw reply related
* [PATCH 6/7] be2net: change the driver description
From: Ajit Khaparde @ 2010-02-09 11:38 UTC (permalink / raw)
To: davem, netdev
Since the driver is supporting multiple generations of the ASIC
remove ASIC generation information from the driver description.
This information is displayed by modinfo.
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
drivers/net/benet/be.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 476a5c4..b39b385 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -38,7 +38,7 @@
#define BE3_NAME "ServerEngines BladeEngine3 10Gbps NIC"
#define OC_NAME "Emulex OneConnect 10Gbps NIC"
#define OC_NAME1 "Emulex OneConnect 10Gbps NIC (be3)"
-#define DRV_DESC BE_NAME "Driver"
+#define DRV_DESC "ServerEngines BladeEngine 10Gbps NIC Driver"
#define BE_VENDOR_ID 0x19a2
#define BE_DEVICE_ID1 0x211
--
1.6.3.3
^ permalink raw reply related
* [PATCH 7/7] be2net: remove ASIC generation number from Kconfig
From: Ajit Khaparde @ 2010-02-09 11:39 UTC (permalink / raw)
To: davem, netdev
Since the driver is supporting multiple generations of the ASIC
don't mention any ASIC generation number.
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
drivers/net/benet/Kconfig | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/benet/Kconfig b/drivers/net/benet/Kconfig
index fdb6e81..1a41a49 100644
--- a/drivers/net/benet/Kconfig
+++ b/drivers/net/benet/Kconfig
@@ -1,6 +1,6 @@
config BE2NET
- tristate "ServerEngines' 10Gbps NIC - BladeEngine 2"
+ tristate "ServerEngines' 10Gbps NIC - BladeEngine"
depends on PCI && INET
help
This driver implements the NIC functionality for ServerEngines'
- 10Gbps network adapter - BladeEngine 2.
+ 10Gbps network adapter - BladeEngine.
--
1.6.3.3
^ permalink raw reply related
* Re: netfilter/iptables and network interface names
From: Jan Engelhardt @ 2010-02-09 11:44 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Thomas Woerner, netdev, Netfilter Developer Mailing List
In-Reply-To: <4B6BF294.3020501@trash.net>
On Friday 2010-02-05 11:27, Patrick McHardy wrote:
>Jan Engelhardt wrote:
>> On Thursday 2010-02-04 17:49, Patrick McHardy wrote:
>>> Jan Engelhardt wrote:
>>>>> The kernel also forbids ".".
>> 19:44 borg:/home/jengelh # ip tunnel add .3 mode sit local 1.2.3.6 remote
>> 5.6.7.7
>> 19:44 borg:/home/jengelh # ip a
>> 17: .3: <POINTOPOINT,NOARP> mtu 1480 qdisc noop state DOWN
>> link/sit 1.2.3.6 peer 5.6.7.7
>
>OK you're right, but this seems to be an oversight. The names
>are checked during rename, but not on device registration.
>
So, what about the patch(es)? :-)
^ permalink raw reply
* place for discussion about 'tc'
From: Mihamina Rakotomandimby @ 2010-02-09 11:35 UTC (permalink / raw)
To: netdev
Manao ahoana, Hello, Bonjour,
Where is the right mailing list for discussing 'tc' usage?
Misaotra, Thanks, Merci.
--
Architecte Informatique chez Blueline/Gulfsat:
Administration Systeme, Recherche & Developpement
+261 34 29 155 34 / +261 33 11 207 36
^ permalink raw reply
* Re: [PATCH 0/3][v2] tcp: fix ICMP-RTO war
From: Ilpo Järvinen @ 2010-02-09 12:37 UTC (permalink / raw)
To: Damian Lukowski; +Cc: David Miller, Netdev
In-Reply-To: <4B708913.906@tvk.rwth-aachen.de>
On Mon, 8 Feb 2010, Damian Lukowski wrote:
> Damian Lukowski schrieb:
> > Am 01.02.2010, 08:33 Uhr, schrieb David Miller <davem@davemloft.net>:
> >
> >> From: Damian Lukowski <damian@tvk.rwth-aachen.de>
> >> Date: Fri, 29 Jan 2010 23:15:51 +0100
> >>
> >>> This patches fix the current RTO calculation routine, when
> >>> srtt and rttvar are zero, yielding an RTO of zero
> >>> Under some circumstances, TCPs srtt and rttvar are zero,
> >>> yielding a calculated RTO of zero.
> >>> This is particularly unfortunate for ICMP based RTO recalculation
> >>> as introduced in f1ecd5d9e736660 (Revert Backoff [v3]: Revert RTO
> >>> on ICMP destination unreachable), as it results in RTO retransmission
> >>> flooding.
> >>>
> >>> Thanks to Ilpo Jarvinen for providing debug patches and to
> >>> Denys Fedoryshchenko for reporting and testing.
> >>>
> >>> Signed-off-by: Damian Lukowski <damian@tvk.rwth-aachen.de>
> >>
> >> I still haven't seen a detailed enough analysis of why these
> >> tiny RTOs can come to exist in the first place.
> >>
> >> Please show me a list of events, function by function, the value of
> >> relevant variables and per-socket TCP state, in the TCP stack, that
> >> show how this ends up happening.
> >>
> >> Thanks for all of your work on this so far.
> >
> > I might have figured it out, but could not verify it, so maybe you can
> > comment my thought.
> >
> > When a listening TCP receives a SYN, it will send a SYN+ACK
> > and wait for an ACK to complete the handshake.
> > Look at tcp_rcv_state_process::step 5::case SYN_RECV::acceptable
> > and the code after the comment "tcp_ack considers this ACK as duplicate
> > and does not calculate rtt".
> >
> > If the connecting client has disabled timestamps, the rtt statistics
> > won't be updated here, while the state is changed above.
> > I printk'ed at the very end of TCP_SYN_RECV and got the following:
> > state 1 (ESTABLISHED), srtt 0, rttvar 0.
> >
> > So my suspicion is: If connectivity breaks right after a listening TCP
> > has completed the handshake without timestamps, and the listening TCP
> > sends data after establishing the connection, we will get the observed
> > behaviour.
>
> Just verified that by dropping pure ACKs coming from the originally
> listening TCP using iptables.
Isn't that "tcp_ack considers" comment like this: we have bug elsewhere in
the code but workaround it here, at least for some of the cases? (I'd put
it other way around: but alas, only for part of the cases.) ...It sound
like that to me. What exactly is the reason why rtt shouldn't be
calculated/initialized on such ACK, anything I'm missing?
--
i.
^ permalink raw reply
* Re: [PATCH v2 00/41] CAPI: Major rework, tons of bug fixes
From: Karsten Keil @ 2010-02-09 12:54 UTC (permalink / raw)
To: Jan Kiszka
Cc: David Miller, linux-kernel, i4ldeveloper, isdn4linux, netdev,
Alan Cox, Marcel Holtmann
In-Reply-To: <cover.1265659933.git.jan.kiszka@web.de>
On Montag, 8. Februar 2010 21:12:04 Jan Kiszka wrote:
> Here is the second take of my CAPI rework. I tried to address all
> feedback on v1, so this one comes with the following changes:
>
> o rebased over net-next
> o reworked locking of the NCCI TTY using latest and greatest tty_port
> features and kref, hopefully in the right way
> o more fine-grained patch steps for the tricky TTY rework
> o dynamic major for NCCI TTYs, ie. CAPI no longer claims 191
> o dynamic TTY minor registrations, completely obsoleting capifs
> o schedule capifs for removal
> o some small additional cleanups
>
> I kept my capifs fixes though this thing should die in the future. The
> work is done, and people may still use it due to their distro
> configuration (and the hard-wired loading by capiinit - needs fixing).
>
> You can pull this series from
>
> git://git.kiszka.org/linux-2.6.git capi
>
Thank you for that effort, it looks very good for me.
I will acknowlegde them, after a few tests.
> Jan
>
> Jan Kiszka (41):
> CAPI: Fix leaks in capifs_new_ncci
> CAPI: Sanitize capifs API
> CAPI: Eliminate capifs_root variable
> CAPI: Pin capifs instead of mounting it
> CAPI: Reduce chattiness during module loading/removal
> CAPI: Call a controller 'controller', not 'card'
> CAPI: Convert capi drivers rwlock into mutex
> CAPI: Rework capi_ctr_ready/down
> CAPI: Rework controller state notifier
> CAPI: Rework locking of controller data structures
> CAPI: Rework application locking
> CAPI: Reduce #ifdef mess around CONFIG_ISDN_CAPI_MIDDLEWARE
> CAPI: Convert capidev_list_lock into a mutex
> CAPI: Clean up capi_open/release
> CAPI: Rework locking of capidev members
> CAPI: Use non-atomic allocation during NCCI setup
> CAPI: Fix racy capi_read
> CAPI: Switch NCCI list to standard doubly linked list
> CAPI: Switch capiminor list to array
> CAPI: Clean up capinc_tty_init/exit
> CAPI: Dynamically register minor devices
> CAPI: Use dynamic major for NCCI TTYs by default
> CAPI: Use kref on capiminor
> CAPI: Establish install/cleanup handlers for capiminor TTYs
> CAPI: Use tty_port to keep track of capiminor's tty
> CAPI: Drop remaining NULL checks on tty->driver_data
> CAPI: Issue synchronous hangup on capincci_free_minor
> CAPI: Drop obsolete nccip from capiminor struct
> CAPI: Clean up capiminors_lock
> CAPI: Drop atomic ttyopencount
> CAPI: Drop handle_minor_recv from capinc_tty_write
> CAPI: Rework capiminor RX handler
> CAPI: Rename datahandle_queue -> ackqueue_entry
> CAPI: Use atomics for capiminor's datahandle and msgid
> CAPI: Drop capiminor's unused inbytes counter
> CAPI: Fix locking around capiminor's output queue and drop
> workaround_lock
> CAPI: Clean up capiminor_*_ack
> CAPI: Drop return value of handle_minor_send
> CAPI: Drop special controller lookup from capi20_put_message
> CAPI: Schedule capifs for removal
> CAPI: Remove experimental tag from middleware feature
>
> Documentation/feature-removal-schedule.txt | 10 +
> drivers/isdn/capi/Kconfig | 16 +-
> drivers/isdn/capi/capi.c | 1108
> ++++++++++++++-------------- drivers/isdn/capi/capidrv.c |
> 48 +-
> drivers/isdn/capi/capifs.c | 126 ++--
> drivers/isdn/capi/capifs.h | 21 +-
> drivers/isdn/capi/kcapi.c | 805 +++++++++++---------
> drivers/isdn/capi/kcapi.h | 13 +-
> drivers/isdn/capi/kcapi_proc.c | 41 +-
> include/linux/isdn/capilli.h | 5 +-
> include/linux/kernelcapi.h | 17 +-
> 11 files changed, 1151 insertions(+), 1059 deletions(-)
>
^ permalink raw reply
* Re: [PATCH 01/23 v3] mlx4_core: identify function as pf or vf
From: Ben Hutchings @ 2010-02-09 13:41 UTC (permalink / raw)
To: Yevgeny Petrilin; +Cc: Roland Dreier, general, netdev, liranl, tziporet
In-Reply-To: <4B6AEDB0.2030105@mellanox.co.il>
The summary 'mlx4_core: identify function as pf or vf' doesn't match the
implementation. Patch 14 'mlx4_core: Determine primary physical
function' makes it clear that a PF can also be a 'slave'.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [PATCH] xfrm: validate attributes
From: jamal @ 2010-02-09 13:59 UTC (permalink / raw)
To: David Miller, Herbert Xu; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 91 bytes --]
make sure all XFRMAs go through validation in case wrong
content is passed
cheers,
jamal
[-- Attachment #2: xfrma-vald --]
[-- Type: text/plain, Size: 1003 bytes --]
commit 979fef2abd38392e28c851215c59d1128fe0f776
Author: Jamal Hadi Salim <hadi@cyberus.ca>
Date: Tue Feb 9 08:47:57 2010 -0500
xfrm: validate attributes
Some XFRM attributes were not going through basic validation.
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d5a7129..943c871 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2054,6 +2054,10 @@ static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = {
#undef XMSGSIZE
static const struct nla_policy xfrma_policy[XFRMA_MAX+1] = {
+ [XFRMA_SA] = { .len = sizeof(struct xfrm_usersa_info)},
+ [XFRMA_POLICY] = { .len = sizeof(struct xfrm_userpolicy_info)},
+ [XFRMA_LASTUSED] = { .type = NLA_U64},
+ [XFRMA_ALG_AUTH_TRUNC] = { .len = sizeof(struct xfrm_algo_auth)},
[XFRMA_ALG_AEAD] = { .len = sizeof(struct xfrm_algo_aead) },
[XFRMA_ALG_AUTH] = { .len = sizeof(struct xfrm_algo) },
[XFRMA_ALG_CRYPT] = { .len = sizeof(struct xfrm_algo) },
^ permalink raw reply related
* Re: [net-next-2.6 PATCH 2/3] fs_enet: Add support for MPC512x to fs_enet driver
From: Anatolij Gustschin @ 2010-02-09 14:23 UTC (permalink / raw)
To: David Miller
Cc: wg, netdev, dzu, wd, jcrigby, kosmo, linuxppc-dev, grant.likely
In-Reply-To: <20100121.180311.228791894.davem@davemloft.net>
On Thu, 21 Jan 2010 18:03:11 -0800 (PST)
David Miller <davem@davemloft.net> wrote:
> From: Wolfgang Grandegger <wg@grandegger.com>
> Date: Thu, 21 Jan 2010 16:25:38 +0100
>
> > Do you see a more clever solution to this problem?
>
> See how we handle this in the ESP scsi driver. We have a set of
> defines for the register offsets, and a set of methods a chip driver
> implements for register accesses.
>
> If the offsets differ, the register access method can translate the
> generic register offsets into whatever layout their implementation
> actually uses.
First of all thanks for your suggestion. I have seen how you
handle register access in the ESP scsi driver. The reason I didn't
try to implement register access using similar approach is that
we have different sort of problem.
In my understanding, in the ESP scsi driver the set of defines for
the register offsets is common for all chip drivers. The chip driver
methods for register access translate the offsets because the
registers on some chips are at different intervals (4-byte, 1-byte,
16-byte for mac_esp.c). But the register order is the same for
different chips.
In our case non only the register order is not the same for 8xx
FEC and 5121 FEC, but there are also other differences, different
reserved areas between several registers, some registers are
available only on 8xx and some only on 5121.
Now at least tree people suggested to fork the driver. My question
is if you would accept a forked 5121 FEC specific driver realised
similar to drivers/net/fs_enet/mac-fec.c and
drivers/net/fs_enet/mii-fec.c drivers?
Thanks,
Anatolij
^ permalink raw reply
* Re: [PATCH 02/23 v3] mlx4_core: add multi-function communication channel
From: Ben Hutchings @ 2010-02-09 14:37 UTC (permalink / raw)
To: Yevgeny Petrilin; +Cc: Roland Dreier, general, netdev, liranl, tziporet
In-Reply-To: <4B6AEDBA.6040403@mellanox.co.il>
On Thu, 2010-02-04 at 17:54 +0200, Yevgeny Petrilin wrote:
> The communication channel consists of 2 registers per vf (a slave function)
> that are shared with the pf (the master function), as well as a new command for
> inter-function memory copying (only exposed to the master).
>
> The communication channel is used to establish a Virtual HCA Command Register
> (vHCR) in each slave function, which allows it to pass FW commands to the master
> function for execution.
> The slave also uses the vHCR to pull slave-specific events from the master.
>
> Signed-off-by: Liran Liss <liranl@mellanox.co.il>
> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
> ---
> drivers/net/mlx4/cmd.c | 746 ++++++++++++++++++++++++++++++++++++++++++-
> drivers/net/mlx4/en_port.h | 5 -
> drivers/net/mlx4/eq.c | 67 ++++
> drivers/net/mlx4/fw.c | 8 +
> drivers/net/mlx4/mlx4.h | 72 ++++-
> include/linux/mlx4/cmd.h | 12 +-
> include/linux/mlx4/device.h | 3 +-
> 7 files changed, 895 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/mlx4/cmd.c b/drivers/net/mlx4/cmd.c
> index 65ec77d..6c3d25c 100644
> --- a/drivers/net/mlx4/cmd.c
> +++ b/drivers/net/mlx4/cmd.c
> @@ -140,6 +140,46 @@ static int mlx4_status_to_errno(u8 status)
> return trans_table[status];
> }
>
> +static int comm_pending(struct mlx4_dev *dev)
> +{
> + struct mlx4_priv *priv = mlx4_priv(dev);
> + u32 status = readl(&priv->mfunc.comm->slave_read);
> +
> + return (swab32(status) >> 30) != priv->cmd.comm_toggle;
> +}
> +
> +int mlx4_comm_cmd(struct mlx4_dev *dev, u8 cmd, u16 param, unsigned long timeout)
> +{
> + struct mlx4_priv *priv = mlx4_priv(dev);
> + unsigned long end;
> + u32 val;
> +
> + /* First, verify that the master reports correct status */
> + if (comm_pending(dev)) {
> + mlx4_warn(dev, "Communication channel is not idle\n");
> + return -EAGAIN;
> + }
> +
> + /* Write command */
> + if (cmd == MLX4_COMM_CMD_RESET)
> + priv->cmd.comm_toggle = 0;
> + else if (++priv->cmd.comm_toggle > 2)
> + priv->cmd.comm_toggle = 1;
> + val = param | (cmd << 16) | (priv->cmd.comm_toggle << 30);
> + __raw_writel((__force u32) cpu_to_be32(val), &priv->mfunc.comm->slave_write);
> + wmb();
I think you need a wmb() *before* writing the command, so that its
parameters are visible. I don't see why you would need a wmb()
afterward; maybe you want mmiowb()?
I also suggest you encapsulate this byte-swapping in inline functions:
static inline u32 comm_read(void __iomem *addr)
{
return be32_to_cpu((__force __be32) __raw_readl(addr));
}
static inline void comm_write(u32 val, void __iomem *addr)
{
__raw_writel((__force u32) cpu_to_be32(val), addr);
mmiowb();
}
[...]
> +static struct mlx4_cmd_info {
> + u16 opcode;
> + bool has_inbox;
> + bool has_outbox;
> + bool out_is_imm;
> + int (*verify)(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhcr,
> + struct mlx4_cmd_mailbox *inbox);
> + int (*wrapper)(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhcr,
> + struct mlx4_cmd_mailbox *inbox,
> + struct mlx4_cmd_mailbox *outbox);
> +} cmd_info[] = {
[...]
> + {
> + .opcode = MLX4_CMD_SW2HW_EQ,
> + .has_inbox = true,
> + .has_outbox = false,
> + .out_is_imm = false,
> + .verify = NULL, /*need verifier */
> + .wrapper = NULL
> + },
What does 'need verifier' mean? Is this implementation incomplete?
> +static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave)
> +{
[...]
> + /* Execute the command! */
> + if (cmd->wrapper)
> + vhcr->errno = cmd->wrapper(dev, slave, vhcr, inbox, outbox);
> + else {
> + in_param = cmd->has_inbox ? (u64) inbox->dma : vhcr->in_param;
> + out_param = cmd->has_outbox ? (u64) outbox->dma : vhcr->out_param;
> + vhcr->errno = __mlx4_cmd(dev, in_param, &out_param,
> + cmd->out_is_imm,
> + vhcr->in_modifier,
> + vhcr->op_modifier,
> + vhcr->op,
> + vhcr->timeout);
> + if (cmd->out_is_imm)
> + vhcr->out_param = out_param;
> + }
Both branches should be bracketed.
[...]
> +static void mlx4_master_do_cmd(struct mlx4_dev *dev, int slave, u8 cmd, u16 param, u8 toggle)
> +{
[...]
> +reset_slave:
> + /* FIXME: cleanup any slave resources */
[...]
Maybe you should do that in the next version then?
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH 1/2] IPv6: keep permanent addresses on admin down
From: Brian Haley @ 2010-02-09 14:40 UTC (permalink / raw)
To: Stephen Hemminger
Cc: David Miller,
YOSHIFUJI Hideaki / 吉藤英明, netdev
In-Reply-To: <20100208214805.1f8f2c6d@nehalam>
Stephen Hemminger wrote:
> @@ -2686,18 +2687,30 @@ static int addrconf_ifdown(struct net_de
> write_lock_bh(&idev->lock);
> }
> #endif
> - while ((ifa = idev->addr_list) != NULL) {
> - idev->addr_list = ifa->if_next;
> - ifa->if_next = NULL;
> - ifa->dead = 1;
> - addrconf_del_timer(ifa);
> - write_unlock_bh(&idev->lock);
> -
> - __ipv6_ifa_notify(RTM_DELADDR, ifa);
> - atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifa);
> - in6_ifa_put(ifa);
> + bifa = &idev->addr_list;
> + while ((ifa = *bifa) != NULL) {
> + if (how == 0 && (ifa->flags&IFA_F_PERMANENT)) {
> + /* Retain permanent address on admin down */
> + bifa = &ifa->if_next;
> +
> + /* Restart DAD if needed when link comes back up */
> + if ( !((dev->flags&(IFF_NOARP|IFF_LOOPBACK)) ||
> + idev->cnf.accept_dad <= 0 ||
> + (ifa->flags & IFA_F_NODAD)))
> + ifa->flags |= IFA_F_TENTATIVE;
> + } else {
> + *bifa = ifa->if_next;
> + ifa->if_next = NULL;
> +
> + ifa->dead = 1;
> + write_unlock_bh(&idev->lock);
> +
> + __ipv6_ifa_notify(RTM_DELADDR, ifa);
> + atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifa);
> + in6_ifa_put(ifa);
>
> - write_lock_bh(&idev->lock);
> + write_lock_bh(&idev->lock);
> + }
What about addrconf_del_timer()? It didn't seem to make it to this else{} from
the original.
-Brian
^ permalink raw reply
* Re: [PATCH 04/23 v3] mlx4_core: add slave resource allocation
From: Ben Hutchings @ 2010-02-09 14:44 UTC (permalink / raw)
To: Yevgeny Petrilin; +Cc: Roland Dreier, general, netdev, liranl, tziporet
In-Reply-To: <4B6AEDCC.8020503@mellanox.co.il>
On Thu, 2010-02-04 at 17:54 +0200, Yevgeny Petrilin wrote:
> All QPs/CQs/SRQs/MPTs/MTTs are allocated from shared pools, which are owned by
> the master. In addition, all backing ICM memory for these objects is managed by
> the master.
> To allow slaves to allocate resources, ICM allocation is separated from the rest
> of the object state, which is held at the slave.
> Slaves can then reserve resource ranges and allocate ICM over the comm channel.
>
> Signed-off-by: Liran Liss <liranl@mellanox.co.il>
> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
> ---
> drivers/net/mlx4/cmd.c | 110 +++++++++++++++++++++++++++++++++
> drivers/net/mlx4/cq.c | 91 +++++++++++++++++++++-------
> drivers/net/mlx4/mlx4.h | 27 ++++++++
> drivers/net/mlx4/mr.c | 125 ++++++++++++++++++++++++++++++++++----
> drivers/net/mlx4/qp.c | 151 +++++++++++++++++++++++++++++++++-------------
> drivers/net/mlx4/srq.c | 88 ++++++++++++++++++++-------
> include/linux/mlx4/cmd.h | 2 +
> 7 files changed, 496 insertions(+), 98 deletions(-)
>
> diff --git a/drivers/net/mlx4/cmd.c b/drivers/net/mlx4/cmd.c
> index 9e85330..533ce77 100644
> --- a/drivers/net/mlx4/cmd.c
> +++ b/drivers/net/mlx4/cmd.c
> @@ -417,6 +417,100 @@ static int mlx4_ACCESS_MEM(struct mlx4_dev *dev, u64 master_addr,
> MLX4_CMD_TIME_CLASS_A);
> }
>
> +static int mlx4_RESOURCE_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhcr,
> + struct mlx4_cmd_mailbox *inbox,
> + struct mlx4_cmd_mailbox *outbox)
> +{
> + u32 param1 = *((u32 *) &vhcr->in_param);
> + u32 param2 = *(((u32 *) &vhcr->in_param) + 1);
> + int ret;
> +
> +#if 0
> + char *res[] = {"QP", "CQ", "SRQ", "MPT", "MTT"};
> + mlx4_warn(dev, "resource wrapper - %s (mode: %s) type:%s param1:%d param2:%d\n",
> + vhcr->op == MLX4_CMD_ALLOC_RES ? "allocate" : "free",
> + vhcr->op_modifier == ICM_RESERVE ? "reserve" :
> + (vhcr->op_modifier == ICM_ALLOC ? "alloc" : "reserve+alloc"),
> + res[vhcr->in_modifier], param1, param2);
> +#endif
Either make this really conditional or remove it. '#if 0' is not
useful.
[...]
> diff --git a/drivers/net/mlx4/cq.c b/drivers/net/mlx4/cq.c
> index ccfe276..3fb9f7f 100644
> --- a/drivers/net/mlx4/cq.c
> +++ b/drivers/net/mlx4/cq.c
[...]
> +void mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn)
> +{
> + struct mlx4_priv *priv = mlx4_priv(dev);
> + struct mlx4_cq_table *cq_table = &priv->cq_table;
> + u64 in_param;
> + int err;
> +
> + if (mlx4_is_slave(dev)) {
> + *((u32 *) &in_param) = cqn;
> + *(((u32 *) &in_param) + 1) = 0;
> + err = mlx4_cmd(dev, in_param, RES_CQ, ICM_RESERVE_AND_ALLOC,
> + MLX4_CMD_FREE_RES,
> + MLX4_CMD_TIME_CLASS_A);
This is fairly disgusting, and surely only works for one byte order. I
think you really want:
in_param = cqn;
[...]
> diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
> index 9e4ab0f..0db7f88 100644
> --- a/drivers/net/mlx4/mr.c
> +++ b/drivers/net/mlx4/mr.c
> @@ -178,10 +178,26 @@ static void mlx4_buddy_cleanup(struct mlx4_buddy *buddy)
> kfree(buddy->num_free);
> }
>
> -static u32 mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order)
> +u32 mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order)
> {
> struct mlx4_mr_table *mr_table = &mlx4_priv(dev)->mr_table;
> + u64 in_param;
> + u64 out_param;
> u32 seg;
> + int err;
> +
> + if (mlx4_is_slave(dev)) {
> + *((u32 *) &in_param) = order;
> + *(((u32 *) &in_param) + 1) = 0;
> + err = mlx4_cmd_imm(dev, in_param, &out_param, RES_MTT,
> + ICM_RESERVE_AND_ALLOC,
> + MLX4_CMD_ALLOC_RES,
> + MLX4_CMD_TIME_CLASS_A);
Again with the byte-ordering...
> + if (err)
> + return -1;
> + else
> + return out_param;
> + }
>
> seg = mlx4_buddy_alloc(&mr_table->mtt_buddy, order);
> if (seg == -1)
> @@ -219,16 +235,33 @@ int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift,
> }
> EXPORT_SYMBOL_GPL(mlx4_mtt_init);
>
> -void mlx4_mtt_cleanup(struct mlx4_dev *dev, struct mlx4_mtt *mtt)
> +void mlx4_free_mtt_range(struct mlx4_dev *dev, u32 first_seg, int order)
> {
> struct mlx4_mr_table *mr_table = &mlx4_priv(dev)->mr_table;
> + u64 in_param;
> + int err;
> +
> + if (mlx4_is_slave(dev)) {
> + *((u32 *) &in_param) = first_seg;
> + *(((u32 *) &in_param) + 1) = order;
> + err = mlx4_cmd(dev, in_param, RES_MTT, ICM_RESERVE_AND_ALLOC,
> + MLX4_CMD_FREE_RES,
> + MLX4_CMD_TIME_CLASS_A);
and here:
in_param = first_seg | (u64)order << 32;
[...]
> +void mlx4_mr_release(struct mlx4_dev *dev, u32 index)
> +{
> + struct mlx4_priv *priv = mlx4_priv(dev);
> + u64 in_param;
> + int err;
> +
> + if (mlx4_is_slave(dev)) {
> + *((u32 *) &in_param) = index;
> + *(((u32 *) &in_param) + 1) = 0;
etc. etc.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH iproute2] ip: print "temporary" for IPv6 temp addresses
From: Brian Haley @ 2010-02-09 14:49 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev@vger.kernel.org
In-Reply-To: <20091226111759.22a9ebe1@nehalam>
Stephen Hemminger wrote:
>>>> Brian Haley wrote:
>>>>> IPv6 addresses that have IFA_F_SECONDARY set are actually temporary addresses,
>>>>> hence the IFA_F_TEMPORARY equivalent. Change the output in this case and
>>>>> allow filtering on the word "temporary".
>>>> I didn't see this in your current git tree, just pinging you about it. This
>>>> would apply on top of my dad_failed patch.
>>>>
>>> I'll put it as well, why did patchwork not see it?
>> I can only assume it was my subject line?
>>
>> Let me know if I need to re-send as it was based on the other one.
>>
>> -Brian
>
> This in for 2.6.33 (next version)
Hi Stephen,
Sorry to bug you again, but I still don't see this patch in your
iproute2 git tree, although I see things done after it. Do I have
to wait until you tag a v2.6.33?
Thanks,
-Brian
^ permalink raw reply
* Re: netfilter/iptables and network interface names
From: Patrick McHardy @ 2010-02-09 15:00 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: Thomas Woerner, netdev, Netfilter Developer Mailing List
In-Reply-To: <alpine.LSU.2.01.1002041542150.13435@obet.zrqbmnf.qr>
Jan Engelhardt wrote:
> Lift restrictions on interface names
>
> The kernel has few restrictions.
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] [V2] net: emaclite: adding MDIO and phy lib support
From: Grant Likely @ 2010-02-09 15:45 UTC (permalink / raw)
To: John Linn
Cc: netdev, linuxppc-dev, jgarzik, jwboyer, john.williams,
Sadanand Mutyala
In-Reply-To: <260b8801-53bd-44fe-a6b8-7d1d0f56fef5@SG2EHSMHS011.ehs.local>
On Mon, Feb 8, 2010 at 7:09 AM, John Linn <John.Linn@xilinx.com> wrote:
>> -----Original Message-----
>> From: John Linn [mailto:john.linn@xilinx.com]
>> Sent: Friday, February 05, 2010 3:41 PM
>> To: netdev@vger.kernel.org; linuxppc-dev@ozlabs.org;
> jgarzik@pobox.com; grant.likely@secretlab.ca;
>> jwboyer@linux.vnet.ibm.com
>> Cc: john.williams@petalogix.com; John Linn; Sadanand Mutyala
>> Subject: [PATCH] [V2] net: emaclite: adding MDIO and phy lib support
>>
>> These changes add MDIO and phy lib support to the driver as the
>> IP core now supports the MDIO bus.
>>
>> The MDIO bus and phy are added as a child to the emaclite in the
> device
>> tree as illustrated below.
>>
>> mdio {
>> #address-cells = <1>;
>> #size-cells = <0>;
>> compatible = "xlnx,emaclite-mdio";
>> phy0: phy@7 {
>> reg = <7>;
>> } ;
>> }
You misunderstood me about the compatible property. You don't need a
compatible prop in the mdio node because it is *alwasy* a child of the
emaclite node, and the emaclite driver knows to go looking for it (ie.
it is a part of the device).
What I want to see is a compatible value in the phy@7 node for the
make & model of the phy.
Otherwise, looks good to me. Fix the mutex timeout problem and then
you can add my acked-by line to the patch.
Cheers,
g.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox