aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDoug Maxey <dwm@austin.ibm.com>2008-01-31 21:20:49 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-03 07:25:56 -0500
commit508d2b5d261abbd7fb728092c5025c5063060c04 (patch)
tree430eea2b96096e7bcef2a44488c382505336ac88 /drivers/net
parent13da93d495f950f078038436f39659f54f91639a (diff)
ehea: fix main checkpatch complaints
Cc: Jan-Bernd Themann <themann@de.ibm.com> Signed-off-by: Doug Maxey <dwm@austin.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ehea/ehea_main.c87
1 files changed, 46 insertions, 41 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 869e1604b16e..99ea46ab60cc 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -6,9 +6,9 @@
6 * (C) Copyright IBM Corp. 2006 6 * (C) Copyright IBM Corp. 2006
7 * 7 *
8 * Authors: 8 * Authors:
9 * Christoph Raisch <raisch@de.ibm.com> 9 * Christoph Raisch <raisch@de.ibm.com>
10 * Jan-Bernd Themann <themann@de.ibm.com> 10 * Jan-Bernd Themann <themann@de.ibm.com>
11 * Thomas Klein <tklein@de.ibm.com> 11 * Thomas Klein <tklein@de.ibm.com>
12 * 12 *
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
@@ -54,11 +54,11 @@ static int rq1_entries = EHEA_DEF_ENTRIES_RQ1;
54static int rq2_entries = EHEA_DEF_ENTRIES_RQ2; 54static int rq2_entries = EHEA_DEF_ENTRIES_RQ2;
55static int rq3_entries = EHEA_DEF_ENTRIES_RQ3; 55static int rq3_entries = EHEA_DEF_ENTRIES_RQ3;
56static int sq_entries = EHEA_DEF_ENTRIES_SQ; 56static int sq_entries = EHEA_DEF_ENTRIES_SQ;
57static int use_mcs = 0; 57static int use_mcs;
58static int use_lro = 0; 58static int use_lro;
59static int lro_max_aggr = EHEA_LRO_MAX_AGGR; 59static int lro_max_aggr = EHEA_LRO_MAX_AGGR;
60static int num_tx_qps = EHEA_NUM_TX_QP; 60static int num_tx_qps = EHEA_NUM_TX_QP;
61static int prop_carrier_state = 0; 61static int prop_carrier_state;
62 62
63module_param(msg_level, int, 0); 63module_param(msg_level, int, 0);
64module_param(rq1_entries, int, 0); 64module_param(rq1_entries, int, 0);
@@ -94,9 +94,9 @@ MODULE_PARM_DESC(lro_max_aggr, " LRO: Max packets to be aggregated. Default = "
94MODULE_PARM_DESC(use_lro, " Large Receive Offload, 1: enable, 0: disable, " 94MODULE_PARM_DESC(use_lro, " Large Receive Offload, 1: enable, 0: disable, "
95 "Default = 0"); 95 "Default = 0");
96 96
97static int port_name_cnt = 0; 97static int port_name_cnt;
98static LIST_HEAD(adapter_list); 98static LIST_HEAD(adapter_list);
99u64 ehea_driver_flags = 0; 99u64 ehea_driver_flags;
100struct work_struct ehea_rereg_mr_task; 100struct work_struct ehea_rereg_mr_task;
101 101
102struct semaphore dlpar_mem_lock; 102struct semaphore dlpar_mem_lock;
@@ -121,12 +121,13 @@ static struct of_platform_driver ehea_driver = {
121 .remove = ehea_remove, 121 .remove = ehea_remove,
122}; 122};
123 123
124void ehea_dump(void *adr, int len, char *msg) { 124void ehea_dump(void *adr, int len, char *msg)
125{
125 int x; 126 int x;
126 unsigned char *deb = adr; 127 unsigned char *deb = adr;
127 for (x = 0; x < len; x += 16) { 128 for (x = 0; x < len; x += 16) {
128 printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg, 129 printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg,
129 deb, x, *((u64*)&deb[0]), *((u64*)&deb[8])); 130 deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8]));
130 deb += 16; 131 deb += 16;
131 } 132 }
132} 133}
@@ -518,7 +519,8 @@ static int ehea_proc_rwqes(struct net_device *dev,
518 last_wqe_index = wqe_index; 519 last_wqe_index = wqe_index;
519 rmb(); 520 rmb();
520 if (!ehea_check_cqe(cqe, &rq)) { 521 if (!ehea_check_cqe(cqe, &rq)) {
521 if (rq == 1) { /* LL RQ1 */ 522 if (rq == 1) {
523 /* LL RQ1 */
522 skb = get_skb_by_index_ll(skb_arr_rq1, 524 skb = get_skb_by_index_ll(skb_arr_rq1,
523 skb_arr_rq1_len, 525 skb_arr_rq1_len,
524 wqe_index); 526 wqe_index);
@@ -531,10 +533,11 @@ static int ehea_proc_rwqes(struct net_device *dev,
531 if (!skb) 533 if (!skb)
532 break; 534 break;
533 } 535 }
534 skb_copy_to_linear_data(skb, ((char*)cqe) + 64, 536 skb_copy_to_linear_data(skb, ((char *)cqe) + 64,
535 cqe->num_bytes_transfered - 4); 537 cqe->num_bytes_transfered - 4);
536 ehea_fill_skb(dev, skb, cqe); 538 ehea_fill_skb(dev, skb, cqe);
537 } else if (rq == 2) { /* RQ2 */ 539 } else if (rq == 2) {
540 /* RQ2 */
538 skb = get_skb_by_index(skb_arr_rq2, 541 skb = get_skb_by_index(skb_arr_rq2,
539 skb_arr_rq2_len, cqe); 542 skb_arr_rq2_len, cqe);
540 if (unlikely(!skb)) { 543 if (unlikely(!skb)) {
@@ -544,7 +547,8 @@ static int ehea_proc_rwqes(struct net_device *dev,
544 } 547 }
545 ehea_fill_skb(dev, skb, cqe); 548 ehea_fill_skb(dev, skb, cqe);
546 processed_rq2++; 549 processed_rq2++;
547 } else { /* RQ3 */ 550 } else {
551 /* RQ3 */
548 skb = get_skb_by_index(skb_arr_rq3, 552 skb = get_skb_by_index(skb_arr_rq3,
549 skb_arr_rq3_len, cqe); 553 skb_arr_rq3_len, cqe);
550 if (unlikely(!skb)) { 554 if (unlikely(!skb)) {
@@ -592,7 +596,7 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota)
592 unsigned long flags; 596 unsigned long flags;
593 597
594 cqe = ehea_poll_cq(send_cq); 598 cqe = ehea_poll_cq(send_cq);
595 while(cqe && (quota > 0)) { 599 while (cqe && (quota > 0)) {
596 ehea_inc_cq(send_cq); 600 ehea_inc_cq(send_cq);
597 601
598 cqe_counter++; 602 cqe_counter++;
@@ -643,7 +647,8 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota)
643 647
644static int ehea_poll(struct napi_struct *napi, int budget) 648static int ehea_poll(struct napi_struct *napi, int budget)
645{ 649{
646 struct ehea_port_res *pr = container_of(napi, struct ehea_port_res, napi); 650 struct ehea_port_res *pr = container_of(napi, struct ehea_port_res,
651 napi);
647 struct net_device *dev = pr->port->netdev; 652 struct net_device *dev = pr->port->netdev;
648 struct ehea_cqe *cqe; 653 struct ehea_cqe *cqe;
649 struct ehea_cqe *cqe_skb = NULL; 654 struct ehea_cqe *cqe_skb = NULL;
@@ -743,8 +748,9 @@ int ehea_sense_port_attr(struct ehea_port *port)
743 u64 hret; 748 u64 hret;
744 struct hcp_ehea_port_cb0 *cb0; 749 struct hcp_ehea_port_cb0 *cb0;
745 750
746 cb0 = kzalloc(PAGE_SIZE, GFP_ATOMIC); /* May be called via */ 751 /* may be called via ehea_neq_tasklet() */
747 if (!cb0) { /* ehea_neq_tasklet() */ 752 cb0 = kzalloc(PAGE_SIZE, GFP_ATOMIC);
753 if (!cb0) {
748 ehea_error("no mem for cb0"); 754 ehea_error("no mem for cb0");
749 ret = -ENOMEM; 755 ret = -ENOMEM;
750 goto out; 756 goto out;
@@ -762,7 +768,7 @@ int ehea_sense_port_attr(struct ehea_port *port)
762 /* MAC address */ 768 /* MAC address */
763 port->mac_addr = cb0->port_mac_addr << 16; 769 port->mac_addr = cb0->port_mac_addr << 16;
764 770
765 if (!is_valid_ether_addr((u8*)&port->mac_addr)) { 771 if (!is_valid_ether_addr((u8 *)&port->mac_addr)) {
766 ret = -EADDRNOTAVAIL; 772 ret = -EADDRNOTAVAIL;
767 goto out_free; 773 goto out_free;
768 } 774 }
@@ -994,7 +1000,7 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe)
994 1000
995static void ehea_neq_tasklet(unsigned long data) 1001static void ehea_neq_tasklet(unsigned long data)
996{ 1002{
997 struct ehea_adapter *adapter = (struct ehea_adapter*)data; 1003 struct ehea_adapter *adapter = (struct ehea_adapter *)data;
998 struct ehea_eqe *eqe; 1004 struct ehea_eqe *eqe;
999 u64 event_mask; 1005 u64 event_mask;
1000 1006
@@ -1204,7 +1210,7 @@ int ehea_rem_smrs(struct ehea_port_res *pr)
1204 1210
1205static int ehea_init_q_skba(struct ehea_q_skb_arr *q_skba, int max_q_entries) 1211static int ehea_init_q_skba(struct ehea_q_skb_arr *q_skba, int max_q_entries)
1206{ 1212{
1207 int arr_size = sizeof(void*) * max_q_entries; 1213 int arr_size = sizeof(void *) * max_q_entries;
1208 1214
1209 q_skba->arr = vmalloc(arr_size); 1215 q_skba->arr = vmalloc(arr_size);
1210 if (!q_skba->arr) 1216 if (!q_skba->arr)
@@ -1489,7 +1495,7 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
1489 1495
1490 nfrags = skb_shinfo(skb)->nr_frags; 1496 nfrags = skb_shinfo(skb)->nr_frags;
1491 sg1entry = &swqe->u.immdata_desc.sg_entry; 1497 sg1entry = &swqe->u.immdata_desc.sg_entry;
1492 sg_list = (struct ehea_vsgentry*)&swqe->u.immdata_desc.sg_list; 1498 sg_list = (struct ehea_vsgentry *)&swqe->u.immdata_desc.sg_list;
1493 swqe->descriptors = 0; 1499 swqe->descriptors = 0;
1494 sg1entry_contains_frag_data = 0; 1500 sg1entry_contains_frag_data = 0;
1495 1501
@@ -1542,7 +1548,7 @@ static int ehea_broadcast_reg_helper(struct ehea_port *port, u32 hcallid)
1542 reg_type, port->mac_addr, 0, hcallid); 1548 reg_type, port->mac_addr, 0, hcallid);
1543 if (hret != H_SUCCESS) { 1549 if (hret != H_SUCCESS) {
1544 ehea_error("%sregistering bc address failed (tagged)", 1550 ehea_error("%sregistering bc address failed (tagged)",
1545 hcallid == H_REG_BCMC ? "" : "de"); 1551 hcallid == H_REG_BCMC ? "" : "de");
1546 ret = -EIO; 1552 ret = -EIO;
1547 goto out_herr; 1553 goto out_herr;
1548 } 1554 }
@@ -1732,7 +1738,7 @@ static void ehea_allmulti(struct net_device *dev, int enable)
1732 } 1738 }
1733} 1739}
1734 1740
1735static void ehea_add_multicast_entry(struct ehea_port* port, u8* mc_mac_addr) 1741static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr)
1736{ 1742{
1737 struct ehea_mc_list *ehea_mcl_entry; 1743 struct ehea_mc_list *ehea_mcl_entry;
1738 u64 hret; 1744 u64 hret;
@@ -1791,11 +1797,10 @@ static void ehea_set_multicast_list(struct net_device *dev)
1791 goto out; 1797 goto out;
1792 } 1798 }
1793 1799
1794 for (i = 0, k_mcl_entry = dev->mc_list; 1800 for (i = 0, k_mcl_entry = dev->mc_list; i < dev->mc_count; i++,
1795 i < dev->mc_count; 1801 k_mcl_entry = k_mcl_entry->next)
1796 i++, k_mcl_entry = k_mcl_entry->next) {
1797 ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr); 1802 ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr);
1798 } 1803
1799 } 1804 }
1800out: 1805out:
1801 return; 1806 return;
@@ -1925,12 +1930,12 @@ static inline int ehea_hash_skb(struct sk_buff *skb, int num_qps)
1925 1930
1926 if ((skb->protocol == htons(ETH_P_IP)) && 1931 if ((skb->protocol == htons(ETH_P_IP)) &&
1927 (ip_hdr(skb)->protocol == IPPROTO_TCP)) { 1932 (ip_hdr(skb)->protocol == IPPROTO_TCP)) {
1928 tcp = (struct tcphdr*)(skb_network_header(skb) + (ip_hdr(skb)->ihl * 4)); 1933 tcp = (struct tcphdr *)(skb_network_header(skb) +
1934 (ip_hdr(skb)->ihl * 4));
1929 tmp = (tcp->source + (tcp->dest << 16)) % 31; 1935 tmp = (tcp->source + (tcp->dest << 16)) % 31;
1930 tmp += ip_hdr(skb)->daddr % 31; 1936 tmp += ip_hdr(skb)->daddr % 31;
1931 return tmp % num_qps; 1937 return tmp % num_qps;
1932 } 1938 } else
1933 else
1934 return 0; 1939 return 0;
1935} 1940}
1936 1941
@@ -2122,7 +2127,7 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
2122 u64 hret; 2127 u64 hret;
2123 u16 dummy16 = 0; 2128 u16 dummy16 = 0;
2124 u64 dummy64 = 0; 2129 u64 dummy64 = 0;
2125 struct hcp_modify_qp_cb0* cb0; 2130 struct hcp_modify_qp_cb0 *cb0;
2126 2131
2127 cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); 2132 cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL);
2128 if (!cb0) { 2133 if (!cb0) {
@@ -2248,7 +2253,7 @@ static int ehea_clean_all_portres(struct ehea_port *port)
2248 int ret = 0; 2253 int ret = 0;
2249 int i; 2254 int i;
2250 2255
2251 for(i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) 2256 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++)
2252 ret |= ehea_clean_portres(port, &port->port_res[i]); 2257 ret |= ehea_clean_portres(port, &port->port_res[i]);
2253 2258
2254 ret |= ehea_destroy_eq(port->qp_eq); 2259 ret |= ehea_destroy_eq(port->qp_eq);
@@ -2300,7 +2305,7 @@ static int ehea_up(struct net_device *dev)
2300 goto out_clean_pr; 2305 goto out_clean_pr;
2301 } 2306 }
2302 2307
2303 for(i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 2308 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
2304 ret = ehea_activate_qp(port->adapter, port->port_res[i].qp); 2309 ret = ehea_activate_qp(port->adapter, port->port_res[i].qp);
2305 if (ret) { 2310 if (ret) {
2306 ehea_error("activate_qp failed"); 2311 ehea_error("activate_qp failed");
@@ -2308,7 +2313,7 @@ static int ehea_up(struct net_device *dev)
2308 } 2313 }
2309 } 2314 }
2310 2315
2311 for(i = 0; i < port->num_def_qps; i++) { 2316 for (i = 0; i < port->num_def_qps; i++) {
2312 ret = ehea_fill_port_res(&port->port_res[i]); 2317 ret = ehea_fill_port_res(&port->port_res[i]);
2313 if (ret) { 2318 if (ret) {
2314 ehea_error("out_free_irqs"); 2319 ehea_error("out_free_irqs");
@@ -2425,7 +2430,7 @@ int ehea_stop_qps(struct net_device *dev)
2425{ 2430{
2426 struct ehea_port *port = netdev_priv(dev); 2431 struct ehea_port *port = netdev_priv(dev);
2427 struct ehea_adapter *adapter = port->adapter; 2432 struct ehea_adapter *adapter = port->adapter;
2428 struct hcp_modify_qp_cb0* cb0; 2433 struct hcp_modify_qp_cb0 *cb0;
2429 int ret = -EIO; 2434 int ret = -EIO;
2430 int dret; 2435 int dret;
2431 int i; 2436 int i;
@@ -2490,7 +2495,7 @@ out:
2490 return ret; 2495 return ret;
2491} 2496}
2492 2497
2493void ehea_update_rqs(struct ehea_qp *orig_qp, struct ehea_port_res * pr) 2498void ehea_update_rqs(struct ehea_qp *orig_qp, struct ehea_port_res *pr)
2494{ 2499{
2495 struct ehea_qp qp = *orig_qp; 2500 struct ehea_qp qp = *orig_qp;
2496 struct ehea_qp_init_attr *init_attr = &qp.init_attr; 2501 struct ehea_qp_init_attr *init_attr = &qp.init_attr;
@@ -2530,7 +2535,7 @@ int ehea_restart_qps(struct net_device *dev)
2530 int ret = 0; 2535 int ret = 0;
2531 int i; 2536 int i;
2532 2537
2533 struct hcp_modify_qp_cb0* cb0; 2538 struct hcp_modify_qp_cb0 *cb0;
2534 u64 hret; 2539 u64 hret;
2535 u64 dummy64 = 0; 2540 u64 dummy64 = 0;
2536 u16 dummy16 = 0; 2541 u16 dummy16 = 0;
@@ -3109,7 +3114,7 @@ static ssize_t ehea_probe_port(struct device *dev,
3109 of_node_put(eth_dn); 3114 of_node_put(eth_dn);
3110 3115
3111 if (port) { 3116 if (port) {
3112 for (i=0; i < EHEA_MAX_PORTS; i++) 3117 for (i = 0; i < EHEA_MAX_PORTS; i++)
3113 if (!adapter->port[i]) { 3118 if (!adapter->port[i]) {
3114 adapter->port[i] = port; 3119 adapter->port[i] = port;
3115 break; 3120 break;
@@ -3144,7 +3149,7 @@ static ssize_t ehea_remove_port(struct device *dev,
3144 3149
3145 ehea_shutdown_single_port(port); 3150 ehea_shutdown_single_port(port);
3146 3151
3147 for (i=0; i < EHEA_MAX_PORTS; i++) 3152 for (i = 0; i < EHEA_MAX_PORTS; i++)
3148 if (adapter->port[i] == port) { 3153 if (adapter->port[i] == port) {
3149 adapter->port[i] = NULL; 3154 adapter->port[i] = NULL;
3150 break; 3155 break;
@@ -3313,7 +3318,7 @@ static int ehea_reboot_notifier(struct notifier_block *nb,
3313} 3318}
3314 3319
3315static struct notifier_block ehea_reboot_nb = { 3320static struct notifier_block ehea_reboot_nb = {
3316 .notifier_call = ehea_reboot_notifier, 3321 .notifier_call = ehea_reboot_notifier,
3317}; 3322};
3318 3323
3319static int check_module_parm(void) 3324static int check_module_parm(void)