[PATCH] ehea: add kdump support
This patch adds kdump support to the ehea driver. As the firmware doesn't free resource handles automatically, the driver has to run an as simple as possible free resource function in case of a crash shutdown. The function iterates over two arrays freeing all resource handles which are stored there. The arrays are kept up-to-date during normal runtime. The crash handler fn is triggered by the recently introduced PPC crash shutdown reg/unreg functions. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h | 34 +- drivers/net/ehea/ehea_main.c | 281 ++ 2 files changed, 290 insertions(+), 25 deletions(-) diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 88fb53e..7c4ead3 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -40,7 +40,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0083 +#define DRV_VERSIONEHEA_0087 /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 @@ -386,6 +386,13 @@ struct ehea_port_res { #define EHEA_MAX_PORTS 16 + +#define EHEA_NUM_PORTRES_FW_HANDLES6 /* QP handle, SendCQ handle, +RecvCQ handle, EQ handle, +SendMR handle, RecvMR handle */ +#define EHEA_NUM_PORT_FW_HANDLES 1 /* EQ handle */ +#define EHEA_NUM_ADAPTER_FW_HANDLES2 /* MR handle, NEQ handle */ + struct ehea_adapter { u64 handle; struct of_device *ofdev; @@ -405,6 +412,31 @@ struct ehea_mc_list { u64 macaddr; }; +/* kdump support */ +struct ehea_fw_handle_entry { + u64 adh; /* Adapter Handle */ + u64 fwh; /* Firmware Handle */ +}; + +struct ehea_fw_handle_array { + struct ehea_fw_handle_entry *arr; + int num_entries; + struct semaphore lock; +}; + +struct ehea_bcmc_reg_entry { + u64 adh; /* Adapter Handle */ + u32 port_id; /* Logical Port Id */ + u8 reg_type; /* Registration Type */ + u64 macaddr; +}; + +struct ehea_bcmc_reg_array { + struct ehea_bcmc_reg_entry *arr; + int num_entries; + struct semaphore lock; +}; + #define EHEA_PORT_UP 1 #define EHEA_PORT_DOWN 0 #define EHEA_PHY_LINK_UP 1 diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index c051c7e..21af674 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -35,6 +35,7 @@ #include linux/if_ether.h #include linux/notifier.h #include linux/reboot.h +#include asm/kexec.h #include net/ip.h @@ -98,8 +99,10 @@ static int port_name_cnt; static LIST_HEAD(adapter_list); u64 ehea_driver_flags; struct work_struct ehea_rereg_mr_task; - struct semaphore dlpar_mem_lock; +struct ehea_fw_handle_array ehea_fw_handles; +struct ehea_bcmc_reg_array ehea_bcmc_regs; + static int __devinit ehea_probe_adapter(struct of_device *dev, const struct of_device_id *id); @@ -132,6 +135,160 @@ void ehea_dump(void *adr, int len, char *msg) } } +static void ehea_update_firmware_handles(void) +{ + struct ehea_fw_handle_entry *arr = NULL; + struct ehea_adapter *adapter; + int num_adapters = 0; + int num_ports = 0; + int num_portres = 0; + int i = 0; + int num_fw_handles, k, l; + + /* Determine number of handles */ + list_for_each_entry(adapter, adapter_list, list) { + num_adapters++; + + for (k = 0; k EHEA_MAX_PORTS; k++) { + struct ehea_port *port = adapter-port[k]; + + if (!port || (port-state != EHEA_PORT_UP)) + continue; + + num_ports++; + num_portres += port-num_def_qps + port-num_add_tx_qps; + } + } + + num_fw_handles = num_adapters * EHEA_NUM_ADAPTER_FW_HANDLES + +num_ports * EHEA_NUM_PORT_FW_HANDLES + +num_portres * EHEA_NUM_PORTRES_FW_HANDLES; + + if (num_fw_handles) { + arr = kzalloc(num_fw_handles * sizeof(*arr), GFP_KERNEL); + if (!arr) + return; /* Keep the existing array */ + } else + goto out_update; + + list_for_each_entry(adapter, adapter_list, list) { + for (k = 0; k EHEA_MAX_PORTS; k++) { + struct ehea_port *port = adapter-port[k]; + + if (!port || (port-state != EHEA_PORT_UP)) + continue; + + for (l = 0; +l port-num_def_qps + port-num_add_tx_qps; +l++) { + struct ehea_port_res *pr = port-port_res[l]; + + arr[i].adh = adapter-handle; + arr[i++].fwh
[RFC] ehea: kdump support - rework
This patch adds kdump support using the new PPC crash shutdown hook to the ehea driver. The reworked implementation follows the feedback I got. The crash handler now just iterates over two simple arrays instead of handling linked lists. Further feedback will be appreciated. ehea kdump support RFC #1: http://lkml.org/lkml/2007/12/12/241 Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- diff -Nurp -X dontdiff linux-2.6.24-rc5/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.24-rc5/drivers/net/ehea/ehea.h2007-12-11 04:48:43.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-12-17 16:18:49.0 +0100 @@ -40,7 +40,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0083 +#define DRV_VERSIONEHEA_0085 /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 @@ -386,6 +386,13 @@ struct ehea_port_res { #define EHEA_MAX_PORTS 16 + +#define EHEA_NUM_PORTRES_FW_HANDLES6 /* QP handle, SendCQ handle, +RecvCQ handle, EQ handle, +SendMR handle, RecvMR handle */ +#define EHEA_NUM_PORT_FW_HANDLES 1 /* EQ handle */ +#define EHEA_NUM_ADAPTER_FW_HANDLES2 /* MR handle, NEQ handle */ + struct ehea_adapter { u64 handle; struct of_device *ofdev; @@ -405,6 +412,31 @@ struct ehea_mc_list { u64 macaddr; }; +/* kdump support */ +struct ehea_fw_handle_entry { + u64 adh; /* Adapter Handle */ + u64 fwh; /* Firmware Handle */ +}; + +struct ehea_fw_handle_array { + struct ehea_fw_handle_entry *arr; + int num_entries; + struct semaphore lock; +}; + +struct ehea_bcmc_reg_entry { + u64 adh; /* Adapter Handle */ + u32 port_id; /* Logical Port Id */ + u8 reg_type; /* Registration Type */ + u64 macaddr; +}; + +struct ehea_bcmc_reg_array { + struct ehea_bcmc_reg_entry *arr; + int num_entries; + struct semaphore lock; +}; + #define EHEA_PORT_UP 1 #define EHEA_PORT_DOWN 0 #define EHEA_PHY_LINK_UP 1 diff -Nurp -X dontdiff linux-2.6.24-rc5/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.24-rc5/drivers/net/ehea/ehea_main.c 2007-12-11 04:48:43.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-12-17 16:18:49.0 +0100 @@ -35,6 +35,7 @@ #include linux/if_ether.h #include linux/notifier.h #include linux/reboot.h +#include asm/kexec.h #include net/ip.h @@ -98,8 +99,10 @@ static int port_name_cnt = 0; static LIST_HEAD(adapter_list); u64 ehea_driver_flags = 0; struct work_struct ehea_rereg_mr_task; - struct semaphore dlpar_mem_lock; +struct ehea_fw_handle_array ehea_fw_handles; +struct ehea_bcmc_reg_array ehea_bcmc_regs; + static int __devinit ehea_probe_adapter(struct of_device *dev, const struct of_device_id *id); @@ -131,6 +134,160 @@ void ehea_dump(void *adr, int len, char } } +static void ehea_update_firmware_handles(void) +{ + struct ehea_fw_handle_entry *arr = NULL; + struct ehea_adapter *adapter; + int num_adapters = 0; + int num_ports = 0; + int num_portres = 0; + int i = 0; + int num_fw_handles, k, l; + + /* Determine number of handles */ + list_for_each_entry(adapter, adapter_list, list) { + num_adapters++; + + for (k = 0; k EHEA_MAX_PORTS; k++) { + struct ehea_port *port = adapter-port[k]; + + if (!port || (port-state != EHEA_PORT_UP)) + continue; + + num_ports++; + num_portres += port-num_def_qps + port-num_add_tx_qps; + } + } + + num_fw_handles = num_adapters * EHEA_NUM_ADAPTER_FW_HANDLES + +num_ports * EHEA_NUM_PORT_FW_HANDLES + +num_portres * EHEA_NUM_PORTRES_FW_HANDLES; + + if (num_fw_handles) { + arr = kzalloc(num_fw_handles * sizeof(*arr), GFP_KERNEL); + if (!arr) + return; /* Keep the existing array */ + } else + goto out_update; + + list_for_each_entry(adapter, adapter_list, list) { + for (k = 0; k EHEA_MAX_PORTS; k++) { + struct ehea_port *port = adapter-port[k]; + + if (!port || (port-state != EHEA_PORT_UP)) + continue; + + for (l = 0; +l port-num_def_qps + port-num_add_tx_qps; +l++) { + struct ehea_port_res *pr = port-port_res[l]; + + arr[i].adh = adapter-handle; + arr[i++].fwh = pr-qp-fw_handle
[RFC] ehea: kdump support using new shutdown hook
This patch adds kdump support using the new PPC crash shutdown hook to the ehea driver. The driver now keeps a list of firmware handles which have to be freed in case of a crash. The crash handler does the minimum required: it frees the firmware resource handles plus broadcast/multicast registrations. Please comment. Shutdown hook patches: http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048058.html http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048059.html Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- diff -Nurp -X dontdiff linux-2.6.24-rc5/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.24-rc5/drivers/net/ehea/ehea.h2007-12-11 04:48:43.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-12-12 17:30:53.0 +0100 @@ -40,7 +40,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0083 +#define DRV_VERSIONEHEA_0084 /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 @@ -386,6 +386,7 @@ struct ehea_port_res { #define EHEA_MAX_PORTS 16 +#define EHEA_MAX_RES_HANDLES (100 * EHEA_MAX_PORTS + 10) struct ehea_adapter { u64 handle; struct of_device *ofdev; @@ -397,6 +398,7 @@ struct ehea_adapter { u64 max_mc_mac;/* max number of multicast mac addresses */ int active_ports; struct list_head list; + u64 res_handles[EHEA_MAX_RES_HANDLES]; }; diff -Nurp -X dontdiff linux-2.6.24-rc5/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.24-rc5/drivers/net/ehea/ehea_main.c 2007-12-11 04:48:43.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-12-12 17:30:53.0 +0100 @@ -35,6 +35,7 @@ #include linux/if_ether.h #include linux/notifier.h #include linux/reboot.h +#include asm-powerpc/kexec.h #include net/ip.h @@ -2256,6 +2257,33 @@ static int ehea_clean_all_portres(struct return ret; } +static void ehea_update_adapter_handles(struct ehea_adapter *adapter) +{ + int i, k; + int j = 0; + + memset(adapter-res_handles, sizeof(adapter-res_handles), 0); + + for (k = 0; k EHEA_MAX_PORTS; k++) { + struct ehea_port *port = adapter-port[k]; + + if (!port || (port-state != EHEA_PORT_UP)) + continue; + + for(i = 0; i port-num_def_qps + port-num_add_tx_qps; i++) { + struct ehea_port_res *pr = port-port_res[i]; + + adapter-res_handles[j++] = pr-qp-fw_handle; + adapter-res_handles[j++] = pr-send_cq-fw_handle; + adapter-res_handles[j++] = pr-recv_cq-fw_handle; + adapter-res_handles[j++] = pr-eq-fw_handle; + adapter-res_handles[j++] = pr-send_mr.handle; + adapter-res_handles[j++] = pr-recv_mr.handle; + } + adapter-res_handles[j++] = port-qp_eq-fw_handle; + } +} + static void ehea_remove_adapter_mr(struct ehea_adapter *adapter) { if (adapter-active_ports) @@ -2318,6 +2346,7 @@ static int ehea_up(struct net_device *de ret = 0; port-state = EHEA_PORT_UP; + ehea_update_adapter_handles(port-adapter); goto out; out_free_irqs: @@ -2387,6 +2416,8 @@ static int ehea_down(struct net_device * ehea_info(Failed freeing resources for %s. ret=%i, dev-name, ret); + ehea_update_adapter_handles(port-adapter); + return ret; } @@ -3302,6 +,71 @@ static int __devexit ehea_remove(struct return 0; } +void ehea_crash_deregister(void) +{ + struct ehea_adapter *adapter; + int i; + u64 hret; + u8 reg_type; + + list_for_each_entry(adapter, adapter_list, list) { + for (i = 0; i EHEA_MAX_PORTS; i++) { + struct ehea_port *port = adapter-port[i]; + if (port-state == EHEA_PORT_UP) { + struct ehea_mc_list *mc_entry = port-mc_list; + struct list_head *pos; + struct list_head *temp; + + /* Undo multicast registrations */ + list_for_each_safe(pos, temp, + (port-mc_list-list)) { + mc_entry = list_entry(pos, + struct ehea_mc_list, + list); + ehea_multicast_reg_helper(port, + mc_entry-macaddr, + H_DEREG_BCMC); + } + + /* Undo broad registration
[PATCH 2/2][2.6.24] ehea: Reworked rcv queue handling to log only fatal errors
Prevent driver from brawly logging packet checksum errors. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h |2 +- drivers/net/ehea/ehea_main.c | 11 +-- drivers/net/ehea/ehea_qmr.h |4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 5935899..ea67615 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -40,7 +40,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0082 +#define DRV_VERSIONEHEA_0083 /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index d2f715d..869e160 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -410,11 +410,6 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq, if (cqe-status EHEA_CQE_STAT_ERR_CRC) pr-p_stats.err_frame_crc++; - if (netif_msg_rx_err(pr-port)) { - ehea_error(CQE Error for QP %d, pr-qp-init_attr.qp_nr); - ehea_dump(cqe, sizeof(*cqe), CQE); - } - if (rq == 2) { *processed_rq2 += 1; skb = get_skb_by_index(pr-rq2_skba.arr, pr-rq2_skba.len, cqe); @@ -426,7 +421,11 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq, } if (cqe-status EHEA_CQE_STAT_FAT_ERR_MASK) { - ehea_error(Critical receive error. Resetting port.); + if (netif_msg_rx_err(pr-port)) { + ehea_error(Critical receive error for QP %d. + Resetting port., pr-qp-init_attr.qp_nr); + ehea_dump(cqe, sizeof(*cqe), CQE); + } schedule_work(pr-port-reset_task); return 1; } diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h index 562de0e..bc62d38 100644 --- a/drivers/net/ehea/ehea_qmr.h +++ b/drivers/net/ehea/ehea_qmr.h @@ -145,8 +145,8 @@ struct ehea_rwqe { #define EHEA_CQE_VLAN_TAG_XTRACT 0x0400 #define EHEA_CQE_TYPE_RQ 0x60 -#define EHEA_CQE_STAT_ERR_MASK 0x720F -#define EHEA_CQE_STAT_FAT_ERR_MASK 0x1F +#define EHEA_CQE_STAT_ERR_MASK 0x700F +#define EHEA_CQE_STAT_FAT_ERR_MASK 0xF #define EHEA_CQE_STAT_ERR_TCP 0x4000 #define EHEA_CQE_STAT_ERR_IP 0x2000 #define EHEA_CQE_STAT_ERR_CRC 0x1000 -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2][2.6.24] ehea: Improve tx packets counting
Using own tx_packets counter instead of firmware counters. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h |2 +- drivers/net/ehea/ehea_main.c |9 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index f78e5bf..5935899 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -40,7 +40,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0080 +#define DRV_VERSIONEHEA_0082 /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index f0319f1..d2f715d 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -136,7 +136,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev) struct ehea_port *port = netdev_priv(dev); struct net_device_stats *stats = port-stats; struct hcp_ehea_port_cb2 *cb2; - u64 hret, rx_packets; + u64 hret, rx_packets, tx_packets; int i; memset(stats, 0, sizeof(*stats)); @@ -162,7 +162,11 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev) for (i = 0; i port-num_def_qps; i++) rx_packets += port-port_res[i].rx_packets; - stats-tx_packets = cb2-txucp + cb2-txmcp + cb2-txbcp; + tx_packets = 0; + for (i = 0; i port-num_def_qps + port-num_add_tx_qps; i++) + tx_packets += port-port_res[i].tx_packets; + + stats-tx_packets = tx_packets; stats-multicast = cb2-rxmcp; stats-rx_errors = cb2-rxuerr; stats-rx_bytes = cb2-rxo; @@ -2000,6 +2004,7 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev) } ehea_post_swqe(pr-qp, swqe); + pr-tx_packets++; if (unlikely(atomic_read(pr-swqe_avail) = 1)) { spin_lock_irqsave(pr-netif_queue, flags); -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ehea: Add kdump support
To support ehea driver reloading in a kdump kernel the driver has to perform firmware handle deregistrations when the original kernel crashes. As there's currently no notifier chain for machine crashes this patch enables kdump support in the ehea driver by bending the ppc_md.machine_crash_shutdown hook to its own machine crash handler. The original machine_crash_shutdown() fn is called afterwards. This works fine as long as the ehea driver is the only one which does so. Problems may occur if other drivers do the same and unload regularly. This patch enables 2.6.24-rc2 to use kdump with ehea and only puts a very low risk on base kernel. In 2.6.24 we know ehea is the only user of this mechanism. The next step for 2.6.25 would be to add a proper notifier chain. The full solution might be that register_reboot_notifier() provides sth like a SYS_CRASH action. Please apply. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h |2 +- drivers/net/ehea/ehea_main.c | 28 2 files changed, 29 insertions(+), 1 deletions(-) diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index f78e5bf..5935899 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -40,7 +40,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0080 +#define DRV_VERSIONEHEA_0081 /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index f0319f1..40a732e 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -37,6 +37,7 @@ #include linux/reboot.h #include net/ip.h +#include asm-powerpc/machdep.h #include ehea.h #include ehea_qmr.h @@ -98,6 +99,7 @@ static int port_name_cnt = 0; static LIST_HEAD(adapter_list); u64 ehea_driver_flags = 0; struct work_struct ehea_rereg_mr_task; +static void (*orig_machine_crash_shutdown)(struct pt_regs *regs); struct semaphore dlpar_mem_lock; @@ -3312,6 +3314,29 @@ static struct notifier_block ehea_reboot_nb = { .notifier_call = ehea_reboot_notifier, }; +void ehea_crash_notifier(struct pt_regs *regs) +{ + ehea_info(Machine crash: freeing all eHEA resources); + ibmebus_unregister_driver(ehea_driver); + orig_machine_crash_shutdown(regs); +} + +void ehea_register_crash_notifier(void) +{ +#ifdef CONFIG_KEXEC + orig_machine_crash_shutdown = + (void*)__xchg_u64((unsigned long*)ppc_md.machine_crash_shutdown, +(unsigned long)ehea_crash_notifier); +#endif +} + +void ehea_unregister_crash_notifier(void) +{ +#ifdef CONFIG_KEXEC + ppc_md.machine_crash_shutdown = orig_machine_crash_shutdown; +#endif +} + static int check_module_parm(void) { int ret = 0; @@ -3369,6 +3394,7 @@ int __init ehea_module_init(void) goto out; register_reboot_notifier(ehea_reboot_nb); + ehea_register_crash_notifier(); ret = ibmebus_register_driver(ehea_driver); if (ret) { @@ -3382,6 +3408,7 @@ int __init ehea_module_init(void) ehea_error(failed to register capabilities attribute, ret=%d, ret); unregister_reboot_notifier(ehea_reboot_nb); + ehea_unregister_crash_notifier(); ibmebus_unregister_driver(ehea_driver); goto out; } @@ -3396,6 +3423,7 @@ static void __exit ehea_module_exit(void) driver_remove_file(ehea_driver.driver, driver_attr_capabilities); ibmebus_unregister_driver(ehea_driver); unregister_reboot_notifier(ehea_reboot_nb); + ehea_unregister_crash_notifier(); ehea_destroy_busmap(); } -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND][PATCH 1/3] ehea: Fix workqueue handling
Fix: Workqueue ehea_driver_wq was not destroyed Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h |2 +- drivers/net/ehea/ehea_main.c |1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 8ee2c2c..d67f97b 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0072 +#define DRV_VERSIONEHEA_0073 /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 58702f5..d43ab0f 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -3099,6 +3099,7 @@ out: static void __exit ehea_module_exit(void) { + destroy_workqueue(ehea_driver_wq); driver_remove_file(ehea_driver.driver, driver_attr_capabilities); ibmebus_unregister_driver(ehea_driver); ehea_destroy_busmap(); -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND][PATCH 2/3] ehea: Simplify resource usage check
Use shorter method to determine whether adapter has configured ports Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c | 18 ++ 1 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index d43ab0f..36ca322 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -2165,24 +2165,18 @@ static int ehea_clean_all_portres(struct ehea_port *port) return ret; } -static void ehea_remove_adapter_mr (struct ehea_adapter *adapter) +static void ehea_remove_adapter_mr(struct ehea_adapter *adapter) { - int i; - - for (i=0; i EHEA_MAX_PORTS; i++) - if (adapter-port[i]) - return; + if (adapter-active_ports) + return; ehea_rem_mr(adapter-mr); } -static int ehea_add_adapter_mr (struct ehea_adapter *adapter) +static int ehea_add_adapter_mr(struct ehea_adapter *adapter) { - int i; - - for (i=0; i EHEA_MAX_PORTS; i++) - if (adapter-port[i]) - return 0; + if (adapter-active_ports) + return 0; return ehea_reg_kernel_mr(adapter, adapter-mr); } -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND][PATCH 3/3] ehea: Eliminated some compiler warnings
Fixed wrongly casted pointers Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c | 25 ++--- 1 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 36ca322..9756211 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -1326,7 +1326,6 @@ static void write_swqe2_TSO(struct sk_buff *skb, u8 *imm_data = swqe-u.immdata_desc.immediate_data[0]; int skb_data_size = skb-len - skb-data_len; int headersize; - u64 tmp_addr; /* Packet is TCP with TSO enabled */ swqe-tx_control |= EHEA_SWQE_TSO; @@ -1347,9 +1346,8 @@ static void write_swqe2_TSO(struct sk_buff *skb, /* set sg1entry data */ sg1entry-l_key = lkey; sg1entry-len = skb_data_size - headersize; - - tmp_addr = (u64)(skb-data + headersize); - sg1entry-vaddr = ehea_map_vaddr(tmp_addr); + sg1entry-vaddr = + ehea_map_vaddr(skb-data + headersize); swqe-descriptors++; } } else @@ -1362,7 +1360,6 @@ static void write_swqe2_nonTSO(struct sk_buff *skb, int skb_data_size = skb-len - skb-data_len; u8 *imm_data = swqe-u.immdata_desc.immediate_data[0]; struct ehea_vsgentry *sg1entry = swqe-u.immdata_desc.sg_entry; - u64 tmp_addr; /* Packet is any nonTSO type * @@ -1379,8 +1376,8 @@ static void write_swqe2_nonTSO(struct sk_buff *skb, /* copy sg1entry data */ sg1entry-l_key = lkey; sg1entry-len = skb_data_size - SWQE2_MAX_IMM; - tmp_addr = (u64)(skb-data + SWQE2_MAX_IMM); - sg1entry-vaddr = ehea_map_vaddr(tmp_addr); + sg1entry-vaddr = + ehea_map_vaddr(skb-data + SWQE2_MAX_IMM); swqe-descriptors++; } } else { @@ -1395,7 +1392,6 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, struct ehea_vsgentry *sg_list, *sg1entry, *sgentry; skb_frag_t *frag; int nfrags, sg1entry_contains_frag_data, i; - u64 tmp_addr; nfrags = skb_shinfo(skb)-nr_frags; sg1entry = swqe-u.immdata_desc.sg_entry; @@ -1417,9 +1413,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, /* copy sg1entry data */ sg1entry-l_key = lkey; sg1entry-len = frag-size; - tmp_addr = (u64)(page_address(frag-page) - + frag-page_offset); - sg1entry-vaddr = ehea_map_vaddr(tmp_addr); + sg1entry-vaddr = + ehea_map_vaddr(page_address(frag-page) + + frag-page_offset); swqe-descriptors++; sg1entry_contains_frag_data = 1; } @@ -1431,10 +1427,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, sgentry-l_key = lkey; sgentry-len = frag-size; - - tmp_addr = (u64)(page_address(frag-page) -+ frag-page_offset); - sgentry-vaddr = ehea_map_vaddr(tmp_addr); + sgentry-vaddr = + ehea_map_vaddr(page_address(frag-page) + + frag-page_offset); swqe-descriptors++; } } -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] ehea: Fix workqueue handling
Fix: Workqueue ehea_driver_wq was not destroyed Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h |2 +- drivers/net/ehea/ehea_main.c |1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 8ee2c2c..d67f97b 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0072 +#define DRV_VERSIONEHEA_0073 /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 58702f5..d43ab0f 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -3099,6 +3099,7 @@ out: static void __exit ehea_module_exit(void) { + destroy_workqueue(ehea_driver_wq); driver_remove_file(ehea_driver.driver, driver_attr_capabilities); ibmebus_unregister_driver(ehea_driver); ehea_destroy_busmap(); -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] ehea: Simplify resource usage check
Use shorter method to determine whether adapter has configured ports Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c | 18 ++ 1 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index d43ab0f..36ca322 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -2165,24 +2165,18 @@ static int ehea_clean_all_portres(struct ehea_port *port) return ret; } -static void ehea_remove_adapter_mr (struct ehea_adapter *adapter) +static void ehea_remove_adapter_mr(struct ehea_adapter *adapter) { - int i; - - for (i=0; i EHEA_MAX_PORTS; i++) - if (adapter-port[i]) - return; + if (adapter-active_ports) + return; ehea_rem_mr(adapter-mr); } -static int ehea_add_adapter_mr (struct ehea_adapter *adapter) +static int ehea_add_adapter_mr(struct ehea_adapter *adapter) { - int i; - - for (i=0; i EHEA_MAX_PORTS; i++) - if (adapter-port[i]) - return 0; + if (adapter-active_ports) + return 0; return ehea_reg_kernel_mr(adapter, adapter-mr); } -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] ehea: Eliminated some compiler warnings
Fixed wrongly casted pointers Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c | 25 ++--- 1 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 36ca322..9756211 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -1326,7 +1326,6 @@ static void write_swqe2_TSO(struct sk_buff *skb, u8 *imm_data = swqe-u.immdata_desc.immediate_data[0]; int skb_data_size = skb-len - skb-data_len; int headersize; - u64 tmp_addr; /* Packet is TCP with TSO enabled */ swqe-tx_control |= EHEA_SWQE_TSO; @@ -1347,9 +1346,8 @@ static void write_swqe2_TSO(struct sk_buff *skb, /* set sg1entry data */ sg1entry-l_key = lkey; sg1entry-len = skb_data_size - headersize; - - tmp_addr = (u64)(skb-data + headersize); - sg1entry-vaddr = ehea_map_vaddr(tmp_addr); + sg1entry-vaddr = + ehea_map_vaddr(skb-data + headersize); swqe-descriptors++; } } else @@ -1362,7 +1360,6 @@ static void write_swqe2_nonTSO(struct sk_buff *skb, int skb_data_size = skb-len - skb-data_len; u8 *imm_data = swqe-u.immdata_desc.immediate_data[0]; struct ehea_vsgentry *sg1entry = swqe-u.immdata_desc.sg_entry; - u64 tmp_addr; /* Packet is any nonTSO type * @@ -1379,8 +1376,8 @@ static void write_swqe2_nonTSO(struct sk_buff *skb, /* copy sg1entry data */ sg1entry-l_key = lkey; sg1entry-len = skb_data_size - SWQE2_MAX_IMM; - tmp_addr = (u64)(skb-data + SWQE2_MAX_IMM); - sg1entry-vaddr = ehea_map_vaddr(tmp_addr); + sg1entry-vaddr = + ehea_map_vaddr(skb-data + SWQE2_MAX_IMM); swqe-descriptors++; } } else { @@ -1395,7 +1392,6 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, struct ehea_vsgentry *sg_list, *sg1entry, *sgentry; skb_frag_t *frag; int nfrags, sg1entry_contains_frag_data, i; - u64 tmp_addr; nfrags = skb_shinfo(skb)-nr_frags; sg1entry = swqe-u.immdata_desc.sg_entry; @@ -1417,9 +1413,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, /* copy sg1entry data */ sg1entry-l_key = lkey; sg1entry-len = frag-size; - tmp_addr = (u64)(page_address(frag-page) - + frag-page_offset); - sg1entry-vaddr = ehea_map_vaddr(tmp_addr); + sg1entry-vaddr = + ehea_map_vaddr(page_address(frag-page) + + frag-page_offset); swqe-descriptors++; sg1entry_contains_frag_data = 1; } @@ -1431,10 +1427,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, sgentry-l_key = lkey; sgentry-len = frag-size; - - tmp_addr = (u64)(page_address(frag-page) -+ frag-page_offset); - sgentry-vaddr = ehea_map_vaddr(tmp_addr); + sgentry-vaddr = + ehea_map_vaddr(page_address(frag-page) + + frag-page_offset); swqe-descriptors++; } } -- 1.5.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Possible eHEA performance issue
Michael Neuling wrote: From ehea_start_xmit in ehea_main.c we have: if (unlikely(atomic_read(pr-swqe_avail) = 1)) { spin_lock_irqsave(pr-netif_queue, flags); if (unlikely(atomic_read(pr-swqe_avail) = 1)) { pr-p_stats.queue_stopped++; netif_stop_queue(dev); pr-queue_stopped = 1; } spin_unlock_irqrestore(pr-netif_queue, flags); } Since the conditions are the same, isn't it likely that the second 'if' is going to be taken. Hence, shouldn't the second 'unlikely' hint be removed or even changed to likely? Either way, some documentation here as to why it's done this way would be useful. I assume the atomic_read is cheap compared to the spin_unlock_irqsave, so we quickly check swqe_avail before we check it again properly with the lock on so we can change some stuff. Mikey Hi Mike, good point the second if could be a likely(). The impact isn't that big because the if statement is true in the unlikely() case that the send queue is full - which doesn't happen often. Anyway we will modify this in one of the next driver versions. Thanks for the hint! Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] eHEA: Fix bonding support
The driver didn't allow an interface's MAC address to be modified if the respective interface wasn't setup - a failing Hcall was the result. Thus bonding wasn't usable. The fix moves the failing Hcall which was registering a MAC address for the reception of BC packets in firmware from the port up and down functions to the port resources setup functions. Additionally the missing update of the last_rx member of the netdev structure was added. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h |2 +- drivers/net/ehea/ehea_main.c | 37 +++-- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 6628fa6..489c8b2 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0070 +#define DRV_VERSIONEHEA_0071 /* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 1d1571c..4c70a93 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -466,6 +466,8 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev, cqe-vlan_tag); else netif_receive_skb(skb); + + dev-last_rx = jiffies; } else { pr-p_stats.poll_receive_errors++; port_reset = ehea_treat_poll_error(pr, rq, cqe, @@ -1433,7 +1435,8 @@ static int ehea_broadcast_reg_helper(struct ehea_port *port, u32 hcallid) port-logical_port_id, reg_type, port-mac_addr, 0, hcallid); if (hret != H_SUCCESS) { - ehea_error(reg_dereg_bcmc failed (tagged)); + ehea_error(%sregistering bc address failed (tagged), + hcallid == H_REG_BCMC ? : de); ret = -EIO; goto out_herr; } @@ -1444,7 +1447,8 @@ static int ehea_broadcast_reg_helper(struct ehea_port *port, u32 hcallid) port-logical_port_id, reg_type, port-mac_addr, 0, hcallid); if (hret != H_SUCCESS) { - ehea_error(reg_dereg_bcmc failed (vlan)); + ehea_error(%sregistering bc address failed (vlan), + hcallid == H_REG_BCMC ? : de); ret = -EIO; } out_herr: @@ -2170,7 +2174,6 @@ static int ehea_up(struct net_device *dev) { int ret, i; struct ehea_port *port = netdev_priv(dev); - u64 mac_addr = 0; if (port-state == EHEA_PORT_UP) return 0; @@ -2189,18 +2192,10 @@ static int ehea_up(struct net_device *dev) goto out_clean_pr; } - ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); - if (ret) { - ret = -EIO; - ehea_error(out_clean_pr); - goto out_clean_pr; - } - mac_addr = (*(u64*)dev-dev_addr) 16; - ret = ehea_reg_interrupts(dev); if (ret) { - ehea_error(out_dereg_bc); - goto out_dereg_bc; + ehea_error(reg_interrupts failed. ret:%d, ret); + goto out_clean_pr; } for(i = 0; i port-num_def_qps + port-num_add_tx_qps; i++) { @@ -2226,9 +2221,6 @@ static int ehea_up(struct net_device *dev) out_free_irqs: ehea_free_interrupts(dev); -out_dereg_bc: - ehea_broadcast_reg_helper(port, H_DEREG_BCMC); - out_clean_pr: ehea_clean_all_portres(port); out: @@ -2273,7 +2265,6 @@ static int ehea_down(struct net_device *dev) port-port_res[i].d_netdev-state)) msleep(1); - ehea_broadcast_reg_helper(port, H_DEREG_BCMC); port-state = EHEA_PORT_DOWN; ret = ehea_clean_all_portres(port); @@ -2655,12 +2646,18 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, INIT_WORK(port-reset_task, ehea_reset_port); + ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); + if (ret) { + ret = -EIO; + goto out_unreg_port; + } + ehea_set_ethtool_ops(dev); ret = register_netdev(dev); if (ret) { ehea_error(register_netdev failed. ret=%d, ret); - goto out_unreg_port; + goto out_dereg_bc; } ret = ehea_get_jumboframe_status(port, jumbo); @@ -2675,6 +2672,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, return port; +out_dereg_bc: + ehea_broadcast_reg_helper(port, H_DEREG_BCMC); + out_unreg_port: ehea_unregister_port(port); @@ -2694,6 +2694,7 @@ static void
[PATCH 1/1] eHEA: Introducing support vor DLPAR memory add
This patch adds support for DLPAR memory add to the eHEA driver. To detect whether memory was added the driver uses its own memory mapping table and checks for kernel addresses whether they're located in already known memory sections. If not the function ehea_rereg_mrs() is triggered which performs a rebuild of the mapping table and a re-registration of the global memory region. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h | 23 +-- drivers/net/ehea/ehea_main.c | 144 +++ drivers/net/ehea/ehea_phyp.h |3 + drivers/net/ehea/ehea_qmr.c | 156 ++ drivers/net/ehea/ehea_qmr.h | 14 +++- 5 files changed, 275 insertions(+), 65 deletions(-) diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index f03f070..6628fa6 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -39,13 +39,13 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0067 +#define DRV_VERSIONEHEA_0070 -/* EHEA capability flags */ +/* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1 -#define DLPAR_MEM_ADD 2 -#define DLPAR_MEM_REM 4 -#define EHEA_CAPABILITIES (DLPAR_PORT_ADD_REM) +#define DLPAR_MEM_ADD 2 +#define DLPAR_MEM_REM 4 +#define EHEA_CAPABILITIES (DLPAR_PORT_ADD_REM) #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) @@ -113,6 +113,8 @@ /* Memory Regions */ #define EHEA_MR_ACC_CTRL 0x0080 +#define EHEA_BUSMAP_START 0x8000ULL + #define EHEA_WATCH_DOG_TIMEOUT 10*HZ /* utility functions */ @@ -186,6 +188,12 @@ struct h_epas { set to 0 if unused */ }; +struct ehea_busmap { + unsigned int entries; /* total number of entries */ + unsigned int valid_sections;/* number of valid sections */ + u64 *vaddr; +}; + struct ehea_qp; struct ehea_cq; struct ehea_eq; @@ -382,6 +390,8 @@ struct ehea_adapter { struct ehea_mr mr; u32 pd;/* protection domain */ u64 max_mc_mac;/* max number of multicast mac addresses */ + int active_ports; + struct list_head list; }; @@ -431,6 +441,9 @@ struct port_res_cfg { int max_entries_rq3; }; +enum ehea_flag_bits { + __EHEA_STOP_XFER +}; void ehea_set_ethtool_ops(struct net_device *netdev); int ehea_sense_port_attr(struct ehea_port *port); diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 383144d..1d1571c 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -79,6 +79,11 @@ MODULE_PARM_DESC(sq_entries, Number of entries for the Send Queue MODULE_PARM_DESC(use_mcs, 0:NAPI, 1:Multiple receive queues, Default = 1 ); static int port_name_cnt = 0; +static LIST_HEAD(adapter_list); +u64 ehea_driver_flags = 0; +struct workqueue_struct *ehea_driver_wq; +struct work_struct ehea_rereg_mr_task; + static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, const struct of_device_id *id); @@ -238,13 +243,17 @@ static int ehea_refill_rq_def(struct ehea_port_res *pr, rwqe-wr_id = EHEA_BMASK_SET(EHEA_WR_ID_TYPE, wqe_type) | EHEA_BMASK_SET(EHEA_WR_ID_INDEX, index); rwqe-sg_list[0].l_key = pr-recv_mr.lkey; - rwqe-sg_list[0].vaddr = (u64)skb-data; + rwqe-sg_list[0].vaddr = ehea_map_vaddr(skb-data); rwqe-sg_list[0].len = packet_size; rwqe-data_segments = 1; index++; index = max_index_mask; + + if (unlikely(test_bit(__EHEA_STOP_XFER, ehea_driver_flags))) + goto out; } + q_skba-index = index; /* Ring doorbell */ @@ -253,7 +262,7 @@ static int ehea_refill_rq_def(struct ehea_port_res *pr, ehea_update_rq2a(pr-qp, i); else ehea_update_rq3a(pr-qp, i); - +out: return ret; } @@ -1321,7 +1330,7 @@ static void write_swqe2_TSO(struct sk_buff *skb, sg1entry-len = skb_data_size - headersize; tmp_addr = (u64)(skb-data + headersize); - sg1entry-vaddr = tmp_addr; + sg1entry-vaddr = ehea_map_vaddr(tmp_addr); swqe-descriptors++; } } else @@ -1352,7 +1361,7 @@ static void write_swqe2_nonTSO(struct sk_buff *skb, sg1entry-l_key = lkey; sg1entry-len = skb_data_size - SWQE2_MAX_IMM; tmp_addr = (u64)(skb-data + SWQE2_MAX_IMM); - sg1entry-vaddr = tmp_addr; + sg1entry-vaddr = ehea_map_vaddr(tmp_addr); swqe-descriptors++; } } else
[PATCH 2.6.22-rc4] ehea: Fixed possible kernel panic on VLAN packet recv
This patch fixes a possible kernel panic due to not checking the vlan group when processing received VLAN packets and a malfunction in VLAN/hypervisor registration. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- diff -Nurp -X dontdiff linux-2.6.22-rc4/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.22-rc4/drivers/net/ehea/ehea.h2007-06-05 02:57:25.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-06-06 12:53:58.0 +0200 @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0061 +#define DRV_VERSIONEHEA_0064 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) diff -Nurp -X dontdiff linux-2.6.22-rc4/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.22-rc4/drivers/net/ehea/ehea_main.c 2007-06-05 02:57:25.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-06-06 12:53:58.0 +0200 @@ -451,7 +451,8 @@ static struct ehea_cqe *ehea_proc_rwqes( processed_rq3++; } - if (cqe-status EHEA_CQE_VLAN_TAG_XTRACT) + if ((cqe-status EHEA_CQE_VLAN_TAG_XTRACT) +port-vgrp) vlan_hwaccel_receive_skb(skb, port-vgrp, cqe-vlan_tag); else @@ -1910,10 +1911,7 @@ static void ehea_vlan_rx_register(struct goto out; } - if (grp) - memset(cb1-vlan_filter, 0, sizeof(cb1-vlan_filter)); - else - memset(cb1-vlan_filter, 0xFF, sizeof(cb1-vlan_filter)); + memset(cb1-vlan_filter, 0, sizeof(cb1-vlan_filter)); hret = ehea_h_modify_ehea_port(adapter-handle, port-logical_port_id, H_PORT_CB1, H_PORT_CB1_ALL, cb1); @@ -1947,7 +1945,7 @@ static void ehea_vlan_rx_add_vid(struct } index = (vid / 64); - cb1-vlan_filter[index] |= ((u64)(1 (vid 0x3F))); + cb1-vlan_filter[index] |= ((u64)(0x8000 (vid 0x3F))); hret = ehea_h_modify_ehea_port(adapter-handle, port-logical_port_id, H_PORT_CB1, H_PORT_CB1_ALL, cb1); @@ -1982,7 +1980,7 @@ static void ehea_vlan_rx_kill_vid(struct } index = (vid / 64); - cb1-vlan_filter[index] = ~((u64)(1 (vid 0x3F))); + cb1-vlan_filter[index] = ~((u64)(0x8000 (vid 0x3F))); hret = ehea_h_modify_ehea_port(adapter-handle, port-logical_port_id, H_PORT_CB1, H_PORT_CB1_ALL, cb1); - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] ehea: Whitespace cleanup
This patch fixes several whitespace issues. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- diff -Nurp -X dontdiff linux-2.6.22-rc3/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.22-rc3/drivers/net/ehea/ehea.h2007-05-30 12:13:36.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-05-30 12:27:13.0 +0200 @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0061 +#define DRV_VERSIONEHEA_0062 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) @@ -136,10 +136,10 @@ void ehea_dump(void *adr, int len, char (0xULL ((64 - (mask)) 0x)) #define EHEA_BMASK_SET(mask, value) \ -((EHEA_BMASK_MASK(mask) ((u64)(value))) EHEA_BMASK_SHIFTPOS(mask)) + ((EHEA_BMASK_MASK(mask) ((u64)(value))) EHEA_BMASK_SHIFTPOS(mask)) #define EHEA_BMASK_GET(mask, value) \ -(EHEA_BMASK_MASK(mask) (((u64)(value)) EHEA_BMASK_SHIFTPOS(mask))) + (EHEA_BMASK_MASK(mask) (((u64)(value)) EHEA_BMASK_SHIFTPOS(mask))) /* * Generic ehea page @@ -190,7 +190,7 @@ struct ehea_av; * Queue attributes passed to ehea_create_qp() */ struct ehea_qp_init_attr { -/* input parameter */ + /* input parameter */ u32 qp_token; /* queue token */ u8 low_lat_rq1; u8 signalingtype; /* cqe generation flag */ @@ -212,7 +212,7 @@ struct ehea_qp_init_attr { u64 recv_cq_handle; u64 aff_eq_handle; -/* output parameter */ + /* output parameter */ u32 qp_nr; u16 act_nr_send_wqes; u16 act_nr_rwqes_rq1; @@ -279,12 +279,12 @@ struct ehea_qp { * Completion Queue attributes */ struct ehea_cq_attr { -/* input parameter */ + /* input parameter */ u32 max_nr_of_cqes; u32 cq_token; u64 eq_handle; -/* output parameter */ + /* output parameter */ u32 act_nr_of_cqes; u32 nr_pages; }; diff -Nurp -X dontdiff linux-2.6.22-rc3/drivers/net/ehea/ehea_hw.h patched_kernel/drivers/net/ehea/ehea_hw.h --- linux-2.6.22-rc3/drivers/net/ehea/ehea_hw.h 2007-05-26 04:55:14.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea_hw.h 2007-05-30 12:27:13.0 +0200 @@ -211,34 +211,34 @@ static inline void epa_store_acc(struct } #define epa_store_eq(epa, offset, value)\ -epa_store(epa, EQTEMM_OFFSET(offset), value) + epa_store(epa, EQTEMM_OFFSET(offset), value) #define epa_load_eq(epa, offset)\ -epa_load(epa, EQTEMM_OFFSET(offset)) + epa_load(epa, EQTEMM_OFFSET(offset)) #define epa_store_cq(epa, offset, value)\ -epa_store(epa, CQTEMM_OFFSET(offset), value) + epa_store(epa, CQTEMM_OFFSET(offset), value) #define epa_load_cq(epa, offset)\ -epa_load(epa, CQTEMM_OFFSET(offset)) + epa_load(epa, CQTEMM_OFFSET(offset)) #define epa_store_qp(epa, offset, value)\ -epa_store(epa, QPTEMM_OFFSET(offset), value) + epa_store(epa, QPTEMM_OFFSET(offset), value) #define epa_load_qp(epa, offset)\ -epa_load(epa, QPTEMM_OFFSET(offset)) + epa_load(epa, QPTEMM_OFFSET(offset)) #define epa_store_qped(epa, offset, value)\ -epa_store(epa, QPEDMM_OFFSET(offset), value) + epa_store(epa, QPEDMM_OFFSET(offset), value) #define epa_load_qped(epa, offset)\ -epa_load(epa, QPEDMM_OFFSET(offset)) + epa_load(epa, QPEDMM_OFFSET(offset)) #define epa_store_mrmw(epa, offset, value)\ -epa_store(epa, MRMWMM_OFFSET(offset), value) + epa_store(epa, MRMWMM_OFFSET(offset), value) #define epa_load_mrmw(epa, offset)\ -epa_load(epa, MRMWMM_OFFSET(offset)) + epa_load(epa, MRMWMM_OFFSET(offset)) #define epa_store_base(epa, offset, value)\ -epa_store(epa, HCAGR_OFFSET(offset), value) + epa_store(epa, HCAGR_OFFSET(offset), value) #define epa_load_base(epa, offset)\ -epa_load(epa, HCAGR_OFFSET(offset)) + epa_load(epa, HCAGR_OFFSET(offset)) static inline void ehea_update_sqa(struct ehea_qp *qp, u16 nr_wqes) { diff -Nurp -X dontdiff linux-2.6.22-rc3/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.22-rc3/drivers/net/ehea/ehea_main.c 2007-05-30 12:13:36.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-05-30 12:27:13.0 +0200 @@ -81,7 +81,7 @@ MODULE_PARM_DESC(use_mcs, 0:NAPI, 1:Mu static int port_name_cnt = 0; static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, -const struct of_device_id *id); + const struct of_device_id *id); static int __devexit ehea_remove(struct ibmebus_dev *dev); @@ -236,7 +236,7 @@ static int ehea_refill_rq_def(struct ehe rwqe = ehea_get_next_rwqe(qp, rq_nr); rwqe-wr_id = EHEA_BMASK_SET(EHEA_WR_ID_TYPE
[PATCH 2/2] ehea: Receive SKB Aggregation
After there were no technical concerns about this patch I'm resending it with all whitespace issues fixed which were mentioned by Stephen Rothwell. This patch enables the receive side processing to aggregate TCP packets within the HEA device driver. It analyses the packets already received after an interrupt arrived and forwards these as chains of SKBs for the same TCP connection with modified header field. We have seen a lower CPU load and improved throughput for small numbers of parallel TCP connections. We added a disabled module parameter to prevent disruption of normal driver operation. We currently consider this as experimental until further review and tests have been passed. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- diff -Nurp -X dontdiff linux-2.6.22-rc3/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.22-rc3/drivers/net/ehea/ehea.h2007-05-30 13:25:43.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-05-30 13:28:16.0 +0200 @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0062 +#define DRV_VERSIONEHEA_0063 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) @@ -49,6 +49,7 @@ #define EHEA_MAX_ENTRIES_RQ3 16383 #define EHEA_MAX_ENTRIES_SQ 32767 #define EHEA_MIN_ENTRIES_QP 127 +#define EHEA_LRO_MAX_PKTS 60 #define EHEA_SMALL_QUEUES #define EHEA_NUM_TX_QP 1 @@ -78,6 +79,9 @@ #define EHEA_RQ2_PKT_SIZE 1522 #define EHEA_L_PKT_SIZE 256/* low latency */ +#define MAX_LRO_DESCRIPTORS 8 +#define LRO_DESC_MASK 0x + /* Send completion signaling */ /* Protection Domain Identifier */ @@ -334,6 +338,29 @@ struct ehea_q_skb_arr { }; /* + * Large Receive Offload (LRO) descriptor for a tcp seesion + */ +struct ehea_lro { + struct sk_buff *parent; + struct sk_buff *last_skb; + struct iphdr *iph; + struct tcphdr *tcph; + + u32 tcp_rcv_tsecr; + u32 tcp_rcv_tsval; + u32 tcp_ack; + u32 tcp_next_seq; + u32 skb_tot_frags_len; + u16 ip_tot_len; + u16 tcp_saw_tstamp; /* timestamps enabled */ + u16 tcp_window; + u16 vlan_tag; + int skb_sg_cnt; /* counts aggregated skbs */ + int vlan_packet; + int active; +}; + +/* * Port resources */ struct ehea_port_res { @@ -362,6 +389,9 @@ struct ehea_port_res { u64 tx_packets; u64 rx_packets; u32 poll_counter; + struct ehea_lro lro[MAX_LRO_DESCRIPTORS]; + u64 lro_desc; + struct port_stats p_state; }; @@ -411,6 +441,7 @@ struct ehea_port { u32 msg_enable; u32 sig_comp_iv; u32 state; + u32 lro_max_aggr; u8 full_duplex; u8 autoneg; u8 num_def_qps; diff -Nurp -X dontdiff linux-2.6.22-rc3/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.22-rc3/drivers/net/ehea/ehea_main.c 2007-05-30 13:25:43.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-05-30 13:28:16.0 +0200 @@ -34,6 +34,7 @@ #include linux/list.h #include linux/if_ether.h #include net/ip.h +#include net/tcp.h #include ehea.h #include ehea_qmr.h @@ -52,6 +53,8 @@ static int rq2_entries = EHEA_DEF_ENTRIE static int rq3_entries = EHEA_DEF_ENTRIES_RQ3; static int sq_entries = EHEA_DEF_ENTRIES_SQ; static int use_mcs = 0; +static int use_lro = 0; +static int lro_max_pkts = EHEA_LRO_MAX_PKTS; static int num_tx_qps = EHEA_NUM_TX_QP; module_param(msg_level, int, 0); @@ -60,6 +63,8 @@ module_param(rq2_entries, int, 0); module_param(rq3_entries, int, 0); module_param(sq_entries, int, 0); module_param(use_mcs, int, 0); +module_param(use_lro, int, 0); +module_param(lro_max_pkts, int, 0); module_param(num_tx_qps, int, 0); MODULE_PARM_DESC(num_tx_qps, Number of TX-QPS); @@ -77,6 +82,9 @@ MODULE_PARM_DESC(sq_entries, Number of [2^x - 1], x = [6..14]. Default = __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) )); MODULE_PARM_DESC(use_mcs, 0:NAPI, 1:Multiple receive queues, Default = 1 ); +MODULE_PARM_DESC(lro_max_pkts, LRO: Max packets to be aggregated. Default = +__MODULE_STRING(EHEA_LRO_MAX_PKTS)); +MODULE_PARM_DESC(use_lro, 1: enable, 0: disable Large Reveive Offload ); static int port_name_cnt = 0; @@ -380,6 +388,282 @@ static int ehea_treat_poll_error(struct return 0; } +static int try_get_ip_tcp_hdr(struct ehea_cqe *cqe, struct sk_buff *skb, + struct iphdr **iph, struct tcphdr **tcph) +{ + int ip_len; + + /* non tcp/udp packets */ + if (!cqe-header_length) + return -1; + + /* non tcp packet */ + *iph = (struct iphdr *)(skb-data); + if ((*iph)-protocol != IPPROTO_TCP) + return -1; + + ip_len = (u8)((*iph)-ihl); + ip_len = 2; + *tcph
[PATCH 2.6.22-rc3] ehea: Fixed multi queue RX bug
Must access the respective queue's dummy netdev instead of the port's netdev. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 602872d..e85a933 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0058 +#define DRV_VERSIONEHEA_0061 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index f6e0cb1..152bb20 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -428,7 +428,7 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev, } skb_copy_to_linear_data(skb, ((char*)cqe) + 64, cqe-num_bytes_transfered - 4); - ehea_fill_skb(dev, skb, cqe); + ehea_fill_skb(port-netdev, skb, cqe); } else if (rq == 2) { /* RQ2 */ skb = get_skb_by_index(skb_arr_rq2, skb_arr_rq2_len, cqe); - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ehea: Receive SKB Aggregation
This patch enables the receive side processing to aggregate TCP packets within the HEA device driver. It analyses the packets already received after a interrupt arrived and forwards these as a chains of SKBs for the same TCP connection with modified header field. We have seen a lower CPU load and improved throughput for small numbers of parallel TCP connections. We added a disabled module parameter to prevent disruption of normal driver operation. We currently consider this as experimental until further review and tests have been passed. Are there any concerns about including this in the mainline driver? Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- diff -Nurp -X dontdiff linux-2.6.22pre/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.22pre/drivers/net/ehea/ehea.h 2007-05-07 15:55:43.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-05-07 16:00:34.0 +0200 @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0058 +#define DRV_VERSIONEHEA_0060 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) @@ -49,6 +49,7 @@ #define EHEA_MAX_ENTRIES_RQ3 16383 #define EHEA_MAX_ENTRIES_SQ 32767 #define EHEA_MIN_ENTRIES_QP 127 +#define EHEA_LRO_MAX_PKTS 60 #define EHEA_SMALL_QUEUES #define EHEA_NUM_TX_QP 1 @@ -78,6 +79,9 @@ #define EHEA_RQ2_PKT_SIZE 1522 #define EHEA_L_PKT_SIZE 256/* low latency */ +#define MAX_LRO_DESCRIPTORS 8 +#define LRO_DESC_MASK 0x + /* Send completion signaling */ /* Protection Domain Identifier */ @@ -334,6 +338,29 @@ struct ehea_q_skb_arr { }; /* + * Large Receive Offload (LRO) descriptor for a tcp seesion + */ +struct ehea_lro { + struct sk_buff *parent; + struct sk_buff *last_skb; +struct iphdr *iph; +struct tcphdr *tcph; + + u32 tcp_rcv_tsecr; + u32 tcp_rcv_tsval; + u32 tcp_ack; + u32 tcp_next_seq; + u32 skb_tot_frags_len; + u16 ip_tot_len; + u16 tcp_saw_tstamp; /* timestamps enabled */ + u16 tcp_window; + u16 vlan_tag; + int skb_sg_cnt; /* counts aggregated skbs */ + int vlan_packet; + int active; +}; + +/* * Port resources */ struct ehea_port_res { @@ -362,6 +389,9 @@ struct ehea_port_res { u64 tx_packets; u64 rx_packets; u32 poll_counter; + struct ehea_lro lro[MAX_LRO_DESCRIPTORS]; + u64 lro_desc; + struct port_stats p_state; }; @@ -411,6 +441,7 @@ struct ehea_port { u32 msg_enable; u32 sig_comp_iv; u32 state; + u32 lro_max_aggr; u8 full_duplex; u8 autoneg; u8 num_def_qps; diff -Nurp -X dontdiff linux-2.6.22pre/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.22pre/drivers/net/ehea/ehea_main.c2007-05-07 15:59:16.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-05-07 16:00:34.0 +0200 @@ -34,6 +34,7 @@ #include linux/list.h #include linux/if_ether.h #include net/ip.h +#include net/tcp.h #include ehea.h #include ehea_qmr.h @@ -52,6 +53,8 @@ static int rq2_entries = EHEA_DEF_ENTRIE static int rq3_entries = EHEA_DEF_ENTRIES_RQ3; static int sq_entries = EHEA_DEF_ENTRIES_SQ; static int use_mcs = 0; +static int use_lro = 0; +static int lro_max_pkts = EHEA_LRO_MAX_PKTS; static int num_tx_qps = EHEA_NUM_TX_QP; module_param(msg_level, int, 0); @@ -60,6 +63,8 @@ module_param(rq2_entries, int, 0); module_param(rq3_entries, int, 0); module_param(sq_entries, int, 0); module_param(use_mcs, int, 0); +module_param(use_lro, int, 0); +module_param(lro_max_pkts, int, 0); module_param(num_tx_qps, int, 0); MODULE_PARM_DESC(num_tx_qps, Number of TX-QPS); @@ -77,6 +82,9 @@ MODULE_PARM_DESC(sq_entries, Number of [2^x - 1], x = [6..14]. Default = __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) )); MODULE_PARM_DESC(use_mcs, 0:NAPI, 1:Multiple receive queues, Default = 1 ); +MODULE_PARM_DESC(lro_max_pkts, LRO: Max packets to be aggregated. Default = +__MODULE_STRING(EHEA_LRO_MAX_PKTS)); +MODULE_PARM_DESC(use_lro, 1: enable, 0: disable Large Reveive Offload ); static int port_name_cnt = 0; @@ -380,6 +388,282 @@ static int ehea_treat_poll_error(struct return 0; } +static int try_get_ip_tcp_hdr(struct ehea_cqe *cqe, struct sk_buff *skb, + struct iphdr **iph, struct tcphdr **tcph) +{ + int ip_len; + +/* non tcp/udp packets */ + if (!cqe-header_length) + return -1; + +/* non tcp packet */ +*iph = (struct iphdr *)(skb-data); + if ((*iph)-protocol != IPPROTO_TCP) + return -1; + +ip_len = (u8)((*iph)-ihl); +ip_len = 2; +*tcph = (struct tcphdr *)(((u64)*iph) + ip_len); + + return 0
[PATCH 1/2] ehea: fix for sysfs entries
Create symbolic link from each logical port to ehea driver Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- This patch applies on top of the netdev upstream branch for 2.6.22 diff -Nurp -X dontdiff linux-2.6.21/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.21/drivers/net/ehea/ehea.h2007-04-26 10:07:59.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-04-26 11:15:25.0 +0200 @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0055 +#define DRV_VERSIONEHEA_0057 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) diff -Nurp -X dontdiff linux-2.6.21/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.21/drivers/net/ehea/ehea_main.c 2007-04-26 10:07:59.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-04-26 11:15:25.0 +0200 @@ -78,6 +78,28 @@ MODULE_PARM_DESC(sq_entries, Number of __MODULE_STRING(EHEA_DEF_ENTRIES_SQ) )); MODULE_PARM_DESC(use_mcs, 0:NAPI, 1:Multiple receive queues, Default = 1 ); +static int port_name_cnt = 0; + +static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, +const struct of_device_id *id); + +static int __devexit ehea_remove(struct ibmebus_dev *dev); + +static struct of_device_id ehea_device_table[] = { + { + .name = lhea, + .compatible = IBM,lhea, + }, + {}, +}; + +static struct ibmebus_driver ehea_driver = { + .name = ehea, + .id_table = ehea_device_table, + .probe = ehea_probe_adapter, + .remove = ehea_remove, +}; + void ehea_dump(void *adr, int len, char *msg) { int x; unsigned char *deb = adr; @@ -2361,6 +2383,34 @@ static void __devinit logical_port_relea of_node_put(port-ofdev.node); } +static int ehea_driver_sysfs_add(struct device *dev, + struct device_driver *driver) +{ + int ret; + + ret = sysfs_create_link(driver-kobj, dev-kobj, + kobject_name(dev-kobj)); + if (ret == 0) { + ret = sysfs_create_link(dev-kobj, driver-kobj, + driver); + if (ret) + sysfs_remove_link(driver-kobj, + kobject_name(dev-kobj)); + } + return ret; +} + +static void ehea_driver_sysfs_remove(struct device *dev, + struct device_driver *driver) +{ + struct device_driver *drv = driver; + + if (drv) { + sysfs_remove_link(drv-kobj, kobject_name(dev-kobj)); + sysfs_remove_link(dev-kobj, driver); + } +} + static struct device *ehea_register_port(struct ehea_port *port, struct device_node *dn) { @@ -2368,8 +2418,9 @@ static struct device *ehea_register_port port-ofdev.node = of_node_get(dn); port-ofdev.dev.parent = port-adapter-ebus_dev-ofdev.dev; + port-ofdev.dev.bus = ibmebus_bus_type; - sprintf(port-ofdev.dev.bus_id, port%d, port-logical_port_id); + sprintf(port-ofdev.dev.bus_id, port%d, port_name_cnt++); port-ofdev.dev.release = logical_port_release; ret = of_device_register(port-ofdev); @@ -2384,8 +2435,16 @@ static struct device *ehea_register_port goto out_unreg_of_dev; } + ret = ehea_driver_sysfs_add(port-ofdev.dev, ehea_driver.driver); + if (ret) { + ehea_error(failed to register sysfs driver link); + goto out_rem_dev_file; + } + return port-ofdev.dev; +out_rem_dev_file: + device_remove_file(port-ofdev.dev, dev_attr_log_port_id); out_unreg_of_dev: of_device_unregister(port-ofdev); out: @@ -2394,6 +2453,7 @@ out: static void ehea_unregister_port(struct ehea_port *port) { + ehea_driver_sysfs_remove(port-ofdev.dev, ehea_driver.driver); device_remove_file(port-ofdev.dev, dev_attr_log_port_id); of_device_unregister(port-ofdev); } @@ -2838,21 +2898,6 @@ static int check_module_parm(void) return ret; } -static struct of_device_id ehea_device_table[] = { - { - .name = lhea, - .compatible = IBM,lhea, - }, - {}, -}; - -static struct ibmebus_driver ehea_driver = { - .name = ehea, - .id_table = ehea_device_table, - .probe = ehea_probe_adapter, - .remove = ehea_remove, -}; - int __init ehea_module_init(void) { int ret; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] ehea: fix for dlpar support
Certain resources may only be allocated when first logical port is available, and must be removed when last logical port has been removed. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- This patch applies on top of the netdev upstream branch for 2.6.22 diff -Nurp -X dontdiff linux-2.6.21/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.21/drivers/net/ehea/ehea.h2007-04-26 11:21:33.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-04-26 11:23:16.0 +0200 @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0057 +#define DRV_VERSIONEHEA_0058 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) diff -Nurp -X dontdiff linux-2.6.21/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.21/drivers/net/ehea/ehea_main.c 2007-04-26 11:21:33.0 +0200 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-04-26 11:23:16.0 +0200 @@ -2130,6 +2130,28 @@ static int ehea_clean_all_portres(struct return ret; } +static void ehea_remove_adapter_mr (struct ehea_adapter *adapter) +{ + int i; + + for (i=0; i EHEA_MAX_PORTS; i++) + if (adapter-port[i]) + return; + + ehea_rem_mr(adapter-mr); +} + +static int ehea_add_adapter_mr (struct ehea_adapter *adapter) +{ + int i; + + for (i=0; i EHEA_MAX_PORTS; i++) + if (adapter-port[i]) + return 0; + + return ehea_reg_kernel_mr(adapter, adapter-mr); +} + static int ehea_up(struct net_device *dev) { int ret, i; @@ -2580,7 +2602,6 @@ static int ehea_setup_ports(struct ehea_ struct device_node *eth_dn = NULL; u32 *dn_log_port_id; - int port_setup_ok = 0; int i = 0; lhea_dn = adapter-ebus_dev-ofdev.node; @@ -2594,6 +2615,12 @@ static int ehea_setup_ports(struct ehea_ continue; } + if (ehea_add_adapter_mr(adapter)) { + ehea_error(creating MR failed); + of_node_put(eth_dn); + return -EIO; + } + adapter-port[i] = ehea_setup_single_port(adapter, *dn_log_port_id, eth_dn); @@ -2601,18 +2628,13 @@ static int ehea_setup_ports(struct ehea_ ehea_info(%s - logical port id #%d, adapter-port[i]-netdev-name, *dn_log_port_id); + else + ehea_remove_adapter_mr(adapter); + i++; }; - /* Check for succesfully set up ports */ - for (i = 0; i EHEA_MAX_PORTS; i++) - if (adapter-port[i]) - port_setup_ok++; - - if (port_setup_ok) - return 0; /* At least some ports are setup correctly */ - - return -EINVAL; + return 0; } static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter, @@ -2664,6 +2686,11 @@ static ssize_t ehea_probe_port(struct de return -EINVAL; } + if (ehea_add_adapter_mr(adapter)) { + ehea_error(creating MR failed); + return -EIO; + } + port = ehea_setup_single_port(adapter, logical_port_id, eth_dn); of_node_put(eth_dn); @@ -2677,8 +2704,10 @@ static ssize_t ehea_probe_port(struct de ehea_info(added %s (logical port id=%d), port-netdev-name, logical_port_id); - } else + } else { + ehea_remove_adapter_mr(adapter); return -EIO; + } return (ssize_t) count; } @@ -2713,6 +2742,8 @@ static ssize_t ehea_remove_port(struct d return -EINVAL; } + ehea_remove_adapter_mr(adapter); + return (ssize_t) count; } @@ -2773,18 +2804,13 @@ static int __devinit ehea_probe_adapter( dev-ofdev.dev.driver_data = adapter; - ret = ehea_reg_kernel_mr(adapter, adapter-mr); - if (ret) { - dev_err(dev-ofdev.dev, reg_mr_adapter failed\n); - goto out_free_ad; - } /* initialize adapter and ports */ /* get adapter properties */ ret = ehea_sense_adapter_attr(adapter); if (ret) { dev_err(dev-ofdev.dev, sense_adapter_attr failed: %d, ret); - goto out_free_res; + goto out_free_ad; } adapter-neq = ehea_create_eq(adapter, @@ -2792,7 +2818,7 @@ static int __devinit ehea_probe_adapter( if (!adapter-neq) { ret = -EIO; dev_err(dev-ofdev.dev, NEQ creation failed); - goto out_free_res; + goto
[PATCH 2.6.20-rc6 1/2] ehea: Fixed wrong jumbo frames status query
This patch fixes the wrong query and logging of the per interface jumbo frames enabled/disabled status. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h |2 +- drivers/net/ehea/ehea_main.c | 30 +++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff -Nurp -X dontdiff linux-2.6.20-rc6/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.20-rc6/drivers/net/ehea/ehea.h2007-01-25 03:19:28.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-01-29 18:32:02.0 +0100 @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0044 +#define DRV_VERSIONEHEA_0045 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) diff -Nurp -X dontdiff linux-2.6.20-rc6/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.20-rc6/drivers/net/ehea/ehea_main.c 2007-01-25 03:19:28.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-01-29 18:32:02.0 +0100 @@ -2316,6 +2316,7 @@ static int ehea_setup_single_port(struct struct ehea_adapter *adapter = port-adapter; struct hcp_ehea_port_cb4 *cb4; u32 *dn_log_port_id; + int jumbo = 0; sema_init(port-port_lock, 1); port-state = EHEA_PORT_DOWN; @@ -2357,13 +2358,25 @@ static int ehea_setup_single_port(struct if (!cb4) { ehea_error(no mem for cb4); } else { - cb4-jumbo_frame = 1; - hret = ehea_h_modify_ehea_port(adapter-handle, - port-logical_port_id, - H_PORT_CB4, H_PORT_CB4_JUMBO, - cb4); - if (hret != H_SUCCESS) { - ehea_info(Jumbo frames not activated); + hret = ehea_h_query_ehea_port(adapter-handle, + port-logical_port_id, + H_PORT_CB4, + H_PORT_CB4_JUMBO, cb4); + + if (hret == H_SUCCESS) { + if (cb4-jumbo_frame) + jumbo = 1; + else { + cb4-jumbo_frame = 1; + hret = ehea_h_modify_ehea_port(adapter-handle, + port- + logical_port_id, + H_PORT_CB4, + H_PORT_CB4_JUMBO, + cb4); + if (hret == H_SUCCESS) + jumbo = 1; + } } kfree(cb4); } @@ -2402,6 +2415,9 @@ static int ehea_setup_single_port(struct goto out_free; } + ehea_info(%s: Jumbo frames are %sabled, dev-name, + jumbo == 1 ? en : dis); + port-netdev = dev; ret = 0; goto out; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.20-rc6 2/2] ehea: Fixed missing tasklet_kill() call
NEQ-Tasklet wasn't killed when module is removed. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c |1 + 1 files changed, 1 insertion(+) diff -Nurp -X dontdiff linux-2.6.20-rc6/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.20-rc6/drivers/net/ehea/ehea_main.c 2007-01-29 15:53:00.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-01-29 15:53:34.0 +0100 @@ -2598,6 +2598,7 @@ static int __devexit ehea_remove(struct destroy_workqueue(adapter-ehea_wq); ibmebus_free_irq(NULL, adapter-neq-attr.ist1, adapter); + tasklet_kill(adapter-neq_tasklet); ehea_destroy_eq(adapter-neq); - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.20-rc5 1/7] ehea: Fixed wrong dereferencation
Not only check the pointer against 0 but also the dereferenced value Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea.h |2 +- drivers/net/ehea/ehea_main.c |6 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff -Nurp -X dontdiff linux-2.6.20-rc5/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h --- linux-2.6.20-rc5/drivers/net/ehea/ehea.h2007-01-12 19:54:26.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea.h 2007-01-19 13:56:41.0 +0100 @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0043 +#define DRV_VERSIONEHEA_0044 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) diff -Nurp -X dontdiff linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c 2007-01-12 19:54:26.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-01-19 13:58:01.0 +0100 @@ -2471,14 +2471,16 @@ static int __devinit ehea_probe(struct i adapter_handle = (u64*)get_property(dev-ofdev.node, ibm,hea-handle, NULL); - if (!adapter_handle) { + if (adapter_handle) + adapter-handle = *adapter_handle; + + if (!adapter-handle) { dev_err(dev-ofdev.dev, failed getting handle for adapter '%s'\n, dev-ofdev.node-full_name); ret = -ENODEV; goto out_free_ad; } - adapter-handle = *adapter_handle; adapter-pd = EHEA_PD_ID; dev-ofdev.dev.driver_data = adapter; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.20-rc5 2/7] ehea: Fixing firmware queue config issue
Fix to use exactly one queue for incoming packets in all firmware configurations Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nurp -X dontdiff linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c 2007-01-19 13:59:07.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-01-19 14:01:38.0 +0100 @@ -998,7 +998,7 @@ static int ehea_configure_port(struct eh | EHEA_BMASK_SET(PXLY_RC_JUMBO_FRAME, 1); for (i = 0; i port-num_def_qps; i++) - cb0-default_qpn_arr[i] = port-port_res[i].qp-init_attr.qp_nr; + cb0-default_qpn_arr[i] = port-port_res[0].qp-init_attr.qp_nr; if (netif_msg_ifup(port)) ehea_dump(cb0, sizeof(*cb0), ehea_configure_port); - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.20-rc5 3/7] ehea: Modified initial autoneg state determination
Logical partitions are not allowed to (try to) set the autonegotiation status. This patch removes the respective function call from the port setup function. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -Nurp -X dontdiff linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c 2007-01-19 14:02:20.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-01-19 14:11:30.0 +0100 @@ -642,6 +642,8 @@ int ehea_sense_port_attr(struct ehea_por break; } + port-autoneg = 1; + /* Number of default QPs */ port-num_def_qps = cb0-num_default_qps; @@ -2334,8 +2336,6 @@ static int ehea_setup_single_port(struct INIT_LIST_HEAD(port-mc_list-list); - ehea_set_portspeed(port, EHEA_SPEED_AUTONEG); - ret = ehea_sense_port_attr(port); if (ret) goto out; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.20-rc5 4/7] ehea: New method to determine number of available ports
Count OFDT nodes to determine the number of available ports instead of using the possibly outdated value from the hypervisor Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c | 15 ++- 1 files changed, 14 insertions(+), 1 deletion(-) diff -Nurp -X dontdiff linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c 2007-01-19 14:12:31.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-01-19 14:15:53.0 +0100 @@ -2269,6 +2269,8 @@ static void ehea_tx_watchdog(struct net_ int ehea_sense_adapter_attr(struct ehea_adapter *adapter) { struct hcp_query_ehea *cb; + struct device_node *lhea_dn = NULL; + struct device_node *eth_dn = NULL; u64 hret; int ret; @@ -2285,7 +2287,18 @@ int ehea_sense_adapter_attr(struct ehea_ goto out_herr; } - adapter-num_ports = cb-num_ports; + /* Determine the number of available logical ports +* by counting the child nodes of the lhea OFDT entry +*/ + adapter-num_ports = 0; + lhea_dn = of_find_node_by_name(lhea_dn, lhea); + do { + eth_dn = of_get_next_child(lhea_dn, eth_dn); + if (eth_dn) + adapter-num_ports++; + } while ( eth_dn ); + of_node_put(lhea_dn); + adapter-max_mc_mac = cb-max_mc_mac - 1; ret = 0; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.20-rc5 5/7] ehea: Improved logging of permission issues
Disabled dump of hcall regs on some permission issues and fixed appropriate misleading logmessages Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c | 16 +++- drivers/net/ehea/ehea_phyp.c | 10 -- 2 files changed, 15 insertions(+), 11 deletions(-) diff -Nurp -X dontdiff linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c 2007-01-19 14:16:35.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-01-19 14:22:42.0 +0100 @@ -730,10 +730,7 @@ int ehea_set_portspeed(struct ehea_port } } else { if (hret == H_AUTHORITY) { - ehea_info(Hypervisor denied setting port speed. Either - this partition is not authorized to set - port speed or another partition has modified - port speed first.); + ehea_info(Hypervisor denied setting port speed); ret = -EPERM; } else { ret = -EIO; @@ -1487,11 +1484,12 @@ out: static void ehea_promiscuous_error(u64 hret, int enable) { - ehea_info(Hypervisor denied %sabling promiscuous mode.%s, - enable == 1 ? en : dis, - hret != H_AUTHORITY ? : Another partition owning a - logical port on the same physical port might have altered - promiscuous mode first.); + if (hret == H_AUTHORITY) + ehea_info(Hypervisor denied %sabling promiscuous mode, + enable == 1 ? en : dis); + else + ehea_error(failed %sabling promiscuous mode, + enable == 1 ? en : dis); } static void ehea_promiscuous(struct net_device *dev, int enable) diff -Nurp -X dontdiff linux-2.6.20-rc5/drivers/net/ehea/ehea_phyp.c patched_kernel/drivers/net/ehea/ehea_phyp.c --- linux-2.6.20-rc5/drivers/net/ehea/ehea_phyp.c 2007-01-12 19:54:26.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_phyp.c 2007-01-19 14:23:31.0 +0100 @@ -94,6 +94,7 @@ static long ehea_plpar_hcall9(unsigned l { long ret; int i, sleep_msecs; + u8 cb_cat; for (i = 0; i 5; i++) { ret = plpar_hcall9(opcode, outs, @@ -106,7 +107,13 @@ static long ehea_plpar_hcall9(unsigned l continue; } - if (ret H_SUCCESS) + cb_cat = EHEA_BMASK_GET(H_MEHEAPORT_CAT, arg2); + + if ((ret H_SUCCESS) !(((ret == H_AUTHORITY) +(opcode == H_MODIFY_HEA_PORT)) +(((cb_cat == H_PORT_CB4) ((arg3 == H_PORT_CB4_JUMBO) + || (arg3 == H_PORT_CB4_SPEED))) || ((cb_cat == H_PORT_CB7) +(arg3 == H_PORT_CB7_DUCQPN) ehea_error(opcode=%lx ret=%lx arg1=%lx arg2=%lx arg3=%lx arg4=%lx arg5=%lx arg6=%lx arg7=%lx arg8=%lx @@ -120,7 +127,6 @@ static long ehea_plpar_hcall9(unsigned l outs[0], outs[1], outs[2], outs[3], outs[4], outs[5], outs[6], outs[7], outs[8]); - return ret; } - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.20-rc5 7/7] ehea: Fixed possible nullpointer access
Fixed possible nullpointer access in event queue processing Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- drivers/net/ehea/ehea_main.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -Nurp -X dontdiff linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c --- linux-2.6.20-rc5/drivers/net/ehea/ehea_main.c 2007-01-19 14:33:04.0 +0100 +++ patched_kernel/drivers/net/ehea/ehea_main.c 2007-01-19 14:36:05.0 +0100 @@ -575,8 +575,9 @@ static struct ehea_port *ehea_get_port(s int i; for (i = 0; i adapter-num_ports; i++) - if (adapter-port[i]-logical_port_id == logical_port) - return adapter-port[i]; + if (adapter-port[i]) + if (adapter-port[i]-logical_port_id == logical_port) + return adapter-port[i]; return NULL; } - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.19-rc4 2/3] ehea: Removed redundant define
Removed define H_CB_ALIGNMENT which is already defined in include/asm-powerpc/hvcall.h Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- diff -Nurp git.netdev-2.6.base/drivers/net/ehea/ehea.h git.netdev-2.6/drivers/net/ehea/ehea.h --- git.netdev-2.6.base/drivers/net/ehea/ehea.h 2006-11-03 14:19:51.0 +0100 +++ git.netdev-2.6/drivers/net/ehea/ehea.h 2006-11-03 14:37:30.0 +0100 @@ -39,7 +39,7 @@ #include asm/io.h #define DRV_NAME ehea -#define DRV_VERSIONEHEA_0034 +#define DRV_VERSIONEHEA_0043 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) @@ -105,9 +105,6 @@ #define EHEA_BCMC_VLANID_ALL 0x01 #define EHEA_BCMC_VLANID_SINGLE0x00 -/* Use this define to kmallocate pHYP control blocks */ -#define H_CB_ALIGNMENT 4096 - #define EHEA_CACHE_LINE 128 /* Memory Regions */ - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.19-rc4 1/3] ehea: Nullpointer dereferencation fix
Fix: Must check for nullpointer before dereferencing it - not afterwards. Signed-off-by: Thomas Klein [EMAIL PROTECTED] --- diff -Nurp git.netdev-2.6.base/drivers/net/ehea/ehea_qmr.c git.netdev-2.6/drivers/net/ehea/ehea_qmr.c --- git.netdev-2.6.base/drivers/net/ehea/ehea_qmr.c 2006-11-03 14:19:51.0 +0100 +++ git.netdev-2.6/drivers/net/ehea/ehea_qmr.c 2006-11-03 14:27:53.0 +0100 @@ -209,11 +209,11 @@ int ehea_destroy_cq(struct ehea_cq *cq) { u64 adapter_handle, hret; - adapter_handle = cq-adapter-handle; - if (!cq) return 0; + adapter_handle = cq-adapter-handle; + /* deregister all previous registered pages */ hret = ehea_h_free_resource(adapter_handle, cq-fw_handle); if (hret != H_SUCCESS) { - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.19-rc4 3/3] ehea: 64K page support fix
This patch fixes 64k page support by using PAGE_MASK and appropriate pagesize defines in several places. Signed-off-by: Thomas Klein [EMAIL PROTECTED] drivers/net/ehea/ehea_ethtool.c |2 +- drivers/net/ehea/ehea_main.c| 26 +- drivers/net/ehea/ehea_phyp.c|2 +- drivers/net/ehea/ehea_phyp.h|6 -- drivers/net/ehea/ehea_qmr.c | 13 +++-- 5 files changed, 26 insertions(+), 23 deletions(-) diff -Nurp git.linux-2.6.base/drivers/net/ehea/ehea_ethtool.c git.linux-2.6/drivers/net/ehea/ehea_ethtool.c --- git.linux-2.6.base/drivers/net/ehea/ehea_ethtool.c 2006-11-03 16:41:36.0 +0100 +++ git.linux-2.6/drivers/net/ehea/ehea_ethtool.c 2006-11-03 12:43:16.0 +0100 @@ -238,7 +238,7 @@ static void ehea_get_ethtool_stats(struc data[i++] = port-port_res[0].swqe_refill_th; data[i++] = port-resets; - cb6 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb6 = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb6) { ehea_error(no mem for cb6); return; diff -Nurp git.linux-2.6.base/drivers/net/ehea/ehea_main.c git.linux-2.6/drivers/net/ehea/ehea_main.c --- git.linux-2.6.base/drivers/net/ehea/ehea_main.c 2006-11-03 16:41:36.0 +0100 +++ git.linux-2.6/drivers/net/ehea/ehea_main.c 2006-11-03 12:43:16.0 +0100 @@ -92,7 +92,7 @@ static struct net_device_stats *ehea_get memset(stats, 0, sizeof(*stats)); - cb2 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb2 = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb2) { ehea_error(no mem for cb2); goto out; @@ -586,8 +586,8 @@ int ehea_sense_port_attr(struct ehea_por u64 hret; struct hcp_ehea_port_cb0 *cb0; - cb0 = kzalloc(H_CB_ALIGNMENT, GFP_ATOMIC); /* May be called via */ - if (!cb0) { /* ehea_neq_tasklet() */ + cb0 = kzalloc(PAGE_SIZE, GFP_ATOMIC); /* May be called via */ + if (!cb0) { /* ehea_neq_tasklet() */ ehea_error(no mem for cb0); ret = -ENOMEM; goto out; @@ -670,7 +670,7 @@ int ehea_set_portspeed(struct ehea_port u64 hret; int ret = 0; - cb4 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb4 = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb4) { ehea_error(no mem for cb4); ret = -ENOMEM; @@ -985,7 +985,7 @@ static int ehea_configure_port(struct eh struct hcp_ehea_port_cb0 *cb0; ret = -ENOMEM; - cb0 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb0) goto out; @@ -1443,7 +1443,7 @@ static int ehea_set_mac_addr(struct net_ goto out; } - cb0 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb0) { ehea_error(no mem for cb0); ret = -ENOMEM; @@ -1501,7 +1501,7 @@ static void ehea_promiscuous(struct net_ if ((enable port-promisc) || (!enable !port-promisc)) return; - cb7 = kzalloc(H_CB_ALIGNMENT, GFP_ATOMIC); + cb7 = kzalloc(PAGE_SIZE, GFP_ATOMIC); if (!cb7) { ehea_error(no mem for cb7); goto out; @@ -1870,7 +1870,7 @@ static void ehea_vlan_rx_register(struct port-vgrp = grp; - cb1 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb1) { ehea_error(no mem for cb1); goto out; @@ -1899,7 +1899,7 @@ static void ehea_vlan_rx_add_vid(struct int index; u64 hret; - cb1 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb1) { ehea_error(no mem for cb1); goto out; @@ -1935,7 +1935,7 @@ static void ehea_vlan_rx_kill_vid(struct if (port-vgrp) port-vgrp-vlan_devices[vid] = NULL; - cb1 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb1) { ehea_error(no mem for cb1); goto out; @@ -1968,7 +1968,7 @@ int ehea_activate_qp(struct ehea_adapter u64 dummy64 = 0; struct hcp_modify_qp_cb0* cb0; - cb0 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb0) { ret = -ENOMEM; goto out; @@ -2269,7 +2269,7 @@ int ehea_sense_adapter_attr(struct ehea_ u64 hret; int ret; - cb = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); + cb = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!cb) { ret = -ENOMEM; goto out; @@ -2340,7 +2340,7 @@ static int ehea_setup_single_port(struct goto out; /* Enable Jumbo frames */ - cb4 = kzalloc
Re: [2.6.19 PATCH 1/7] ehea: interface to network stack
Hi Francois, thanks for your review and your comments. See below our answers. Regards Thomas Francois Romieu wrote: +cb2 = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL); +if (!cb2) { +ehea_error(no mem for cb2); +goto kzalloc_failed; It's better when the label tell what it does than where it comes from. If it's numbered too, one can check them without going back and forth. +stats-tx_packets = cb2-txucp + cb2-txmcp + cb2-txbcp; +stats-multicast = cb2-rxmcp; +stats-rx_errors = cb2-rxuerr; +stats-rx_bytes = cb2-rxo; +stats-tx_bytes = cb2-txo; +stats-rx_packets = rx_packets; + +hcall_failed: +kfree(cb2); Tab was turned into spaces. Fixed. +static inline int ehea_refill_rq1(struct ehea_port_res *pr, int index, Avoid inline ? Inline declaration was removed from this one and several other functions. +for (i = 0; i nr_of_wqes; i++) { +if (!skb_arr_rq1[index]) { +skb_arr_rq1[index] = dev_alloc_skb(EHEA_LL_PKT_SIZE); netdev_alloc_skb ? Agreed done. + +if (!skb_arr_rq1[index]) { +ehea_error(no mem for skb/%d wqes filled, i); +ret = -ENOMEM; The caller does not check the returned value. Agreed. fn returns void now. +if (!skb_arr_rq1[i]) { +ehea_error(no mem for skb/%d skbs filled., i); +ret = -ENOMEM; +goto exit0; s/exit0/out/ Goto target naming was reworked throughout the whole driver and basically uses the style used by Dave M. and Jeff G. in the Tigon3 driver. +static inline int ehea_check_cqe(struct ehea_cqe *cqe, int *rq_num) +{ +*rq_num = (cqe-type EHEA_CQE_TYPE_RQ) 5; +if ((cqe-status EHEA_CQE_STAT_ERR_MASK) == 0) +return 0; +if (((cqe-status EHEA_CQE_STAT_ERR_TCP) != 0) + (cqe-header_length == 0)) on the previous line please. Changed at all occurences. +static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, + int arr_len, + struct ehea_cqe *cqe) +{ +int skb_index = EHEA_BMASK_GET(EHEA_WR_ID_INDEX, cqe-wr_id); +struct sk_buff *skb; +void *pref; +int x; + +x = skb_index + 1; +x = (arr_len - 1); + +pref = (void*)skb_array[x]; Useless cast. Agreed - removed. +if (unlikely(!skb)) { +if (netif_msg_rx_err(port)) +ehea_error(LL rq1: skb=NULL); +skb = dev_alloc_skb(EHEA_LL_PKT_SIZE); Tab/space Fixed. +irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param, struct pt_regs * regs) static ? Agreed. +int ehea_sense_port_attr(struct ehea_port *port) static ? No - used in ehea_ethtool.c +} else { +if (hret == H_AUTHORITY) +{ Misplaced curly brace. Fixed. +ehea_info(Hypervisor denied setting port speed. Either + this partition is not authorized to set + port speed or another partition has modified + port speed first.); +ret = -EPERM; +} else +{ Misplaced curly brace. Fixed. +ret = -EIO; +ehea_error(Failed setting port speed); +} +} +netif_carrier_on(port-netdev); +exit0: +kfree(cb4); cb4 is NULL. Not wrong per se but I'd rather move the label one line down. Agreed. +void ehea_neq_tasklet(unsigned long data) static ? Agreed. +irqreturn_t ehea_interrupt_neq(int irq, void *param, struct pt_regs *regs) static ? Agreed. +{ +struct ehea_adapter *adapter = (struct ehea_adapter*)param; Useless cast. Fixed. +static int ehea_fill_port_res(struct ehea_port_res *pr) +{ +int ret; +struct ehea_qp_init_attr *init_attr = pr-qp-init_attr; + +/* RQ 1 */ +ret = ehea_init_fill_rq1(pr, init_attr-act_nr_rwqes_rq1 + - init_attr-act_nr_rwqes_rq2 + - init_attr-act_nr_rwqes_rq3 - 1); +/* RQ 2 */ Useless comment. Removed. +for (k = 0; k i; k++) { +u32 ist = port-port_res[k].recv_eq-attr.ist1; +ibmebus_free_irq(NULL, ist, port-port_res[k]); +} +goto failure; Poor label (and bloaty release practice too: remove k, reuse i below and more importantly release the things in allocation-reversed order). Somehow I don't get your point concerning the usage of 'k'. We need another iterator as the for loops using 'k' use 'i' as their terminating condition. +} +if
Re: [2.6.19 PATCH 4/7] ehea: ethtool interface
Stephen Hemminger wrote: On Fri, 18 Aug 2006 17:41:26 +0200 Thomas Klein [EMAIL PROTECTED] wrote: Hi Alexey, first of all thanks a lot for the extensive review. Alexey Dobriyan wrote: + u64 hret = H_HARDWARE; Useless assignment here and everywhere. Initializing returncodes to errorstate is a cheap way to prevent accidentally returning (uninitalized) success returncodes which can lead to catastrophic misbehaviour. That is old thinking. Current compilers do live/dead analysis and tell you about this at compile time which is better than relying on default behavior at runtime. Understood. I reworked the returncode handling and removed the unnecessary initializations. Thanks for pointing this out. Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6.19 PATCH 2/7] ehea: pHYP interface
Alexey Dobriyan wrote: On Fri, Aug 18, 2006 at 01:30:21PM +0200, Jan-Bernd Themann wrote: --- linux-2.6.18-rc4-orig/drivers/net/ehea/ehea_phyp.c +++ kernel/drivers/net/ehea/ehea_phyp.c + hret = ehea_h_register_rpage(hcp_adapter_handle, pagesize, queue_type, +eq_handle, log_pageaddr, count); + return hret; Just return ehea_h_register_rpage(...); + hret = ehea_h_register_rpage(hcp_adapter_handle, pagesize, queue_type, +cq_handle, log_pageaddr, count); + return hret; Ditto. + hret = ehea_h_register_rpage(hcp_adapter_handle, pagesize, queue_type, +qp_handle, log_pageaddr, count); + return hret; +} Ditto. Returncode handling was reworked throughout the whole driver. Those assignments were modified according to your suggestion. +static inline int hcp_epas_ctor(struct h_epas *epas, u64 paddr_kernel, + u64 paddr_user) +{ + epas-kernel.fw_handle = (u64) ioremap(paddr_kernel, PAGE_SIZE); + epas-user.fw_handle = paddr_user; + return 0; +} + +static inline int hcp_epas_dtor(struct h_epas *epas) +{ + + if (epas-kernel.fw_handle) + iounmap((void *)epas-kernel.fw_handle); + epas-user.fw_handle = epas-kernel.fw_handle = 0; + return 0; +} Always returns 0; Correct. They're returning void now. Thanks Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6.19 PATCH 4/7] ehea: ethtool interface
Alexey Dobriyan wrote: On Fri, Aug 18, 2006 at 01:33:22PM +0200, Jan-Bernd Themann wrote: --- linux-2.6.18-rc4-orig/drivers/net/ehea/ehea_ethtool.c +++ kernel/drivers/net/ehea/ehea_ethtool.c +{ +strncpy(info-driver, DRV_NAME, sizeof(info-driver) - 1); +strncpy(info-version, DRV_VERSION, sizeof(info-version) - 1); Use strlcpy() to not forget -1 accidently. Done. +static u32 netdev_get_msglevel(struct net_device *dev) +{ +struct ehea_port *port = netdev_priv(dev); +return port-msg_enable; ^^ Something is mis-named here. The kernel requires a structure member of that name. +struct ethtool_ops ehea_ethtool_ops = { +.get_settings = netdev_get_settings, +.get_drvinfo = netdev_get_drvinfo, +.get_msglevel = netdev_get_msglevel, +.set_msglevel = netdev_set_msglevel, +.get_link = ethtool_op_get_link, +.get_tx_csum = ethtool_op_get_tx_csum, Whitespace breakage. Fixed. +.set_settings = NULL, +.nway_reset = NULL, +.get_pauseparam = NULL, +.set_pauseparam = NULL, +.get_rx_csum = NULL, +.set_rx_csum = NULL, +.phys_id = NULL, +.self_test = NULL, +.self_test_count = NULL If you don't use them, don't mention them at all. Compiler will DTRT. Agreed. Assignments removed. Thanks again :-) Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6.19 PATCH 5/7] ehea: main header files
Michael Neuling wrote: +static inline void ehea_update_sqa(struct ehea_qp *qp, u16 nr_wqes) +{ +struct h_epa epa = qp-epas.kernel; +epa_store_acc(epa, QPTEMM_OFFSET(qpx_sqa), + EHEA_BMASK_SET(QPX_SQA_VALUE, nr_wqes)); +} + +static inline void ehea_update_rq3a(struct ehea_qp *qp, u16 nr_wqes) +{ +struct h_epa epa = qp-epas.kernel; +epa_store_acc(epa, QPTEMM_OFFSET(qpx_rq3a), + EHEA_BMASK_SET(QPX_RQ1A_VALUE, nr_wqes)); +} + +static inline void ehea_update_rq2a(struct ehea_qp *qp, u16 nr_wqes) +{ +struct h_epa epa = qp-epas.kernel; +epa_store_acc(epa, QPTEMM_OFFSET(qpx_rq2a), + EHEA_BMASK_SET(QPX_RQ1A_VALUE, nr_wqes)); +} + +static inline void ehea_update_rq1a(struct ehea_qp *qp, u16 nr_wqes) +{ +struct h_epa epa = qp-epas.kernel; +epa_store_acc(epa, QPTEMM_OFFSET(qpx_rq1a), + EHEA_BMASK_SET(QPX_RQ1A_VALUE, nr_wqes)); +} + +static inline void ehea_update_feca(struct ehea_cq *cq, u32 nr_cqes) +{ +struct h_epa epa = cq-epas.kernel; +epa_store_acc(epa, CQTEMM_OFFSET(cqx_feca), + EHEA_BMASK_SET(CQX_FECADDER, nr_cqes)); +} + +static inline void ehea_reset_cq_n1(struct ehea_cq *cq) +{ +struct h_epa epa = cq-epas.kernel; +epa_store_cq(epa, cqx_n1, + EHEA_BMASK_SET(CQX_N1_GENERATE_COMP_EVENT, 1)); +} + +static inline void ehea_reset_cq_ep(struct ehea_cq *my_cq) +{ +struct h_epa epa = my_cq-epas.kernel; +epa_store_acc(epa, CQTEMM_OFFSET(cqx_ep), + EHEA_BMASK_SET(CQX_EP_EVENT_PENDING, 0)); +} These are almost identical... I'm sure most (if not all) could be merged into a single function or #define. Mikey Hi Mikey, I gave it a try: ehea_reset_cq_n1() drops out because it calls epa_store_cq(), not epa_store_acc(). ehea_update_feca() and ehea_reset_cq_ep() require a different input parm as the others and replacing two inline functions by one inline function and two macros doesn't help neither the code nor does it improve readability. Finally we have ehea_update_sqa() and the 3 ehea_update_rqXa() functions which I replaced by an inline function and four macros. See the result below. It think understanding what this does is way more difficult than looking at the four inline functions we had before. Therefore I'd prefer leaving those inline functions as is. Regards Thomas #define ehea_update_sqa(qp, nr_wqes) \ ehea_update_qa(qp, nr_wqes, \ QPTEMM_OFFSET(qpx_sqa), \ EHEA_BMASK_SET(QPX_SQA_VALUE, nr_wqes)); #define ehea_update_rq1a(qp, nr_wqes) \ ehea_update_qa(qp, nr_wqes, \ QPTEMM_OFFSET(qpx_rq1a), \ EHEA_BMASK_SET(QPX_RQ1A_VALUE, nr_wqes)); #define ehea_update_rq2a(qp, nr_wqes) \ ehea_update_qa(qp, nr_wqes, \ QPTEMM_OFFSET(qpx_rq2a), \ EHEA_BMASK_SET(QPX_RQ2A_VALUE, nr_wqes)); #define ehea_update_rq3a(qp, nr_wqes) \ ehea_update_qa(qp, nr_wqes, \ QPTEMM_OFFSET(qpx_rq3a), \ EHEA_BMASK_SET(QPX_RQ3A_VALUE, nr_wqes)); static inline void ehea_update_qa(struct ehea_qp *qp, u16 nr_wqes, u32 offset, u64 value) { struct h_epa epa = qp-epas.kernel; epa_store_acc(epa, offset, value); } - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6.19 PATCH 7/7] ehea: Makefile Kconfig
Alexey Dobriyan wrote: On Fri, Aug 18, 2006 at 01:37:44PM +0200, Jan-Bernd Themann wrote: --- linux-2.6.18-rc4/drivers/net/Kconfig +++ patched_kernel/drivers/net/Kconfig @@ -2277,6 +2277,12 @@ config CHELSIO_T1 To compile this driver as a module, choose M here: the module will be called cxgb. +config EHEA +tristate eHEA Ethernet support +depends on IBMEBUS +---help--- + This driver supports the IBM pSeries ethernet adapter . People usually add the following boilerplate: To compile this driver as a module, choose M here: the module will be called $FOO. Agreed. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6.19 PATCH 1/7] ehea: interface to network stack
Alexey Dobriyan wrote: On Fri, Aug 18, 2006 at 01:29:01PM +0200, Jan-Bernd Themann wrote: --- linux-2.6.18-rc4-orig/drivers/net/ehea/ehea_main.c +++ kernel/drivers/net/ehea/ehea_main.c +static inline int ehea_refill_rq3_def(struct ehea_port_res *pr, int nr_of_wqes) This one looks too big to be inlined as well as other similalry named functions. Agreed. Inlining avoided where possible. +static int ehea_clean_port_res(struct ehea_port *port, struct ehea_port_res *pr) Freeing/deallocating/cleaning functions usually return void. The fact that you always return -EINVAL only reaffirmes my belief. ;-) Fixed. +static inline void write_swqe2_data(struct sk_buff *skb, +struct net_device *dev, +struct ehea_swqe *swqe, +u32 lkey) Way too big. Function split. +static inline void ehea_xmit2(struct sk_buff *skb, + struct net_device *dev, struct ehea_swqe *swqe, + u32 lkey) + +static inline void ehea_xmit3(struct sk_buff *skb, + struct net_device *dev, struct ehea_swqe *swqe) Ditto. These functions are on a performance-critical path and they are called exactly once - so the object's size isn't affected and having them inline seems appropriate to me. +if (grp) +memset(cb1-vlan_filter, 0, sizeof(cb1-vlan_filter)); +else +memset(cb1-vlan_filter, 1, sizeof(cb1-vlan_filter)); Just to be sure, this should be 1 not 0xff? Will be checked. +void ehea_clean_all_port_res(struct ehea_port *port) +{ +int ret; +int i; +for(i = 0; i port-num_def_qps + port-num_tx_qps; i++) +ehea_clean_port_res(port, port-port_res[i]); + +ret = ehea_destroy_eq(port-qp_eq); +} ret is entirely useless. Correct. It's gone. +int __init ehea_module_init(void) static +{ +int ret = -EINVAL; + +printk(IBM eHEA Ethernet Device Driver (Release %s)\n, DRV_VERSION); + +ret = ibmebus_register_driver(ehea_driver); +if (ret) { +ehea_error(failed registering eHEA device driver on ebus); +return -EINVAL; +} + +return 0; +} Pass ret to upper layer. Simplest way is: static int __init ehea_module_init(void) { return ibmebus_register_driver(ehea_driver); } Agreed to pass ret to upper layer, but we want to keep the error message. Code modified accordingly. Regards Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6.19 PATCH 3/7] ehea: queue management
Arjan van de Ven wrote: + queue-queue_length = nr_of_pages * pagesize; + queue-queue_pages = vmalloc(nr_of_pages * sizeof(void *)); wow... is this really so large that it warrants a vmalloc()??? Agreed: Replaced with kmalloc() Regards Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6.19 PATCH 4/7] ehea: ethtool interface
Hi Alexey, first of all thanks a lot for the extensive review. Alexey Dobriyan wrote: + u64 hret = H_HARDWARE; Useless assignment here and everywhere. Initializing returncodes to errorstate is a cheap way to prevent accidentally returning (uninitalized) success returncodes which can lead to catastrophic misbehaviour. +static void netdev_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info) +{ + strncpy(info-driver, DRV_NAME, sizeof(info-driver) - 1); + strncpy(info-version, DRV_VERSION, sizeof(info-version) - 1); Use strlcpy() to not forget -1 accidently. I agree. Kind regards Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/6] ehea: queue management
Anton Blanchard wrote: Hi, --- linux-2.6.18-rc4-orig/drivers/net/ehea/ehea_ethtool.c 1969-12-31 +static void netdev_get_pauseparam(struct net_device *dev, + struct ethtool_pauseparam *pauseparam) +{ + printk(get pauseparam\n); +} There are a number of stubbed out ethtool functions like this. Best not to implement them and allow the upper layers to return a correct error. Anton I agree, stubbs were removed. Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/6] ehea: header files
Anton Blanchard wrote: --- linux-2.6.18-rc4-orig/drivers/net/ehea/ehea.h 1969-12-31 +extern void exit(int); Should be able to remove that prototype :) Anton Indeed :-) It's gone. Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/6] ehea: queue management
Michael Neuling wrote: +static inline u32 map_swqe_size(u8 swqe_enc_size) +{ + return 128 swqe_enc_size; +}^ + | +static inline u32|map_rwqe_size(u8 rwqe_enc_size) +{| + return 128 rwqe_enc_size; ^ +}| | Snap! These are ide|tical... | No, they aren't. -+ Functionally identical. Mikey Agreed. Functions were replaced by a single map_wqe_size() function. Thomas - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/6] ehea: queue management
inline struct ehea_cqe *ehea_poll_rq1(struct ehea_qp *qp, int *wqe_in +static inline void ehea_inc_rq1(struct ehea_qp *qp) +static inline struct ehea_cqe *ehea_poll_cq(struct ehea_cq *my_cq) Can we stick all these functions in the .c and put only the prototypes here? These functions must be inline due to performance considerations and therefore have to stay in the header file. +/* + * linux/drivers/net/ehea/ehea_ethtool.c + * + * eHEA ethernet device driver for IBM eServer System p + * + * (C) Copyright IBM Corp. 2006 + * + * Authors: + * Christoph Raisch [EMAIL PROTECTED] + * Jan-Bernd Themann [EMAIL PROTECTED] + * Heiko-Joerg Schick [EMAIL PROTECTED] + * Thomas Klein [EMAIL PROTECTED] + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +static int netdev_nway_reset(struct net_device *dev) +{ +printk(nway reset\n); +return 0; +} + +static void netdev_get_pauseparam(struct net_device *dev, + struct ethtool_pauseparam *pauseparam) +{ +printk(get pauseparam\n); +} + +static int netdev_set_pauseparam(struct net_device *dev, + struct ethtool_pauseparam *pauseparam) +{ +printk(set pauseparam\n); +return 0; +} + +static u32 netdev_get_rx_csum(struct net_device *dev) +{ +printk(set rx_csum\n); +return 0; +} + +static int netdev_set_rx_csum(struct net_device *dev, u32 value) +{ +printk(set rx_csum\n); +return 0; +} + +static int netdev_self_test_count(struct net_device *dev) +{ +printk(self test count\n); +return 0; +} + +static void netdev_self_test(struct net_device *dev, struct ethtool_test *te st, + u64 *value) +{ +printk(self test\n); +} + +static int netdev_phys_id(struct net_device *dev, u32 value) +{ +printk(physical id\n); +return 0; +} These are yet to be done? Exactly. ___ Linuxppc-dev mailing list [EMAIL PROTECTED] https://ozlabs.org/mailman/listinfo/linuxppc-dev I hope this helps... It helped a lot! Thank you very much :-) - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] ehea: makefile
Sam Ravnborg wrote: On Wed, Aug 09, 2006 at 10:40:20AM +0200, Jan-Bernd Themann wrote: Signed-off-by: Jan-Bernd Themann [EMAIL PROTECTED] drivers/net/ehea/Makefile |7 +++ 1 file changed, 7 insertions(+) --- linux-2.6.18-rc4-orig/drivers/net/ehea/Makefile 1969-12-31 16:00:00.0 -0800 +++ kernel/drivers/net/ehea/Makefile2006-08-08 23:59:38.083467216 -0700 @@ -0,0 +1,7 @@ +# +# Makefile for the eHEA ethernet device driver for IBM eServer System p +# + +ehea_mod-objs = ehea_main.o ehea_phyp.o ehea_qmr.o ehea_ethtool.o ehea_phyp.o +obj-$(CONFIG_EHEA) += ehea_mod.o + Using -objs is deprecated, please use ehea_mod-y. This needs to be documented and later warned upon which I will do soon. Sam Done. Will be included in next patch. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/6] ehea: pHYP interface
Arnd Bergmann wrote: On Wednesday 09 August 2006 10:38, Jan-Bernd Themann wrote: --- linux-2.6.18-rc4-orig/drivers/net/ehea/ehea_hcall.h 1969-12-31 16:00:00.0 -0800 +++ kernel/drivers/net/ehea/ehea_hcall.h2006-08-08 23:59:38.111462960 -0700 @@ -0,0 +1,52 @@ + +/** + * This file contains HCALL defines that are to be included in the appropriate + * kernel files later + */ + +#define H_ALLOC_HEA_RESOURCE 0x278 +#define H_MODIFY_HEA_QP0x250 +#define H_QUERY_HEA_QP 0x254 +#define H_QUERY_HEA0x258 +#define H_QUERY_HEA_PORT 0x25C +#define H_MODIFY_HEA_PORT 0x260 +#define H_REG_BCMC 0x264 +#define H_DEREG_BCMC 0x268 +#define H_REGISTER_HEA_RPAGES 0x26C +#define H_DISABLE_AND_GET_HEA 0x270 +#define H_GET_HEA_INFO 0x274 +#define H_ADD_CONN 0x284 +#define H_DEL_CONN 0x288 I guess these should go to include/asm-powerpc/hvcall.h instead. Arnd We posted a separate patch for hvcall.h (http://ozlabs.org/pipermail/linuxppc-dev/2006-August/025000.html). As soon as this patch is accepted we'll remove the ehea_hcall.h headerfile. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html