aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ehea/ehea_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ehea/ehea_main.c')
-rw-r--r--drivers/net/ehea/ehea_main.c559
1 files changed, 294 insertions, 265 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 6372610ed240..3fd5a2400348 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -26,6 +26,8 @@
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
29#include <linux/in.h> 31#include <linux/in.h>
30#include <linux/ip.h> 32#include <linux/ip.h>
31#include <linux/tcp.h> 33#include <linux/tcp.h>
@@ -39,6 +41,7 @@
39#include <linux/memory.h> 41#include <linux/memory.h>
40#include <asm/kexec.h> 42#include <asm/kexec.h>
41#include <linux/mutex.h> 43#include <linux/mutex.h>
44#include <linux/prefetch.h>
42 45
43#include <net/ip.h> 46#include <net/ip.h>
44 47
@@ -101,7 +104,6 @@ MODULE_PARM_DESC(use_lro, " Large Receive Offload, 1: enable, 0: disable, "
101static int port_name_cnt; 104static int port_name_cnt;
102static LIST_HEAD(adapter_list); 105static LIST_HEAD(adapter_list);
103static unsigned long ehea_driver_flags; 106static unsigned long ehea_driver_flags;
104struct work_struct ehea_rereg_mr_task;
105static DEFINE_MUTEX(dlpar_mem_lock); 107static DEFINE_MUTEX(dlpar_mem_lock);
106struct ehea_fw_handle_array ehea_fw_handles; 108struct ehea_fw_handle_array ehea_fw_handles;
107struct ehea_bcmc_reg_array ehea_bcmc_regs; 109struct ehea_bcmc_reg_array ehea_bcmc_regs;
@@ -136,8 +138,8 @@ void ehea_dump(void *adr, int len, char *msg)
136 int x; 138 int x;
137 unsigned char *deb = adr; 139 unsigned char *deb = adr;
138 for (x = 0; x < len; x += 16) { 140 for (x = 0; x < len; x += 16) {
139 printk(DRV_NAME " %s adr=%p ofs=%04x %016llx %016llx\n", msg, 141 pr_info("%s adr=%p ofs=%04x %016llx %016llx\n",
140 deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); 142 msg, deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8]));
141 deb += 16; 143 deb += 16;
142 } 144 }
143} 145}
@@ -180,7 +182,7 @@ static void ehea_update_firmware_handles(void)
180 num_portres * EHEA_NUM_PORTRES_FW_HANDLES; 182 num_portres * EHEA_NUM_PORTRES_FW_HANDLES;
181 183
182 if (num_fw_handles) { 184 if (num_fw_handles) {
183 arr = kzalloc(num_fw_handles * sizeof(*arr), GFP_KERNEL); 185 arr = kcalloc(num_fw_handles, sizeof(*arr), GFP_KERNEL);
184 if (!arr) 186 if (!arr)
185 goto out; /* Keep the existing array */ 187 goto out; /* Keep the existing array */
186 } else 188 } else
@@ -265,7 +267,7 @@ static void ehea_update_bcmc_registrations(void)
265 } 267 }
266 268
267 if (num_registrations) { 269 if (num_registrations) {
268 arr = kzalloc(num_registrations * sizeof(*arr), GFP_ATOMIC); 270 arr = kcalloc(num_registrations, sizeof(*arr), GFP_ATOMIC);
269 if (!arr) 271 if (!arr)
270 goto out; /* Keep the existing array */ 272 goto out; /* Keep the existing array */
271 } else 273 } else
@@ -330,14 +332,14 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
330 struct ehea_port *port = netdev_priv(dev); 332 struct ehea_port *port = netdev_priv(dev);
331 struct net_device_stats *stats = &port->stats; 333 struct net_device_stats *stats = &port->stats;
332 struct hcp_ehea_port_cb2 *cb2; 334 struct hcp_ehea_port_cb2 *cb2;
333 u64 hret, rx_packets, tx_packets; 335 u64 hret, rx_packets, tx_packets, rx_bytes = 0, tx_bytes = 0;
334 int i; 336 int i;
335 337
336 memset(stats, 0, sizeof(*stats)); 338 memset(stats, 0, sizeof(*stats));
337 339
338 cb2 = (void *)get_zeroed_page(GFP_KERNEL); 340 cb2 = (void *)get_zeroed_page(GFP_KERNEL);
339 if (!cb2) { 341 if (!cb2) {
340 ehea_error("no mem for cb2"); 342 netdev_err(dev, "no mem for cb2\n");
341 goto out; 343 goto out;
342 } 344 }
343 345
@@ -345,7 +347,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
345 port->logical_port_id, 347 port->logical_port_id,
346 H_PORT_CB2, H_PORT_CB2_ALL, cb2); 348 H_PORT_CB2, H_PORT_CB2_ALL, cb2);
347 if (hret != H_SUCCESS) { 349 if (hret != H_SUCCESS) {
348 ehea_error("query_ehea_port failed"); 350 netdev_err(dev, "query_ehea_port failed\n");
349 goto out_herr; 351 goto out_herr;
350 } 352 }
351 353
@@ -353,18 +355,22 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
353 ehea_dump(cb2, sizeof(*cb2), "net_device_stats"); 355 ehea_dump(cb2, sizeof(*cb2), "net_device_stats");
354 356
355 rx_packets = 0; 357 rx_packets = 0;
356 for (i = 0; i < port->num_def_qps; i++) 358 for (i = 0; i < port->num_def_qps; i++) {
357 rx_packets += port->port_res[i].rx_packets; 359 rx_packets += port->port_res[i].rx_packets;
360 rx_bytes += port->port_res[i].rx_bytes;
361 }
358 362
359 tx_packets = 0; 363 tx_packets = 0;
360 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) 364 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
361 tx_packets += port->port_res[i].tx_packets; 365 tx_packets += port->port_res[i].tx_packets;
366 tx_bytes += port->port_res[i].tx_bytes;
367 }
362 368
363 stats->tx_packets = tx_packets; 369 stats->tx_packets = tx_packets;
364 stats->multicast = cb2->rxmcp; 370 stats->multicast = cb2->rxmcp;
365 stats->rx_errors = cb2->rxuerr; 371 stats->rx_errors = cb2->rxuerr;
366 stats->rx_bytes = cb2->rxo; 372 stats->rx_bytes = rx_bytes;
367 stats->tx_bytes = cb2->txo; 373 stats->tx_bytes = tx_bytes;
368 stats->rx_packets = rx_packets; 374 stats->rx_packets = rx_packets;
369 375
370out_herr: 376out_herr:
@@ -396,6 +402,7 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
396 skb_arr_rq1[index] = netdev_alloc_skb(dev, 402 skb_arr_rq1[index] = netdev_alloc_skb(dev,
397 EHEA_L_PKT_SIZE); 403 EHEA_L_PKT_SIZE);
398 if (!skb_arr_rq1[index]) { 404 if (!skb_arr_rq1[index]) {
405 netdev_info(dev, "Unable to allocate enough skb in the array\n");
399 pr->rq1_skba.os_skbs = fill_wqes - i; 406 pr->rq1_skba.os_skbs = fill_wqes - i;
400 break; 407 break;
401 } 408 }
@@ -418,13 +425,20 @@ static void ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a)
418 struct net_device *dev = pr->port->netdev; 425 struct net_device *dev = pr->port->netdev;
419 int i; 426 int i;
420 427
421 for (i = 0; i < pr->rq1_skba.len; i++) { 428 if (nr_rq1a > pr->rq1_skba.len) {
429 netdev_err(dev, "NR_RQ1A bigger than skb array len\n");
430 return;
431 }
432
433 for (i = 0; i < nr_rq1a; i++) {
422 skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE); 434 skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE);
423 if (!skb_arr_rq1[i]) 435 if (!skb_arr_rq1[i]) {
436 netdev_info(dev, "Not enough memory to allocate skb array\n");
424 break; 437 break;
438 }
425 } 439 }
426 /* Ring doorbell */ 440 /* Ring doorbell */
427 ehea_update_rq1a(pr->qp, nr_rq1a); 441 ehea_update_rq1a(pr->qp, i - 1);
428} 442}
429 443
430static int ehea_refill_rq_def(struct ehea_port_res *pr, 444static int ehea_refill_rq_def(struct ehea_port_res *pr,
@@ -457,8 +471,9 @@ static int ehea_refill_rq_def(struct ehea_port_res *pr,
457 if (!skb) { 471 if (!skb) {
458 q_skba->os_skbs = fill_wqes - i; 472 q_skba->os_skbs = fill_wqes - i;
459 if (q_skba->os_skbs == q_skba->len - 2) { 473 if (q_skba->os_skbs == q_skba->len - 2) {
460 ehea_info("%s: rq%i ran dry - no mem for skb", 474 netdev_info(pr->port->netdev,
461 pr->port->netdev->name, rq_nr); 475 "rq%i ran dry - no mem for skb\n",
476 rq_nr);
462 ret = -ENOMEM; 477 ret = -ENOMEM;
463 } 478 }
464 break; 479 break;
@@ -623,8 +638,8 @@ static int ehea_treat_poll_error(struct ehea_port_res *pr, int rq,
623 638
624 if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) { 639 if (cqe->status & EHEA_CQE_STAT_FAT_ERR_MASK) {
625 if (netif_msg_rx_err(pr->port)) { 640 if (netif_msg_rx_err(pr->port)) {
626 ehea_error("Critical receive error for QP %d. " 641 pr_err("Critical receive error for QP %d. Resetting port.\n",
627 "Resetting port.", pr->qp->init_attr.qp_nr); 642 pr->qp->init_attr.qp_nr);
628 ehea_dump(cqe, sizeof(*cqe), "CQE"); 643 ehea_dump(cqe, sizeof(*cqe), "CQE");
629 } 644 }
630 ehea_schedule_port_reset(pr->port); 645 ehea_schedule_port_reset(pr->port);
@@ -671,7 +686,7 @@ static void ehea_proc_skb(struct ehea_port_res *pr, struct ehea_cqe *cqe,
671 int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && 686 int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) &&
672 pr->port->vgrp); 687 pr->port->vgrp);
673 688
674 if (use_lro) { 689 if (skb->dev->features & NETIF_F_LRO) {
675 if (vlan_extracted) 690 if (vlan_extracted)
676 lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb, 691 lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb,
677 pr->port->vgrp, 692 pr->port->vgrp,
@@ -703,6 +718,7 @@ static int ehea_proc_rwqes(struct net_device *dev,
703 int skb_arr_rq2_len = pr->rq2_skba.len; 718 int skb_arr_rq2_len = pr->rq2_skba.len;
704 int skb_arr_rq3_len = pr->rq3_skba.len; 719 int skb_arr_rq3_len = pr->rq3_skba.len;
705 int processed, processed_rq1, processed_rq2, processed_rq3; 720 int processed, processed_rq1, processed_rq2, processed_rq3;
721 u64 processed_bytes = 0;
706 int wqe_index, last_wqe_index, rq, port_reset; 722 int wqe_index, last_wqe_index, rq, port_reset;
707 723
708 processed = processed_rq1 = processed_rq2 = processed_rq3 = 0; 724 processed = processed_rq1 = processed_rq2 = processed_rq3 = 0;
@@ -725,13 +741,15 @@ static int ehea_proc_rwqes(struct net_device *dev,
725 skb_arr_rq1_len, 741 skb_arr_rq1_len,
726 wqe_index); 742 wqe_index);
727 if (unlikely(!skb)) { 743 if (unlikely(!skb)) {
728 if (netif_msg_rx_err(port)) 744 netif_info(port, rx_err, dev,
729 ehea_error("LL rq1: skb=NULL"); 745 "LL rq1: skb=NULL\n");
730 746
731 skb = netdev_alloc_skb(dev, 747 skb = netdev_alloc_skb(dev,
732 EHEA_L_PKT_SIZE); 748 EHEA_L_PKT_SIZE);
733 if (!skb) 749 if (!skb) {
750 netdev_err(dev, "Not enough memory to allocate skb\n");
734 break; 751 break;
752 }
735 } 753 }
736 skb_copy_to_linear_data(skb, ((char *)cqe) + 64, 754 skb_copy_to_linear_data(skb, ((char *)cqe) + 64,
737 cqe->num_bytes_transfered - 4); 755 cqe->num_bytes_transfered - 4);
@@ -741,8 +759,8 @@ static int ehea_proc_rwqes(struct net_device *dev,
741 skb = get_skb_by_index(skb_arr_rq2, 759 skb = get_skb_by_index(skb_arr_rq2,
742 skb_arr_rq2_len, cqe); 760 skb_arr_rq2_len, cqe);
743 if (unlikely(!skb)) { 761 if (unlikely(!skb)) {
744 if (netif_msg_rx_err(port)) 762 netif_err(port, rx_err, dev,
745 ehea_error("rq2: skb=NULL"); 763 "rq2: skb=NULL\n");
746 break; 764 break;
747 } 765 }
748 ehea_fill_skb(dev, skb, cqe); 766 ehea_fill_skb(dev, skb, cqe);
@@ -752,14 +770,15 @@ static int ehea_proc_rwqes(struct net_device *dev,
752 skb = get_skb_by_index(skb_arr_rq3, 770 skb = get_skb_by_index(skb_arr_rq3,
753 skb_arr_rq3_len, cqe); 771 skb_arr_rq3_len, cqe);
754 if (unlikely(!skb)) { 772 if (unlikely(!skb)) {
755 if (netif_msg_rx_err(port)) 773 netif_err(port, rx_err, dev,
756 ehea_error("rq3: skb=NULL"); 774 "rq3: skb=NULL\n");
757 break; 775 break;
758 } 776 }
759 ehea_fill_skb(dev, skb, cqe); 777 ehea_fill_skb(dev, skb, cqe);
760 processed_rq3++; 778 processed_rq3++;
761 } 779 }
762 780
781 processed_bytes += skb->len;
763 ehea_proc_skb(pr, cqe, skb); 782 ehea_proc_skb(pr, cqe, skb);
764 } else { 783 } else {
765 pr->p_stats.poll_receive_errors++; 784 pr->p_stats.poll_receive_errors++;
@@ -771,10 +790,11 @@ static int ehea_proc_rwqes(struct net_device *dev,
771 } 790 }
772 cqe = ehea_poll_rq1(qp, &wqe_index); 791 cqe = ehea_poll_rq1(qp, &wqe_index);
773 } 792 }
774 if (use_lro) 793 if (dev->features & NETIF_F_LRO)
775 lro_flush_all(&pr->lro_mgr); 794 lro_flush_all(&pr->lro_mgr);
776 795
777 pr->rx_packets += processed; 796 pr->rx_packets += processed;
797 pr->rx_bytes += processed_bytes;
778 798
779 ehea_refill_rq1(pr, last_wqe_index, processed_rq1); 799 ehea_refill_rq1(pr, last_wqe_index, processed_rq1);
780 ehea_refill_rq2(pr, processed_rq2); 800 ehea_refill_rq2(pr, processed_rq2);
@@ -793,6 +813,7 @@ static void reset_sq_restart_flag(struct ehea_port *port)
793 struct ehea_port_res *pr = &port->port_res[i]; 813 struct ehea_port_res *pr = &port->port_res[i];
794 pr->sq_restart_flag = 0; 814 pr->sq_restart_flag = 0;
795 } 815 }
816 wake_up(&port->restart_wq);
796} 817}
797 818
798static void check_sqs(struct ehea_port *port) 819static void check_sqs(struct ehea_port *port)
@@ -803,6 +824,7 @@ static void check_sqs(struct ehea_port *port)
803 824
804 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 825 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
805 struct ehea_port_res *pr = &port->port_res[i]; 826 struct ehea_port_res *pr = &port->port_res[i];
827 int ret;
806 k = 0; 828 k = 0;
807 swqe = ehea_get_swqe(pr->qp, &swqe_index); 829 swqe = ehea_get_swqe(pr->qp, &swqe_index);
808 memset(swqe, 0, SWQE_HEADER_SIZE); 830 memset(swqe, 0, SWQE_HEADER_SIZE);
@@ -816,17 +838,16 @@ static void check_sqs(struct ehea_port *port)
816 838
817 ehea_post_swqe(pr->qp, swqe); 839 ehea_post_swqe(pr->qp, swqe);
818 840
819 while (pr->sq_restart_flag == 0) { 841 ret = wait_event_timeout(port->restart_wq,
820 msleep(5); 842 pr->sq_restart_flag == 0,
821 if (++k == 100) { 843 msecs_to_jiffies(100));
822 ehea_error("HW/SW queues out of sync"); 844
823 ehea_schedule_port_reset(pr->port); 845 if (!ret) {
824 return; 846 pr_err("HW/SW queues out of sync\n");
825 } 847 ehea_schedule_port_reset(pr->port);
848 return;
826 } 849 }
827 } 850 }
828
829 return;
830} 851}
831 852
832 853
@@ -855,14 +876,14 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota)
855 } 876 }
856 877
857 if (cqe->status & EHEA_CQE_STAT_ERR_MASK) { 878 if (cqe->status & EHEA_CQE_STAT_ERR_MASK) {
858 ehea_error("Bad send completion status=0x%04X", 879 pr_err("Bad send completion status=0x%04X\n",
859 cqe->status); 880 cqe->status);
860 881
861 if (netif_msg_tx_err(pr->port)) 882 if (netif_msg_tx_err(pr->port))
862 ehea_dump(cqe, sizeof(*cqe), "Send CQE"); 883 ehea_dump(cqe, sizeof(*cqe), "Send CQE");
863 884
864 if (cqe->status & EHEA_CQE_STAT_RESET_MASK) { 885 if (cqe->status & EHEA_CQE_STAT_RESET_MASK) {
865 ehea_error("Resetting port"); 886 pr_err("Resetting port\n");
866 ehea_schedule_port_reset(pr->port); 887 ehea_schedule_port_reset(pr->port);
867 break; 888 break;
868 } 889 }
@@ -897,6 +918,7 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota)
897 pr->queue_stopped = 0; 918 pr->queue_stopped = 0;
898 } 919 }
899 spin_unlock_irqrestore(&pr->netif_queue, flags); 920 spin_unlock_irqrestore(&pr->netif_queue, flags);
921 wake_up(&pr->port->swqe_avail_wq);
900 922
901 return cqe; 923 return cqe;
902} 924}
@@ -979,8 +1001,8 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
979 1001
980 while (eqe) { 1002 while (eqe) {
981 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); 1003 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry);
982 ehea_error("QP aff_err: entry=0x%llx, token=0x%x", 1004 pr_err("QP aff_err: entry=0x%llx, token=0x%x\n",
983 eqe->entry, qp_token); 1005 eqe->entry, qp_token);
984 1006
985 qp = port->port_res[qp_token].qp; 1007 qp = port->port_res[qp_token].qp;
986 1008
@@ -998,7 +1020,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
998 } 1020 }
999 1021
1000 if (reset_port) { 1022 if (reset_port) {
1001 ehea_error("Resetting port"); 1023 pr_err("Resetting port\n");
1002 ehea_schedule_port_reset(port); 1024 ehea_schedule_port_reset(port);
1003 } 1025 }
1004 1026
@@ -1026,7 +1048,7 @@ int ehea_sense_port_attr(struct ehea_port *port)
1026 /* may be called via ehea_neq_tasklet() */ 1048 /* may be called via ehea_neq_tasklet() */
1027 cb0 = (void *)get_zeroed_page(GFP_ATOMIC); 1049 cb0 = (void *)get_zeroed_page(GFP_ATOMIC);
1028 if (!cb0) { 1050 if (!cb0) {
1029 ehea_error("no mem for cb0"); 1051 pr_err("no mem for cb0\n");
1030 ret = -ENOMEM; 1052 ret = -ENOMEM;
1031 goto out; 1053 goto out;
1032 } 1054 }
@@ -1118,7 +1140,7 @@ int ehea_set_portspeed(struct ehea_port *port, u32 port_speed)
1118 1140
1119 cb4 = (void *)get_zeroed_page(GFP_KERNEL); 1141 cb4 = (void *)get_zeroed_page(GFP_KERNEL);
1120 if (!cb4) { 1142 if (!cb4) {
1121 ehea_error("no mem for cb4"); 1143 pr_err("no mem for cb4\n");
1122 ret = -ENOMEM; 1144 ret = -ENOMEM;
1123 goto out; 1145 goto out;
1124 } 1146 }
@@ -1169,16 +1191,16 @@ int ehea_set_portspeed(struct ehea_port *port, u32 port_speed)
1169 break; 1191 break;
1170 } 1192 }
1171 } else { 1193 } else {
1172 ehea_error("Failed sensing port speed"); 1194 pr_err("Failed sensing port speed\n");
1173 ret = -EIO; 1195 ret = -EIO;
1174 } 1196 }
1175 } else { 1197 } else {
1176 if (hret == H_AUTHORITY) { 1198 if (hret == H_AUTHORITY) {
1177 ehea_info("Hypervisor denied setting port speed"); 1199 pr_info("Hypervisor denied setting port speed\n");
1178 ret = -EPERM; 1200 ret = -EPERM;
1179 } else { 1201 } else {
1180 ret = -EIO; 1202 ret = -EIO;
1181 ehea_error("Failed setting port speed"); 1203 pr_err("Failed setting port speed\n");
1182 } 1204 }
1183 } 1205 }
1184 if (!prop_carrier_state || (port->phy_link == EHEA_PHY_LINK_UP)) 1206 if (!prop_carrier_state || (port->phy_link == EHEA_PHY_LINK_UP))
@@ -1195,80 +1217,78 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe)
1195 u8 ec; 1217 u8 ec;
1196 u8 portnum; 1218 u8 portnum;
1197 struct ehea_port *port; 1219 struct ehea_port *port;
1220 struct net_device *dev;
1198 1221
1199 ec = EHEA_BMASK_GET(NEQE_EVENT_CODE, eqe); 1222 ec = EHEA_BMASK_GET(NEQE_EVENT_CODE, eqe);
1200 portnum = EHEA_BMASK_GET(NEQE_PORTNUM, eqe); 1223 portnum = EHEA_BMASK_GET(NEQE_PORTNUM, eqe);
1201 port = ehea_get_port(adapter, portnum); 1224 port = ehea_get_port(adapter, portnum);
1225 dev = port->netdev;
1202 1226
1203 switch (ec) { 1227 switch (ec) {
1204 case EHEA_EC_PORTSTATE_CHG: /* port state change */ 1228 case EHEA_EC_PORTSTATE_CHG: /* port state change */
1205 1229
1206 if (!port) { 1230 if (!port) {
1207 ehea_error("unknown portnum %x", portnum); 1231 netdev_err(dev, "unknown portnum %x\n", portnum);
1208 break; 1232 break;
1209 } 1233 }
1210 1234
1211 if (EHEA_BMASK_GET(NEQE_PORT_UP, eqe)) { 1235 if (EHEA_BMASK_GET(NEQE_PORT_UP, eqe)) {
1212 if (!netif_carrier_ok(port->netdev)) { 1236 if (!netif_carrier_ok(dev)) {
1213 ret = ehea_sense_port_attr(port); 1237 ret = ehea_sense_port_attr(port);
1214 if (ret) { 1238 if (ret) {
1215 ehea_error("failed resensing port " 1239 netdev_err(dev, "failed resensing port attributes\n");
1216 "attributes");
1217 break; 1240 break;
1218 } 1241 }
1219 1242
1220 if (netif_msg_link(port)) 1243 netif_info(port, link, dev,
1221 ehea_info("%s: Logical port up: %dMbps " 1244 "Logical port up: %dMbps %s Duplex\n",
1222 "%s Duplex", 1245 port->port_speed,
1223 port->netdev->name, 1246 port->full_duplex == 1 ?
1224 port->port_speed, 1247 "Full" : "Half");
1225 port->full_duplex ==
1226 1 ? "Full" : "Half");
1227 1248
1228 netif_carrier_on(port->netdev); 1249 netif_carrier_on(dev);
1229 netif_wake_queue(port->netdev); 1250 netif_wake_queue(dev);
1230 } 1251 }
1231 } else 1252 } else
1232 if (netif_carrier_ok(port->netdev)) { 1253 if (netif_carrier_ok(dev)) {
1233 if (netif_msg_link(port)) 1254 netif_info(port, link, dev,
1234 ehea_info("%s: Logical port down", 1255 "Logical port down\n");
1235 port->netdev->name); 1256 netif_carrier_off(dev);
1236 netif_carrier_off(port->netdev); 1257 netif_stop_queue(dev);
1237 netif_stop_queue(port->netdev);
1238 } 1258 }
1239 1259
1240 if (EHEA_BMASK_GET(NEQE_EXTSWITCH_PORT_UP, eqe)) { 1260 if (EHEA_BMASK_GET(NEQE_EXTSWITCH_PORT_UP, eqe)) {
1241 port->phy_link = EHEA_PHY_LINK_UP; 1261 port->phy_link = EHEA_PHY_LINK_UP;
1242 if (netif_msg_link(port)) 1262 netif_info(port, link, dev,
1243 ehea_info("%s: Physical port up", 1263 "Physical port up\n");
1244 port->netdev->name);
1245 if (prop_carrier_state) 1264 if (prop_carrier_state)
1246 netif_carrier_on(port->netdev); 1265 netif_carrier_on(dev);
1247 } else { 1266 } else {
1248 port->phy_link = EHEA_PHY_LINK_DOWN; 1267 port->phy_link = EHEA_PHY_LINK_DOWN;
1249 if (netif_msg_link(port)) 1268 netif_info(port, link, dev,
1250 ehea_info("%s: Physical port down", 1269 "Physical port down\n");
1251 port->netdev->name);
1252 if (prop_carrier_state) 1270 if (prop_carrier_state)
1253 netif_carrier_off(port->netdev); 1271 netif_carrier_off(dev);
1254 } 1272 }
1255 1273
1256 if (EHEA_BMASK_GET(NEQE_EXTSWITCH_PRIMARY, eqe)) 1274 if (EHEA_BMASK_GET(NEQE_EXTSWITCH_PRIMARY, eqe))
1257 ehea_info("External switch port is primary port"); 1275 netdev_info(dev,
1276 "External switch port is primary port\n");
1258 else 1277 else
1259 ehea_info("External switch port is backup port"); 1278 netdev_info(dev,
1279 "External switch port is backup port\n");
1260 1280
1261 break; 1281 break;
1262 case EHEA_EC_ADAPTER_MALFUNC: 1282 case EHEA_EC_ADAPTER_MALFUNC:
1263 ehea_error("Adapter malfunction"); 1283 netdev_err(dev, "Adapter malfunction\n");
1264 break; 1284 break;
1265 case EHEA_EC_PORT_MALFUNC: 1285 case EHEA_EC_PORT_MALFUNC:
1266 ehea_info("Port malfunction: Device: %s", port->netdev->name); 1286 netdev_info(dev, "Port malfunction\n");
1267 netif_carrier_off(port->netdev); 1287 netif_carrier_off(dev);
1268 netif_stop_queue(port->netdev); 1288 netif_stop_queue(dev);
1269 break; 1289 break;
1270 default: 1290 default:
1271 ehea_error("unknown event code %x, eqe=0x%llX", ec, eqe); 1291 netdev_err(dev, "unknown event code %x, eqe=0x%llX\n", ec, eqe);
1272 break; 1292 break;
1273 } 1293 }
1274} 1294}
@@ -1280,13 +1300,13 @@ static void ehea_neq_tasklet(unsigned long data)
1280 u64 event_mask; 1300 u64 event_mask;
1281 1301
1282 eqe = ehea_poll_eq(adapter->neq); 1302 eqe = ehea_poll_eq(adapter->neq);
1283 ehea_debug("eqe=%p", eqe); 1303 pr_debug("eqe=%p\n", eqe);
1284 1304
1285 while (eqe) { 1305 while (eqe) {
1286 ehea_debug("*eqe=%lx", eqe->entry); 1306 pr_debug("*eqe=%lx\n", (unsigned long) eqe->entry);
1287 ehea_parse_eqe(adapter, eqe->entry); 1307 ehea_parse_eqe(adapter, eqe->entry);
1288 eqe = ehea_poll_eq(adapter->neq); 1308 eqe = ehea_poll_eq(adapter->neq);
1289 ehea_debug("next eqe=%p", eqe); 1309 pr_debug("next eqe=%p\n", eqe);
1290 } 1310 }
1291 1311
1292 event_mask = EHEA_BMASK_SET(NELR_PORTSTATE_CHG, 1) 1312 event_mask = EHEA_BMASK_SET(NELR_PORTSTATE_CHG, 1)
@@ -1310,9 +1330,7 @@ static int ehea_fill_port_res(struct ehea_port_res *pr)
1310 int ret; 1330 int ret;
1311 struct ehea_qp_init_attr *init_attr = &pr->qp->init_attr; 1331 struct ehea_qp_init_attr *init_attr = &pr->qp->init_attr;
1312 1332
1313 ehea_init_fill_rq1(pr, init_attr->act_nr_rwqes_rq1 1333 ehea_init_fill_rq1(pr, pr->rq1_skba.len);
1314 - init_attr->act_nr_rwqes_rq2
1315 - init_attr->act_nr_rwqes_rq3 - 1);
1316 1334
1317 ret = ehea_refill_rq2(pr, init_attr->act_nr_rwqes_rq2 - 1); 1335 ret = ehea_refill_rq2(pr, init_attr->act_nr_rwqes_rq2 - 1);
1318 1336
@@ -1335,14 +1353,14 @@ static int ehea_reg_interrupts(struct net_device *dev)
1335 ehea_qp_aff_irq_handler, 1353 ehea_qp_aff_irq_handler,
1336 IRQF_DISABLED, port->int_aff_name, port); 1354 IRQF_DISABLED, port->int_aff_name, port);
1337 if (ret) { 1355 if (ret) {
1338 ehea_error("failed registering irq for qp_aff_irq_handler:" 1356 netdev_err(dev, "failed registering irq for qp_aff_irq_handler:ist=%X\n",
1339 "ist=%X", port->qp_eq->attr.ist1); 1357 port->qp_eq->attr.ist1);
1340 goto out_free_qpeq; 1358 goto out_free_qpeq;
1341 } 1359 }
1342 1360
1343 if (netif_msg_ifup(port)) 1361 netif_info(port, ifup, dev,
1344 ehea_info("irq_handle 0x%X for function qp_aff_irq_handler " 1362 "irq_handle 0x%X for function qp_aff_irq_handler registered\n",
1345 "registered", port->qp_eq->attr.ist1); 1363 port->qp_eq->attr.ist1);
1346 1364
1347 1365
1348 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 1366 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
@@ -1354,14 +1372,13 @@ static int ehea_reg_interrupts(struct net_device *dev)
1354 IRQF_DISABLED, pr->int_send_name, 1372 IRQF_DISABLED, pr->int_send_name,
1355 pr); 1373 pr);
1356 if (ret) { 1374 if (ret) {
1357 ehea_error("failed registering irq for ehea_queue " 1375 netdev_err(dev, "failed registering irq for ehea_queue port_res_nr:%d, ist=%X\n",
1358 "port_res_nr:%d, ist=%X", i, 1376 i, pr->eq->attr.ist1);
1359 pr->eq->attr.ist1);
1360 goto out_free_req; 1377 goto out_free_req;
1361 } 1378 }
1362 if (netif_msg_ifup(port)) 1379 netif_info(port, ifup, dev,
1363 ehea_info("irq_handle 0x%X for function ehea_queue_int " 1380 "irq_handle 0x%X for function ehea_queue_int %d registered\n",
1364 "%d registered", pr->eq->attr.ist1, i); 1381 pr->eq->attr.ist1, i);
1365 } 1382 }
1366out: 1383out:
1367 return ret; 1384 return ret;
@@ -1392,16 +1409,16 @@ static void ehea_free_interrupts(struct net_device *dev)
1392 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 1409 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
1393 pr = &port->port_res[i]; 1410 pr = &port->port_res[i];
1394 ibmebus_free_irq(pr->eq->attr.ist1, pr); 1411 ibmebus_free_irq(pr->eq->attr.ist1, pr);
1395 if (netif_msg_intr(port)) 1412 netif_info(port, intr, dev,
1396 ehea_info("free send irq for res %d with handle 0x%X", 1413 "free send irq for res %d with handle 0x%X\n",
1397 i, pr->eq->attr.ist1); 1414 i, pr->eq->attr.ist1);
1398 } 1415 }
1399 1416
1400 /* associated events */ 1417 /* associated events */
1401 ibmebus_free_irq(port->qp_eq->attr.ist1, port); 1418 ibmebus_free_irq(port->qp_eq->attr.ist1, port);
1402 if (netif_msg_intr(port)) 1419 netif_info(port, intr, dev,
1403 ehea_info("associated event interrupt for handle 0x%X freed", 1420 "associated event interrupt for handle 0x%X freed\n",
1404 port->qp_eq->attr.ist1); 1421 port->qp_eq->attr.ist1);
1405} 1422}
1406 1423
1407static int ehea_configure_port(struct ehea_port *port) 1424static int ehea_configure_port(struct ehea_port *port)
@@ -1470,7 +1487,7 @@ int ehea_gen_smrs(struct ehea_port_res *pr)
1470out_free: 1487out_free:
1471 ehea_rem_mr(&pr->send_mr); 1488 ehea_rem_mr(&pr->send_mr);
1472out: 1489out:
1473 ehea_error("Generating SMRS failed\n"); 1490 pr_err("Generating SMRS failed\n");
1474 return -EIO; 1491 return -EIO;
1475} 1492}
1476 1493
@@ -1487,12 +1504,10 @@ static int ehea_init_q_skba(struct ehea_q_skb_arr *q_skba, int max_q_entries)
1487{ 1504{
1488 int arr_size = sizeof(void *) * max_q_entries; 1505 int arr_size = sizeof(void *) * max_q_entries;
1489 1506
1490 q_skba->arr = vmalloc(arr_size); 1507 q_skba->arr = vzalloc(arr_size);
1491 if (!q_skba->arr) 1508 if (!q_skba->arr)
1492 return -ENOMEM; 1509 return -ENOMEM;
1493 1510
1494 memset(q_skba->arr, 0, arr_size);
1495
1496 q_skba->len = max_q_entries; 1511 q_skba->len = max_q_entries;
1497 q_skba->index = 0; 1512 q_skba->index = 0;
1498 q_skba->os_skbs = 0; 1513 q_skba->os_skbs = 0;
@@ -1507,16 +1522,27 @@ static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr,
1507 enum ehea_eq_type eq_type = EHEA_EQ; 1522 enum ehea_eq_type eq_type = EHEA_EQ;
1508 struct ehea_qp_init_attr *init_attr = NULL; 1523 struct ehea_qp_init_attr *init_attr = NULL;
1509 int ret = -EIO; 1524 int ret = -EIO;
1525 u64 tx_bytes, rx_bytes, tx_packets, rx_packets;
1526
1527 tx_bytes = pr->tx_bytes;
1528 tx_packets = pr->tx_packets;
1529 rx_bytes = pr->rx_bytes;
1530 rx_packets = pr->rx_packets;
1510 1531
1511 memset(pr, 0, sizeof(struct ehea_port_res)); 1532 memset(pr, 0, sizeof(struct ehea_port_res));
1512 1533
1534 pr->tx_bytes = rx_bytes;
1535 pr->tx_packets = tx_packets;
1536 pr->rx_bytes = rx_bytes;
1537 pr->rx_packets = rx_packets;
1538
1513 pr->port = port; 1539 pr->port = port;
1514 spin_lock_init(&pr->xmit_lock); 1540 spin_lock_init(&pr->xmit_lock);
1515 spin_lock_init(&pr->netif_queue); 1541 spin_lock_init(&pr->netif_queue);
1516 1542
1517 pr->eq = ehea_create_eq(adapter, eq_type, EHEA_MAX_ENTRIES_EQ, 0); 1543 pr->eq = ehea_create_eq(adapter, eq_type, EHEA_MAX_ENTRIES_EQ, 0);
1518 if (!pr->eq) { 1544 if (!pr->eq) {
1519 ehea_error("create_eq failed (eq)"); 1545 pr_err("create_eq failed (eq)\n");
1520 goto out_free; 1546 goto out_free;
1521 } 1547 }
1522 1548
@@ -1524,7 +1550,7 @@ static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr,
1524 pr->eq->fw_handle, 1550 pr->eq->fw_handle,
1525 port->logical_port_id); 1551 port->logical_port_id);
1526 if (!pr->recv_cq) { 1552 if (!pr->recv_cq) {
1527 ehea_error("create_cq failed (cq_recv)"); 1553 pr_err("create_cq failed (cq_recv)\n");
1528 goto out_free; 1554 goto out_free;
1529 } 1555 }
1530 1556
@@ -1532,19 +1558,19 @@ static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr,
1532 pr->eq->fw_handle, 1558 pr->eq->fw_handle,
1533 port->logical_port_id); 1559 port->logical_port_id);
1534 if (!pr->send_cq) { 1560 if (!pr->send_cq) {
1535 ehea_error("create_cq failed (cq_send)"); 1561 pr_err("create_cq failed (cq_send)\n");
1536 goto out_free; 1562 goto out_free;
1537 } 1563 }
1538 1564
1539 if (netif_msg_ifup(port)) 1565 if (netif_msg_ifup(port))
1540 ehea_info("Send CQ: act_nr_cqes=%d, Recv CQ: act_nr_cqes=%d", 1566 pr_info("Send CQ: act_nr_cqes=%d, Recv CQ: act_nr_cqes=%d\n",
1541 pr->send_cq->attr.act_nr_of_cqes, 1567 pr->send_cq->attr.act_nr_of_cqes,
1542 pr->recv_cq->attr.act_nr_of_cqes); 1568 pr->recv_cq->attr.act_nr_of_cqes);
1543 1569
1544 init_attr = kzalloc(sizeof(*init_attr), GFP_KERNEL); 1570 init_attr = kzalloc(sizeof(*init_attr), GFP_KERNEL);
1545 if (!init_attr) { 1571 if (!init_attr) {
1546 ret = -ENOMEM; 1572 ret = -ENOMEM;
1547 ehea_error("no mem for ehea_qp_init_attr"); 1573 pr_err("no mem for ehea_qp_init_attr\n");
1548 goto out_free; 1574 goto out_free;
1549 } 1575 }
1550 1576
@@ -1569,18 +1595,18 @@ static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr,
1569 1595
1570 pr->qp = ehea_create_qp(adapter, adapter->pd, init_attr); 1596 pr->qp = ehea_create_qp(adapter, adapter->pd, init_attr);
1571 if (!pr->qp) { 1597 if (!pr->qp) {
1572 ehea_error("create_qp failed"); 1598 pr_err("create_qp failed\n");
1573 ret = -EIO; 1599 ret = -EIO;
1574 goto out_free; 1600 goto out_free;
1575 } 1601 }
1576 1602
1577 if (netif_msg_ifup(port)) 1603 if (netif_msg_ifup(port))
1578 ehea_info("QP: qp_nr=%d\n act_nr_snd_wqe=%d\n nr_rwqe_rq1=%d\n " 1604 pr_info("QP: qp_nr=%d\n act_nr_snd_wqe=%d\n nr_rwqe_rq1=%d\n nr_rwqe_rq2=%d\n nr_rwqe_rq3=%d\n",
1579 "nr_rwqe_rq2=%d\n nr_rwqe_rq3=%d", init_attr->qp_nr, 1605 init_attr->qp_nr,
1580 init_attr->act_nr_send_wqes, 1606 init_attr->act_nr_send_wqes,
1581 init_attr->act_nr_rwqes_rq1, 1607 init_attr->act_nr_rwqes_rq1,
1582 init_attr->act_nr_rwqes_rq2, 1608 init_attr->act_nr_rwqes_rq2,
1583 init_attr->act_nr_rwqes_rq3); 1609 init_attr->act_nr_rwqes_rq3);
1584 1610
1585 pr->sq_skba_size = init_attr->act_nr_send_wqes + 1; 1611 pr->sq_skba_size = init_attr->act_nr_send_wqes + 1;
1586 1612
@@ -1731,7 +1757,7 @@ static void write_swqe2_TSO(struct sk_buff *skb,
1731 swqe->descriptors++; 1757 swqe->descriptors++;
1732 } 1758 }
1733 } else 1759 } else
1734 ehea_error("cannot handle fragmented headers"); 1760 pr_err("cannot handle fragmented headers\n");
1735} 1761}
1736 1762
1737static void write_swqe2_nonTSO(struct sk_buff *skb, 1763static void write_swqe2_nonTSO(struct sk_buff *skb,
@@ -1827,8 +1853,8 @@ static int ehea_broadcast_reg_helper(struct ehea_port *port, u32 hcallid)
1827 port->logical_port_id, 1853 port->logical_port_id,
1828 reg_type, port->mac_addr, 0, hcallid); 1854 reg_type, port->mac_addr, 0, hcallid);
1829 if (hret != H_SUCCESS) { 1855 if (hret != H_SUCCESS) {
1830 ehea_error("%sregistering bc address failed (tagged)", 1856 pr_err("%sregistering bc address failed (tagged)\n",
1831 hcallid == H_REG_BCMC ? "" : "de"); 1857 hcallid == H_REG_BCMC ? "" : "de");
1832 ret = -EIO; 1858 ret = -EIO;
1833 goto out_herr; 1859 goto out_herr;
1834 } 1860 }
@@ -1839,8 +1865,8 @@ static int ehea_broadcast_reg_helper(struct ehea_port *port, u32 hcallid)
1839 port->logical_port_id, 1865 port->logical_port_id,
1840 reg_type, port->mac_addr, 0, hcallid); 1866 reg_type, port->mac_addr, 0, hcallid);
1841 if (hret != H_SUCCESS) { 1867 if (hret != H_SUCCESS) {
1842 ehea_error("%sregistering bc address failed (vlan)", 1868 pr_err("%sregistering bc address failed (vlan)\n",
1843 hcallid == H_REG_BCMC ? "" : "de"); 1869 hcallid == H_REG_BCMC ? "" : "de");
1844 ret = -EIO; 1870 ret = -EIO;
1845 } 1871 }
1846out_herr: 1872out_herr:
@@ -1862,7 +1888,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
1862 1888
1863 cb0 = (void *)get_zeroed_page(GFP_KERNEL); 1889 cb0 = (void *)get_zeroed_page(GFP_KERNEL);
1864 if (!cb0) { 1890 if (!cb0) {
1865 ehea_error("no mem for cb0"); 1891 pr_err("no mem for cb0\n");
1866 ret = -ENOMEM; 1892 ret = -ENOMEM;
1867 goto out; 1893 goto out;
1868 } 1894 }
@@ -1910,11 +1936,11 @@ out:
1910static void ehea_promiscuous_error(u64 hret, int enable) 1936static void ehea_promiscuous_error(u64 hret, int enable)
1911{ 1937{
1912 if (hret == H_AUTHORITY) 1938 if (hret == H_AUTHORITY)
1913 ehea_info("Hypervisor denied %sabling promiscuous mode", 1939 pr_info("Hypervisor denied %sabling promiscuous mode\n",
1914 enable == 1 ? "en" : "dis"); 1940 enable == 1 ? "en" : "dis");
1915 else 1941 else
1916 ehea_error("failed %sabling promiscuous mode", 1942 pr_err("failed %sabling promiscuous mode\n",
1917 enable == 1 ? "en" : "dis"); 1943 enable == 1 ? "en" : "dis");
1918} 1944}
1919 1945
1920static void ehea_promiscuous(struct net_device *dev, int enable) 1946static void ehea_promiscuous(struct net_device *dev, int enable)
@@ -1923,12 +1949,12 @@ static void ehea_promiscuous(struct net_device *dev, int enable)
1923 struct hcp_ehea_port_cb7 *cb7; 1949 struct hcp_ehea_port_cb7 *cb7;
1924 u64 hret; 1950 u64 hret;
1925 1951
1926 if ((enable && port->promisc) || (!enable && !port->promisc)) 1952 if (enable == port->promisc)
1927 return; 1953 return;
1928 1954
1929 cb7 = (void *)get_zeroed_page(GFP_ATOMIC); 1955 cb7 = (void *)get_zeroed_page(GFP_ATOMIC);
1930 if (!cb7) { 1956 if (!cb7) {
1931 ehea_error("no mem for cb7"); 1957 pr_err("no mem for cb7\n");
1932 goto out; 1958 goto out;
1933 } 1959 }
1934 1960
@@ -1988,7 +2014,7 @@ static int ehea_drop_multicast_list(struct net_device *dev)
1988 hret = ehea_multicast_reg_helper(port, mc_entry->macaddr, 2014 hret = ehea_multicast_reg_helper(port, mc_entry->macaddr,
1989 H_DEREG_BCMC); 2015 H_DEREG_BCMC);
1990 if (hret) { 2016 if (hret) {
1991 ehea_error("failed deregistering mcast MAC"); 2017 pr_err("failed deregistering mcast MAC\n");
1992 ret = -EIO; 2018 ret = -EIO;
1993 } 2019 }
1994 2020
@@ -2011,7 +2037,8 @@ static void ehea_allmulti(struct net_device *dev, int enable)
2011 if (!hret) 2037 if (!hret)
2012 port->allmulti = 1; 2038 port->allmulti = 1;
2013 else 2039 else
2014 ehea_error("failed enabling IFF_ALLMULTI"); 2040 netdev_err(dev,
2041 "failed enabling IFF_ALLMULTI\n");
2015 } 2042 }
2016 } else 2043 } else
2017 if (!enable) { 2044 if (!enable) {
@@ -2020,7 +2047,8 @@ static void ehea_allmulti(struct net_device *dev, int enable)
2020 if (!hret) 2047 if (!hret)
2021 port->allmulti = 0; 2048 port->allmulti = 0;
2022 else 2049 else
2023 ehea_error("failed disabling IFF_ALLMULTI"); 2050 netdev_err(dev,
2051 "failed disabling IFF_ALLMULTI\n");
2024 } 2052 }
2025} 2053}
2026 2054
@@ -2031,7 +2059,7 @@ static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr)
2031 2059
2032 ehea_mcl_entry = kzalloc(sizeof(*ehea_mcl_entry), GFP_ATOMIC); 2060 ehea_mcl_entry = kzalloc(sizeof(*ehea_mcl_entry), GFP_ATOMIC);
2033 if (!ehea_mcl_entry) { 2061 if (!ehea_mcl_entry) {
2034 ehea_error("no mem for mcl_entry"); 2062 pr_err("no mem for mcl_entry\n");
2035 return; 2063 return;
2036 } 2064 }
2037 2065
@@ -2044,7 +2072,7 @@ static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr)
2044 if (!hret) 2072 if (!hret)
2045 list_add(&ehea_mcl_entry->list, &port->mc_list->list); 2073 list_add(&ehea_mcl_entry->list, &port->mc_list->list);
2046 else { 2074 else {
2047 ehea_error("failed registering mcast MAC"); 2075 pr_err("failed registering mcast MAC\n");
2048 kfree(ehea_mcl_entry); 2076 kfree(ehea_mcl_entry);
2049 } 2077 }
2050} 2078}
@@ -2055,7 +2083,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
2055 struct netdev_hw_addr *ha; 2083 struct netdev_hw_addr *ha;
2056 int ret; 2084 int ret;
2057 2085
2058 if (dev->flags & IFF_PROMISC) { 2086 if (port->promisc) {
2059 ehea_promiscuous(dev, 1); 2087 ehea_promiscuous(dev, 1);
2060 return; 2088 return;
2061 } 2089 }
@@ -2077,9 +2105,8 @@ static void ehea_set_multicast_list(struct net_device *dev)
2077 } 2105 }
2078 2106
2079 if (netdev_mc_count(dev) > port->adapter->max_mc_mac) { 2107 if (netdev_mc_count(dev) > port->adapter->max_mc_mac) {
2080 ehea_info("Mcast registration limit reached (0x%llx). " 2108 pr_info("Mcast registration limit reached (0x%llx). Use ALLMULTI!\n",
2081 "Use ALLMULTI!", 2109 port->adapter->max_mc_mac);
2082 port->adapter->max_mc_mac);
2083 goto out; 2110 goto out;
2084 } 2111 }
2085 2112
@@ -2247,6 +2274,14 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
2247 memset(swqe, 0, SWQE_HEADER_SIZE); 2274 memset(swqe, 0, SWQE_HEADER_SIZE);
2248 atomic_dec(&pr->swqe_avail); 2275 atomic_dec(&pr->swqe_avail);
2249 2276
2277 if (vlan_tx_tag_present(skb)) {
2278 swqe->tx_control |= EHEA_SWQE_VLAN_INSERT;
2279 swqe->vlan_tag = vlan_tx_tag_get(skb);
2280 }
2281
2282 pr->tx_packets++;
2283 pr->tx_bytes += skb->len;
2284
2250 if (skb->len <= SWQE3_MAX_IMM) { 2285 if (skb->len <= SWQE3_MAX_IMM) {
2251 u32 sig_iv = port->sig_comp_iv; 2286 u32 sig_iv = port->sig_comp_iv;
2252 u32 swqe_num = pr->swqe_id_counter; 2287 u32 swqe_num = pr->swqe_id_counter;
@@ -2277,15 +2312,10 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
2277 } 2312 }
2278 pr->swqe_id_counter += 1; 2313 pr->swqe_id_counter += 1;
2279 2314
2280 if (port->vgrp && vlan_tx_tag_present(skb)) { 2315 netif_info(port, tx_queued, dev,
2281 swqe->tx_control |= EHEA_SWQE_VLAN_INSERT; 2316 "post swqe on QP %d\n", pr->qp->init_attr.qp_nr);
2282 swqe->vlan_tag = vlan_tx_tag_get(skb); 2317 if (netif_msg_tx_queued(port))
2283 }
2284
2285 if (netif_msg_tx_queued(port)) {
2286 ehea_info("post swqe on QP %d", pr->qp->init_attr.qp_nr);
2287 ehea_dump(swqe, 512, "swqe"); 2318 ehea_dump(swqe, 512, "swqe");
2288 }
2289 2319
2290 if (unlikely(test_bit(__EHEA_STOP_XFER, &ehea_driver_flags))) { 2320 if (unlikely(test_bit(__EHEA_STOP_XFER, &ehea_driver_flags))) {
2291 netif_stop_queue(dev); 2321 netif_stop_queue(dev);
@@ -2293,7 +2323,6 @@ static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
2293 } 2323 }
2294 2324
2295 ehea_post_swqe(pr->qp, swqe); 2325 ehea_post_swqe(pr->qp, swqe);
2296 pr->tx_packets++;
2297 2326
2298 if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) { 2327 if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
2299 spin_lock_irqsave(&pr->netif_queue, flags); 2328 spin_lock_irqsave(&pr->netif_queue, flags);
@@ -2322,14 +2351,14 @@ static void ehea_vlan_rx_register(struct net_device *dev,
2322 2351
2323 cb1 = (void *)get_zeroed_page(GFP_KERNEL); 2352 cb1 = (void *)get_zeroed_page(GFP_KERNEL);
2324 if (!cb1) { 2353 if (!cb1) {
2325 ehea_error("no mem for cb1"); 2354 pr_err("no mem for cb1\n");
2326 goto out; 2355 goto out;
2327 } 2356 }
2328 2357
2329 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, 2358 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
2330 H_PORT_CB1, H_PORT_CB1_ALL, cb1); 2359 H_PORT_CB1, H_PORT_CB1_ALL, cb1);
2331 if (hret != H_SUCCESS) 2360 if (hret != H_SUCCESS)
2332 ehea_error("modify_ehea_port failed"); 2361 pr_err("modify_ehea_port failed\n");
2333 2362
2334 free_page((unsigned long)cb1); 2363 free_page((unsigned long)cb1);
2335out: 2364out:
@@ -2346,14 +2375,14 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
2346 2375
2347 cb1 = (void *)get_zeroed_page(GFP_KERNEL); 2376 cb1 = (void *)get_zeroed_page(GFP_KERNEL);
2348 if (!cb1) { 2377 if (!cb1) {
2349 ehea_error("no mem for cb1"); 2378 pr_err("no mem for cb1\n");
2350 goto out; 2379 goto out;
2351 } 2380 }
2352 2381
2353 hret = ehea_h_query_ehea_port(adapter->handle, port->logical_port_id, 2382 hret = ehea_h_query_ehea_port(adapter->handle, port->logical_port_id,
2354 H_PORT_CB1, H_PORT_CB1_ALL, cb1); 2383 H_PORT_CB1, H_PORT_CB1_ALL, cb1);
2355 if (hret != H_SUCCESS) { 2384 if (hret != H_SUCCESS) {
2356 ehea_error("query_ehea_port failed"); 2385 pr_err("query_ehea_port failed\n");
2357 goto out; 2386 goto out;
2358 } 2387 }
2359 2388
@@ -2363,7 +2392,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
2363 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, 2392 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
2364 H_PORT_CB1, H_PORT_CB1_ALL, cb1); 2393 H_PORT_CB1, H_PORT_CB1_ALL, cb1);
2365 if (hret != H_SUCCESS) 2394 if (hret != H_SUCCESS)
2366 ehea_error("modify_ehea_port failed"); 2395 pr_err("modify_ehea_port failed\n");
2367out: 2396out:
2368 free_page((unsigned long)cb1); 2397 free_page((unsigned long)cb1);
2369 return; 2398 return;
@@ -2381,14 +2410,14 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2381 2410
2382 cb1 = (void *)get_zeroed_page(GFP_KERNEL); 2411 cb1 = (void *)get_zeroed_page(GFP_KERNEL);
2383 if (!cb1) { 2412 if (!cb1) {
2384 ehea_error("no mem for cb1"); 2413 pr_err("no mem for cb1\n");
2385 goto out; 2414 goto out;
2386 } 2415 }
2387 2416
2388 hret = ehea_h_query_ehea_port(adapter->handle, port->logical_port_id, 2417 hret = ehea_h_query_ehea_port(adapter->handle, port->logical_port_id,
2389 H_PORT_CB1, H_PORT_CB1_ALL, cb1); 2418 H_PORT_CB1, H_PORT_CB1_ALL, cb1);
2390 if (hret != H_SUCCESS) { 2419 if (hret != H_SUCCESS) {
2391 ehea_error("query_ehea_port failed"); 2420 pr_err("query_ehea_port failed\n");
2392 goto out; 2421 goto out;
2393 } 2422 }
2394 2423
@@ -2398,7 +2427,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2398 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id, 2427 hret = ehea_h_modify_ehea_port(adapter->handle, port->logical_port_id,
2399 H_PORT_CB1, H_PORT_CB1_ALL, cb1); 2428 H_PORT_CB1, H_PORT_CB1_ALL, cb1);
2400 if (hret != H_SUCCESS) 2429 if (hret != H_SUCCESS)
2401 ehea_error("modify_ehea_port failed"); 2430 pr_err("modify_ehea_port failed\n");
2402out: 2431out:
2403 free_page((unsigned long)cb1); 2432 free_page((unsigned long)cb1);
2404} 2433}
@@ -2420,7 +2449,7 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
2420 hret = ehea_h_query_ehea_qp(adapter->handle, 0, qp->fw_handle, 2449 hret = ehea_h_query_ehea_qp(adapter->handle, 0, qp->fw_handle,
2421 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), cb0); 2450 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), cb0);
2422 if (hret != H_SUCCESS) { 2451 if (hret != H_SUCCESS) {
2423 ehea_error("query_ehea_qp failed (1)"); 2452 pr_err("query_ehea_qp failed (1)\n");
2424 goto out; 2453 goto out;
2425 } 2454 }
2426 2455
@@ -2429,14 +2458,14 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
2429 EHEA_BMASK_SET(H_QPCB0_QP_CTL_REG, 1), cb0, 2458 EHEA_BMASK_SET(H_QPCB0_QP_CTL_REG, 1), cb0,
2430 &dummy64, &dummy64, &dummy16, &dummy16); 2459 &dummy64, &dummy64, &dummy16, &dummy16);
2431 if (hret != H_SUCCESS) { 2460 if (hret != H_SUCCESS) {
2432 ehea_error("modify_ehea_qp failed (1)"); 2461 pr_err("modify_ehea_qp failed (1)\n");
2433 goto out; 2462 goto out;
2434 } 2463 }
2435 2464
2436 hret = ehea_h_query_ehea_qp(adapter->handle, 0, qp->fw_handle, 2465 hret = ehea_h_query_ehea_qp(adapter->handle, 0, qp->fw_handle,
2437 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), cb0); 2466 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), cb0);
2438 if (hret != H_SUCCESS) { 2467 if (hret != H_SUCCESS) {
2439 ehea_error("query_ehea_qp failed (2)"); 2468 pr_err("query_ehea_qp failed (2)\n");
2440 goto out; 2469 goto out;
2441 } 2470 }
2442 2471
@@ -2445,14 +2474,14 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
2445 EHEA_BMASK_SET(H_QPCB0_QP_CTL_REG, 1), cb0, 2474 EHEA_BMASK_SET(H_QPCB0_QP_CTL_REG, 1), cb0,
2446 &dummy64, &dummy64, &dummy16, &dummy16); 2475 &dummy64, &dummy64, &dummy16, &dummy16);
2447 if (hret != H_SUCCESS) { 2476 if (hret != H_SUCCESS) {
2448 ehea_error("modify_ehea_qp failed (2)"); 2477 pr_err("modify_ehea_qp failed (2)\n");
2449 goto out; 2478 goto out;
2450 } 2479 }
2451 2480
2452 hret = ehea_h_query_ehea_qp(adapter->handle, 0, qp->fw_handle, 2481 hret = ehea_h_query_ehea_qp(adapter->handle, 0, qp->fw_handle,
2453 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), cb0); 2482 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), cb0);
2454 if (hret != H_SUCCESS) { 2483 if (hret != H_SUCCESS) {
2455 ehea_error("query_ehea_qp failed (3)"); 2484 pr_err("query_ehea_qp failed (3)\n");
2456 goto out; 2485 goto out;
2457 } 2486 }
2458 2487
@@ -2461,14 +2490,14 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
2461 EHEA_BMASK_SET(H_QPCB0_QP_CTL_REG, 1), cb0, 2490 EHEA_BMASK_SET(H_QPCB0_QP_CTL_REG, 1), cb0,
2462 &dummy64, &dummy64, &dummy16, &dummy16); 2491 &dummy64, &dummy64, &dummy16, &dummy16);
2463 if (hret != H_SUCCESS) { 2492 if (hret != H_SUCCESS) {
2464 ehea_error("modify_ehea_qp failed (3)"); 2493 pr_err("modify_ehea_qp failed (3)\n");
2465 goto out; 2494 goto out;
2466 } 2495 }
2467 2496
2468 hret = ehea_h_query_ehea_qp(adapter->handle, 0, qp->fw_handle, 2497 hret = ehea_h_query_ehea_qp(adapter->handle, 0, qp->fw_handle,
2469 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), cb0); 2498 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), cb0);
2470 if (hret != H_SUCCESS) { 2499 if (hret != H_SUCCESS) {
2471 ehea_error("query_ehea_qp failed (4)"); 2500 pr_err("query_ehea_qp failed (4)\n");
2472 goto out; 2501 goto out;
2473 } 2502 }
2474 2503
@@ -2489,7 +2518,7 @@ static int ehea_port_res_setup(struct ehea_port *port, int def_qps,
2489 EHEA_MAX_ENTRIES_EQ, 1); 2518 EHEA_MAX_ENTRIES_EQ, 1);
2490 if (!port->qp_eq) { 2519 if (!port->qp_eq) {
2491 ret = -EINVAL; 2520 ret = -EINVAL;
2492 ehea_error("ehea_create_eq failed (qp_eq)"); 2521 pr_err("ehea_create_eq failed (qp_eq)\n");
2493 goto out_kill_eq; 2522 goto out_kill_eq;
2494 } 2523 }
2495 2524
@@ -2570,27 +2599,27 @@ static int ehea_up(struct net_device *dev)
2570 ret = ehea_port_res_setup(port, port->num_def_qps, 2599 ret = ehea_port_res_setup(port, port->num_def_qps,
2571 port->num_add_tx_qps); 2600 port->num_add_tx_qps);
2572 if (ret) { 2601 if (ret) {
2573 ehea_error("port_res_failed"); 2602 netdev_err(dev, "port_res_failed\n");
2574 goto out; 2603 goto out;
2575 } 2604 }
2576 2605
2577 /* Set default QP for this port */ 2606 /* Set default QP for this port */
2578 ret = ehea_configure_port(port); 2607 ret = ehea_configure_port(port);
2579 if (ret) { 2608 if (ret) {
2580 ehea_error("ehea_configure_port failed. ret:%d", ret); 2609 netdev_err(dev, "ehea_configure_port failed. ret:%d\n", ret);
2581 goto out_clean_pr; 2610 goto out_clean_pr;
2582 } 2611 }
2583 2612
2584 ret = ehea_reg_interrupts(dev); 2613 ret = ehea_reg_interrupts(dev);
2585 if (ret) { 2614 if (ret) {
2586 ehea_error("reg_interrupts failed. ret:%d", ret); 2615 netdev_err(dev, "reg_interrupts failed. ret:%d\n", ret);
2587 goto out_clean_pr; 2616 goto out_clean_pr;
2588 } 2617 }
2589 2618
2590 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 2619 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
2591 ret = ehea_activate_qp(port->adapter, port->port_res[i].qp); 2620 ret = ehea_activate_qp(port->adapter, port->port_res[i].qp);
2592 if (ret) { 2621 if (ret) {
2593 ehea_error("activate_qp failed"); 2622 netdev_err(dev, "activate_qp failed\n");
2594 goto out_free_irqs; 2623 goto out_free_irqs;
2595 } 2624 }
2596 } 2625 }
@@ -2598,7 +2627,7 @@ static int ehea_up(struct net_device *dev)
2598 for (i = 0; i < port->num_def_qps; i++) { 2627 for (i = 0; i < port->num_def_qps; i++) {
2599 ret = ehea_fill_port_res(&port->port_res[i]); 2628 ret = ehea_fill_port_res(&port->port_res[i]);
2600 if (ret) { 2629 if (ret) {
2601 ehea_error("out_free_irqs"); 2630 netdev_err(dev, "out_free_irqs\n");
2602 goto out_free_irqs; 2631 goto out_free_irqs;
2603 } 2632 }
2604 } 2633 }
@@ -2621,7 +2650,7 @@ out_clean_pr:
2621 ehea_clean_all_portres(port); 2650 ehea_clean_all_portres(port);
2622out: 2651out:
2623 if (ret) 2652 if (ret)
2624 ehea_info("Failed starting %s. ret=%i", dev->name, ret); 2653 netdev_info(dev, "Failed starting. ret=%i\n", ret);
2625 2654
2626 ehea_update_bcmc_registrations(); 2655 ehea_update_bcmc_registrations();
2627 ehea_update_firmware_handles(); 2656 ehea_update_firmware_handles();
@@ -2652,8 +2681,7 @@ static int ehea_open(struct net_device *dev)
2652 2681
2653 mutex_lock(&port->port_lock); 2682 mutex_lock(&port->port_lock);
2654 2683
2655 if (netif_msg_ifup(port)) 2684 netif_info(port, ifup, dev, "enabling port\n");
2656 ehea_info("enabling port %s", dev->name);
2657 2685
2658 ret = ehea_up(dev); 2686 ret = ehea_up(dev);
2659 if (!ret) { 2687 if (!ret) {
@@ -2685,8 +2713,7 @@ static int ehea_down(struct net_device *dev)
2685 2713
2686 ret = ehea_clean_all_portres(port); 2714 ret = ehea_clean_all_portres(port);
2687 if (ret) 2715 if (ret)
2688 ehea_info("Failed freeing resources for %s. ret=%i", 2716 netdev_info(dev, "Failed freeing resources. ret=%i\n", ret);
2689 dev->name, ret);
2690 2717
2691 ehea_update_firmware_handles(); 2718 ehea_update_firmware_handles();
2692 2719
@@ -2698,8 +2725,7 @@ static int ehea_stop(struct net_device *dev)
2698 int ret; 2725 int ret;
2699 struct ehea_port *port = netdev_priv(dev); 2726 struct ehea_port *port = netdev_priv(dev);
2700 2727
2701 if (netif_msg_ifdown(port)) 2728 netif_info(port, ifdown, dev, "disabling port\n");
2702 ehea_info("disabling port %s", dev->name);
2703 2729
2704 set_bit(__EHEA_DISABLE_PORT_RESET, &port->flags); 2730 set_bit(__EHEA_DISABLE_PORT_RESET, &port->flags);
2705 cancel_work_sync(&port->reset_task); 2731 cancel_work_sync(&port->reset_task);
@@ -2733,13 +2759,15 @@ static void ehea_flush_sq(struct ehea_port *port)
2733 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 2759 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
2734 struct ehea_port_res *pr = &port->port_res[i]; 2760 struct ehea_port_res *pr = &port->port_res[i];
2735 int swqe_max = pr->sq_skba_size - 2 - pr->swqe_ll_count; 2761 int swqe_max = pr->sq_skba_size - 2 - pr->swqe_ll_count;
2736 int k = 0; 2762 int ret;
2737 while (atomic_read(&pr->swqe_avail) < swqe_max) { 2763
2738 msleep(5); 2764 ret = wait_event_timeout(port->swqe_avail_wq,
2739 if (++k == 20) { 2765 atomic_read(&pr->swqe_avail) >= swqe_max,
2740 ehea_error("WARNING: sq not flushed completely"); 2766 msecs_to_jiffies(100));
2741 break; 2767
2742 } 2768 if (!ret) {
2769 pr_err("WARNING: sq not flushed completely\n");
2770 break;
2743 } 2771 }
2744 } 2772 }
2745} 2773}
@@ -2774,7 +2802,7 @@ int ehea_stop_qps(struct net_device *dev)
2774 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), 2802 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF),
2775 cb0); 2803 cb0);
2776 if (hret != H_SUCCESS) { 2804 if (hret != H_SUCCESS) {
2777 ehea_error("query_ehea_qp failed (1)"); 2805 pr_err("query_ehea_qp failed (1)\n");
2778 goto out; 2806 goto out;
2779 } 2807 }
2780 2808
@@ -2786,7 +2814,7 @@ int ehea_stop_qps(struct net_device *dev)
2786 1), cb0, &dummy64, 2814 1), cb0, &dummy64,
2787 &dummy64, &dummy16, &dummy16); 2815 &dummy64, &dummy16, &dummy16);
2788 if (hret != H_SUCCESS) { 2816 if (hret != H_SUCCESS) {
2789 ehea_error("modify_ehea_qp failed (1)"); 2817 pr_err("modify_ehea_qp failed (1)\n");
2790 goto out; 2818 goto out;
2791 } 2819 }
2792 2820
@@ -2794,14 +2822,14 @@ int ehea_stop_qps(struct net_device *dev)
2794 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), 2822 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF),
2795 cb0); 2823 cb0);
2796 if (hret != H_SUCCESS) { 2824 if (hret != H_SUCCESS) {
2797 ehea_error("query_ehea_qp failed (2)"); 2825 pr_err("query_ehea_qp failed (2)\n");
2798 goto out; 2826 goto out;
2799 } 2827 }
2800 2828
2801 /* deregister shared memory regions */ 2829 /* deregister shared memory regions */
2802 dret = ehea_rem_smrs(pr); 2830 dret = ehea_rem_smrs(pr);
2803 if (dret) { 2831 if (dret) {
2804 ehea_error("unreg shared memory region failed"); 2832 pr_err("unreg shared memory region failed\n");
2805 goto out; 2833 goto out;
2806 } 2834 }
2807 } 2835 }
@@ -2870,7 +2898,7 @@ int ehea_restart_qps(struct net_device *dev)
2870 2898
2871 ret = ehea_gen_smrs(pr); 2899 ret = ehea_gen_smrs(pr);
2872 if (ret) { 2900 if (ret) {
2873 ehea_error("creation of shared memory regions failed"); 2901 netdev_err(dev, "creation of shared memory regions failed\n");
2874 goto out; 2902 goto out;
2875 } 2903 }
2876 2904
@@ -2881,7 +2909,7 @@ int ehea_restart_qps(struct net_device *dev)
2881 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), 2909 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF),
2882 cb0); 2910 cb0);
2883 if (hret != H_SUCCESS) { 2911 if (hret != H_SUCCESS) {
2884 ehea_error("query_ehea_qp failed (1)"); 2912 netdev_err(dev, "query_ehea_qp failed (1)\n");
2885 goto out; 2913 goto out;
2886 } 2914 }
2887 2915
@@ -2893,7 +2921,7 @@ int ehea_restart_qps(struct net_device *dev)
2893 1), cb0, &dummy64, 2921 1), cb0, &dummy64,
2894 &dummy64, &dummy16, &dummy16); 2922 &dummy64, &dummy16, &dummy16);
2895 if (hret != H_SUCCESS) { 2923 if (hret != H_SUCCESS) {
2896 ehea_error("modify_ehea_qp failed (1)"); 2924 netdev_err(dev, "modify_ehea_qp failed (1)\n");
2897 goto out; 2925 goto out;
2898 } 2926 }
2899 2927
@@ -2901,7 +2929,7 @@ int ehea_restart_qps(struct net_device *dev)
2901 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF), 2929 EHEA_BMASK_SET(H_QPCB0_ALL, 0xFFFF),
2902 cb0); 2930 cb0);
2903 if (hret != H_SUCCESS) { 2931 if (hret != H_SUCCESS) {
2904 ehea_error("query_ehea_qp failed (2)"); 2932 netdev_err(dev, "query_ehea_qp failed (2)\n");
2905 goto out; 2933 goto out;
2906 } 2934 }
2907 2935
@@ -2938,8 +2966,7 @@ static void ehea_reset_port(struct work_struct *work)
2938 2966
2939 ehea_set_multicast_list(dev); 2967 ehea_set_multicast_list(dev);
2940 2968
2941 if (netif_msg_timer(port)) 2969 netif_info(port, timer, dev, "reset successful\n");
2942 ehea_info("Device %s resetted successfully", dev->name);
2943 2970
2944 port_napi_enable(port); 2971 port_napi_enable(port);
2945 2972
@@ -2949,12 +2976,12 @@ out:
2949 mutex_unlock(&dlpar_mem_lock); 2976 mutex_unlock(&dlpar_mem_lock);
2950} 2977}
2951 2978
2952static void ehea_rereg_mrs(struct work_struct *work) 2979static void ehea_rereg_mrs(void)
2953{ 2980{
2954 int ret, i; 2981 int ret, i;
2955 struct ehea_adapter *adapter; 2982 struct ehea_adapter *adapter;
2956 2983
2957 ehea_info("LPAR memory changed - re-initializing driver"); 2984 pr_info("LPAR memory changed - re-initializing driver\n");
2958 2985
2959 list_for_each_entry(adapter, &adapter_list, list) 2986 list_for_each_entry(adapter, &adapter_list, list)
2960 if (adapter->active_ports) { 2987 if (adapter->active_ports) {
@@ -2986,8 +3013,7 @@ static void ehea_rereg_mrs(struct work_struct *work)
2986 /* Unregister old memory region */ 3013 /* Unregister old memory region */
2987 ret = ehea_rem_mr(&adapter->mr); 3014 ret = ehea_rem_mr(&adapter->mr);
2988 if (ret) { 3015 if (ret) {
2989 ehea_error("unregister MR failed - driver" 3016 pr_err("unregister MR failed - driver inoperable!\n");
2990 " inoperable!");
2991 goto out; 3017 goto out;
2992 } 3018 }
2993 } 3019 }
@@ -2999,8 +3025,7 @@ static void ehea_rereg_mrs(struct work_struct *work)
2999 /* Register new memory region */ 3025 /* Register new memory region */
3000 ret = ehea_reg_kernel_mr(adapter, &adapter->mr); 3026 ret = ehea_reg_kernel_mr(adapter, &adapter->mr);
3001 if (ret) { 3027 if (ret) {
3002 ehea_error("register MR failed - driver" 3028 pr_err("register MR failed - driver inoperable!\n");
3003 " inoperable!");
3004 goto out; 3029 goto out;
3005 } 3030 }
3006 3031
@@ -3013,17 +3038,20 @@ static void ehea_rereg_mrs(struct work_struct *work)
3013 3038
3014 if (dev->flags & IFF_UP) { 3039 if (dev->flags & IFF_UP) {
3015 mutex_lock(&port->port_lock); 3040 mutex_lock(&port->port_lock);
3016 port_napi_enable(port);
3017 ret = ehea_restart_qps(dev); 3041 ret = ehea_restart_qps(dev);
3018 check_sqs(port); 3042 if (!ret) {
3019 if (!ret) 3043 check_sqs(port);
3044 port_napi_enable(port);
3020 netif_wake_queue(dev); 3045 netif_wake_queue(dev);
3046 } else {
3047 netdev_err(dev, "Unable to restart QPS\n");
3048 }
3021 mutex_unlock(&port->port_lock); 3049 mutex_unlock(&port->port_lock);
3022 } 3050 }
3023 } 3051 }
3024 } 3052 }
3025 } 3053 }
3026 ehea_info("re-initializing driver complete"); 3054 pr_info("re-initializing driver complete\n");
3027out: 3055out:
3028 return; 3056 return;
3029} 3057}
@@ -3076,7 +3104,7 @@ int ehea_get_jumboframe_status(struct ehea_port *port, int *jumbo)
3076 /* (Try to) enable *jumbo frames */ 3104 /* (Try to) enable *jumbo frames */
3077 cb4 = (void *)get_zeroed_page(GFP_KERNEL); 3105 cb4 = (void *)get_zeroed_page(GFP_KERNEL);
3078 if (!cb4) { 3106 if (!cb4) {
3079 ehea_error("no mem for cb4"); 3107 pr_err("no mem for cb4\n");
3080 ret = -ENOMEM; 3108 ret = -ENOMEM;
3081 goto out; 3109 goto out;
3082 } else { 3110 } else {
@@ -3138,13 +3166,13 @@ static struct device *ehea_register_port(struct ehea_port *port,
3138 3166
3139 ret = of_device_register(&port->ofdev); 3167 ret = of_device_register(&port->ofdev);
3140 if (ret) { 3168 if (ret) {
3141 ehea_error("failed to register device. ret=%d", ret); 3169 pr_err("failed to register device. ret=%d\n", ret);
3142 goto out; 3170 goto out;
3143 } 3171 }
3144 3172
3145 ret = device_create_file(&port->ofdev.dev, &dev_attr_log_port_id); 3173 ret = device_create_file(&port->ofdev.dev, &dev_attr_log_port_id);
3146 if (ret) { 3174 if (ret) {
3147 ehea_error("failed to register attributes, ret=%d", ret); 3175 pr_err("failed to register attributes, ret=%d\n", ret);
3148 goto out_unreg_of_dev; 3176 goto out_unreg_of_dev;
3149 } 3177 }
3150 3178
@@ -3194,7 +3222,7 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
3194 dev = alloc_etherdev(sizeof(struct ehea_port)); 3222 dev = alloc_etherdev(sizeof(struct ehea_port));
3195 3223
3196 if (!dev) { 3224 if (!dev) {
3197 ehea_error("no mem for net_device"); 3225 pr_err("no mem for net_device\n");
3198 ret = -ENOMEM; 3226 ret = -ENOMEM;
3199 goto out_err; 3227 goto out_err;
3200 } 3228 }
@@ -3235,17 +3263,25 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
3235 dev->netdev_ops = &ehea_netdev_ops; 3263 dev->netdev_ops = &ehea_netdev_ops;
3236 ehea_set_ethtool_ops(dev); 3264 ehea_set_ethtool_ops(dev);
3237 3265
3266 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
3267 | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX | NETIF_F_LRO;
3238 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO 3268 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
3239 | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX 3269 | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
3240 | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER 3270 | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER
3241 | NETIF_F_LLTX; 3271 | NETIF_F_LLTX | NETIF_F_RXCSUM;
3242 dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; 3272 dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
3243 3273
3274 if (use_lro)
3275 dev->features |= NETIF_F_LRO;
3276
3244 INIT_WORK(&port->reset_task, ehea_reset_port); 3277 INIT_WORK(&port->reset_task, ehea_reset_port);
3245 3278
3279 init_waitqueue_head(&port->swqe_avail_wq);
3280 init_waitqueue_head(&port->restart_wq);
3281
3246 ret = register_netdev(dev); 3282 ret = register_netdev(dev);
3247 if (ret) { 3283 if (ret) {
3248 ehea_error("register_netdev failed. ret=%d", ret); 3284 pr_err("register_netdev failed. ret=%d\n", ret);
3249 goto out_unreg_port; 3285 goto out_unreg_port;
3250 } 3286 }
3251 3287
@@ -3253,11 +3289,10 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
3253 3289
3254 ret = ehea_get_jumboframe_status(port, &jumbo); 3290 ret = ehea_get_jumboframe_status(port, &jumbo);
3255 if (ret) 3291 if (ret)
3256 ehea_error("failed determining jumbo frame status for %s", 3292 netdev_err(dev, "failed determining jumbo frame status\n");
3257 port->netdev->name);
3258 3293
3259 ehea_info("%s: Jumbo frames are %sabled", dev->name, 3294 netdev_info(dev, "Jumbo frames are %sabled\n",
3260 jumbo == 1 ? "en" : "dis"); 3295 jumbo == 1 ? "en" : "dis");
3261 3296
3262 adapter->active_ports++; 3297 adapter->active_ports++;
3263 3298
@@ -3273,14 +3308,16 @@ out_free_ethdev:
3273 free_netdev(dev); 3308 free_netdev(dev);
3274 3309
3275out_err: 3310out_err:
3276 ehea_error("setting up logical port with id=%d failed, ret=%d", 3311 pr_err("setting up logical port with id=%d failed, ret=%d\n",
3277 logical_port_id, ret); 3312 logical_port_id, ret);
3278 return NULL; 3313 return NULL;
3279} 3314}
3280 3315
3281static void ehea_shutdown_single_port(struct ehea_port *port) 3316static void ehea_shutdown_single_port(struct ehea_port *port)
3282{ 3317{
3283 struct ehea_adapter *adapter = port->adapter; 3318 struct ehea_adapter *adapter = port->adapter;
3319
3320 cancel_work_sync(&port->reset_task);
3284 unregister_netdev(port->netdev); 3321 unregister_netdev(port->netdev);
3285 ehea_unregister_port(port); 3322 ehea_unregister_port(port);
3286 kfree(port->mc_list); 3323 kfree(port->mc_list);
@@ -3302,13 +3339,13 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
3302 dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", 3339 dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
3303 NULL); 3340 NULL);
3304 if (!dn_log_port_id) { 3341 if (!dn_log_port_id) {
3305 ehea_error("bad device node: eth_dn name=%s", 3342 pr_err("bad device node: eth_dn name=%s\n",
3306 eth_dn->full_name); 3343 eth_dn->full_name);
3307 continue; 3344 continue;
3308 } 3345 }
3309 3346
3310 if (ehea_add_adapter_mr(adapter)) { 3347 if (ehea_add_adapter_mr(adapter)) {
3311 ehea_error("creating MR failed"); 3348 pr_err("creating MR failed\n");
3312 of_node_put(eth_dn); 3349 of_node_put(eth_dn);
3313 return -EIO; 3350 return -EIO;
3314 } 3351 }
@@ -3317,9 +3354,8 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
3317 *dn_log_port_id, 3354 *dn_log_port_id,
3318 eth_dn); 3355 eth_dn);
3319 if (adapter->port[i]) 3356 if (adapter->port[i])
3320 ehea_info("%s -> logical port id #%d", 3357 netdev_info(adapter->port[i]->netdev,
3321 adapter->port[i]->netdev->name, 3358 "logical port id #%d\n", *dn_log_port_id);
3322 *dn_log_port_id);
3323 else 3359 else
3324 ehea_remove_adapter_mr(adapter); 3360 ehea_remove_adapter_mr(adapter);
3325 3361
@@ -3364,21 +3400,20 @@ static ssize_t ehea_probe_port(struct device *dev,
3364 port = ehea_get_port(adapter, logical_port_id); 3400 port = ehea_get_port(adapter, logical_port_id);
3365 3401
3366 if (port) { 3402 if (port) {
3367 ehea_info("adding port with logical port id=%d failed. port " 3403 netdev_info(port->netdev, "adding port with logical port id=%d failed: port already configured\n",
3368 "already configured as %s.", logical_port_id, 3404 logical_port_id);
3369 port->netdev->name);
3370 return -EINVAL; 3405 return -EINVAL;
3371 } 3406 }
3372 3407
3373 eth_dn = ehea_get_eth_dn(adapter, logical_port_id); 3408 eth_dn = ehea_get_eth_dn(adapter, logical_port_id);
3374 3409
3375 if (!eth_dn) { 3410 if (!eth_dn) {
3376 ehea_info("no logical port with id %d found", logical_port_id); 3411 pr_info("no logical port with id %d found\n", logical_port_id);
3377 return -EINVAL; 3412 return -EINVAL;
3378 } 3413 }
3379 3414
3380 if (ehea_add_adapter_mr(adapter)) { 3415 if (ehea_add_adapter_mr(adapter)) {
3381 ehea_error("creating MR failed"); 3416 pr_err("creating MR failed\n");
3382 return -EIO; 3417 return -EIO;
3383 } 3418 }
3384 3419
@@ -3393,8 +3428,8 @@ static ssize_t ehea_probe_port(struct device *dev,
3393 break; 3428 break;
3394 } 3429 }
3395 3430
3396 ehea_info("added %s (logical port id=%d)", port->netdev->name, 3431 netdev_info(port->netdev, "added: (logical port id=%d)\n",
3397 logical_port_id); 3432 logical_port_id);
3398 } else { 3433 } else {
3399 ehea_remove_adapter_mr(adapter); 3434 ehea_remove_adapter_mr(adapter);
3400 return -EIO; 3435 return -EIO;
@@ -3417,8 +3452,8 @@ static ssize_t ehea_remove_port(struct device *dev,
3417 port = ehea_get_port(adapter, logical_port_id); 3452 port = ehea_get_port(adapter, logical_port_id);
3418 3453
3419 if (port) { 3454 if (port) {
3420 ehea_info("removed %s (logical port id=%d)", port->netdev->name, 3455 netdev_info(port->netdev, "removed: (logical port id=%d)\n",
3421 logical_port_id); 3456 logical_port_id);
3422 3457
3423 ehea_shutdown_single_port(port); 3458 ehea_shutdown_single_port(port);
3424 3459
@@ -3428,8 +3463,8 @@ static ssize_t ehea_remove_port(struct device *dev,
3428 break; 3463 break;
3429 } 3464 }
3430 } else { 3465 } else {
3431 ehea_error("removing port with logical port id=%d failed. port " 3466 pr_err("removing port with logical port id=%d failed. port not configured.\n",
3432 "not configured.", logical_port_id); 3467 logical_port_id);
3433 return -EINVAL; 3468 return -EINVAL;
3434 } 3469 }
3435 3470
@@ -3466,7 +3501,7 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev,
3466 int ret; 3501 int ret;
3467 3502
3468 if (!dev || !dev->dev.of_node) { 3503 if (!dev || !dev->dev.of_node) {
3469 ehea_error("Invalid ibmebus device probed"); 3504 pr_err("Invalid ibmebus device probed\n");
3470 return -EINVAL; 3505 return -EINVAL;
3471 } 3506 }
3472 3507
@@ -3570,8 +3605,6 @@ static int __devexit ehea_remove(struct platform_device *dev)
3570 3605
3571 ehea_remove_device_sysfs(dev); 3606 ehea_remove_device_sysfs(dev);
3572 3607
3573 flush_scheduled_work();
3574
3575 ibmebus_free_irq(adapter->neq->attr.ist1, adapter); 3608 ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
3576 tasklet_kill(&adapter->neq_tasklet); 3609 tasklet_kill(&adapter->neq_tasklet);
3577 3610
@@ -3614,21 +3647,21 @@ static int ehea_mem_notifier(struct notifier_block *nb,
3614 3647
3615 switch (action) { 3648 switch (action) {
3616 case MEM_CANCEL_OFFLINE: 3649 case MEM_CANCEL_OFFLINE:
3617 ehea_info("memory offlining canceled"); 3650 pr_info("memory offlining canceled");
3618 /* Readd canceled memory block */ 3651 /* Readd canceled memory block */
3619 case MEM_ONLINE: 3652 case MEM_ONLINE:
3620 ehea_info("memory is going online"); 3653 pr_info("memory is going online");
3621 set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); 3654 set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
3622 if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages)) 3655 if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages))
3623 goto out_unlock; 3656 goto out_unlock;
3624 ehea_rereg_mrs(NULL); 3657 ehea_rereg_mrs();
3625 break; 3658 break;
3626 case MEM_GOING_OFFLINE: 3659 case MEM_GOING_OFFLINE:
3627 ehea_info("memory is going offline"); 3660 pr_info("memory is going offline");
3628 set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); 3661 set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
3629 if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages)) 3662 if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages))
3630 goto out_unlock; 3663 goto out_unlock;
3631 ehea_rereg_mrs(NULL); 3664 ehea_rereg_mrs();
3632 break; 3665 break;
3633 default: 3666 default:
3634 break; 3667 break;
@@ -3650,7 +3683,7 @@ static int ehea_reboot_notifier(struct notifier_block *nb,
3650 unsigned long action, void *unused) 3683 unsigned long action, void *unused)
3651{ 3684{
3652 if (action == SYS_RESTART) { 3685 if (action == SYS_RESTART) {
3653 ehea_info("Reboot: freeing all eHEA resources"); 3686 pr_info("Reboot: freeing all eHEA resources\n");
3654 ibmebus_unregister_driver(&ehea_driver); 3687 ibmebus_unregister_driver(&ehea_driver);
3655 } 3688 }
3656 return NOTIFY_DONE; 3689 return NOTIFY_DONE;
@@ -3666,22 +3699,22 @@ static int check_module_parm(void)
3666 3699
3667 if ((rq1_entries < EHEA_MIN_ENTRIES_QP) || 3700 if ((rq1_entries < EHEA_MIN_ENTRIES_QP) ||
3668 (rq1_entries > EHEA_MAX_ENTRIES_RQ1)) { 3701 (rq1_entries > EHEA_MAX_ENTRIES_RQ1)) {
3669 ehea_info("Bad parameter: rq1_entries"); 3702 pr_info("Bad parameter: rq1_entries\n");
3670 ret = -EINVAL; 3703 ret = -EINVAL;
3671 } 3704 }
3672 if ((rq2_entries < EHEA_MIN_ENTRIES_QP) || 3705 if ((rq2_entries < EHEA_MIN_ENTRIES_QP) ||
3673 (rq2_entries > EHEA_MAX_ENTRIES_RQ2)) { 3706 (rq2_entries > EHEA_MAX_ENTRIES_RQ2)) {
3674 ehea_info("Bad parameter: rq2_entries"); 3707 pr_info("Bad parameter: rq2_entries\n");
3675 ret = -EINVAL; 3708 ret = -EINVAL;
3676 } 3709 }
3677 if ((rq3_entries < EHEA_MIN_ENTRIES_QP) || 3710 if ((rq3_entries < EHEA_MIN_ENTRIES_QP) ||
3678 (rq3_entries > EHEA_MAX_ENTRIES_RQ3)) { 3711 (rq3_entries > EHEA_MAX_ENTRIES_RQ3)) {
3679 ehea_info("Bad parameter: rq3_entries"); 3712 pr_info("Bad parameter: rq3_entries\n");
3680 ret = -EINVAL; 3713 ret = -EINVAL;
3681 } 3714 }
3682 if ((sq_entries < EHEA_MIN_ENTRIES_QP) || 3715 if ((sq_entries < EHEA_MIN_ENTRIES_QP) ||
3683 (sq_entries > EHEA_MAX_ENTRIES_SQ)) { 3716 (sq_entries > EHEA_MAX_ENTRIES_SQ)) {
3684 ehea_info("Bad parameter: sq_entries"); 3717 pr_info("Bad parameter: sq_entries\n");
3685 ret = -EINVAL; 3718 ret = -EINVAL;
3686 } 3719 }
3687 3720
@@ -3701,11 +3734,8 @@ int __init ehea_module_init(void)
3701{ 3734{
3702 int ret; 3735 int ret;
3703 3736
3704 printk(KERN_INFO "IBM eHEA ethernet device driver (Release %s)\n", 3737 pr_info("IBM eHEA ethernet device driver (Release %s)\n", DRV_VERSION);
3705 DRV_VERSION);
3706
3707 3738
3708 INIT_WORK(&ehea_rereg_mr_task, ehea_rereg_mrs);
3709 memset(&ehea_fw_handles, 0, sizeof(ehea_fw_handles)); 3739 memset(&ehea_fw_handles, 0, sizeof(ehea_fw_handles));
3710 memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs)); 3740 memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs));
3711 3741
@@ -3722,27 +3752,27 @@ int __init ehea_module_init(void)
3722 3752
3723 ret = register_reboot_notifier(&ehea_reboot_nb); 3753 ret = register_reboot_notifier(&ehea_reboot_nb);
3724 if (ret) 3754 if (ret)
3725 ehea_info("failed registering reboot notifier"); 3755 pr_info("failed registering reboot notifier\n");
3726 3756
3727 ret = register_memory_notifier(&ehea_mem_nb); 3757 ret = register_memory_notifier(&ehea_mem_nb);
3728 if (ret) 3758 if (ret)
3729 ehea_info("failed registering memory remove notifier"); 3759 pr_info("failed registering memory remove notifier\n");
3730 3760
3731 ret = crash_shutdown_register(&ehea_crash_handler); 3761 ret = crash_shutdown_register(ehea_crash_handler);
3732 if (ret) 3762 if (ret)
3733 ehea_info("failed registering crash handler"); 3763 pr_info("failed registering crash handler\n");
3734 3764
3735 ret = ibmebus_register_driver(&ehea_driver); 3765 ret = ibmebus_register_driver(&ehea_driver);
3736 if (ret) { 3766 if (ret) {
3737 ehea_error("failed registering eHEA device driver on ebus"); 3767 pr_err("failed registering eHEA device driver on ebus\n");
3738 goto out2; 3768 goto out2;
3739 } 3769 }
3740 3770
3741 ret = driver_create_file(&ehea_driver.driver, 3771 ret = driver_create_file(&ehea_driver.driver,
3742 &driver_attr_capabilities); 3772 &driver_attr_capabilities);
3743 if (ret) { 3773 if (ret) {
3744 ehea_error("failed to register capabilities attribute, ret=%d", 3774 pr_err("failed to register capabilities attribute, ret=%d\n",
3745 ret); 3775 ret);
3746 goto out3; 3776 goto out3;
3747 } 3777 }
3748 3778
@@ -3753,7 +3783,7 @@ out3:
3753out2: 3783out2:
3754 unregister_memory_notifier(&ehea_mem_nb); 3784 unregister_memory_notifier(&ehea_mem_nb);
3755 unregister_reboot_notifier(&ehea_reboot_nb); 3785 unregister_reboot_notifier(&ehea_reboot_nb);
3756 crash_shutdown_unregister(&ehea_crash_handler); 3786 crash_shutdown_unregister(ehea_crash_handler);
3757out: 3787out:
3758 return ret; 3788 return ret;
3759} 3789}
@@ -3762,13 +3792,12 @@ static void __exit ehea_module_exit(void)
3762{ 3792{
3763 int ret; 3793 int ret;
3764 3794
3765 flush_scheduled_work();
3766 driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); 3795 driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
3767 ibmebus_unregister_driver(&ehea_driver); 3796 ibmebus_unregister_driver(&ehea_driver);
3768 unregister_reboot_notifier(&ehea_reboot_nb); 3797 unregister_reboot_notifier(&ehea_reboot_nb);
3769 ret = crash_shutdown_unregister(&ehea_crash_handler); 3798 ret = crash_shutdown_unregister(ehea_crash_handler);
3770 if (ret) 3799 if (ret)
3771 ehea_info("failed unregistering crash handler"); 3800 pr_info("failed unregistering crash handler\n");
3772 unregister_memory_notifier(&ehea_mem_nb); 3801 unregister_memory_notifier(&ehea_mem_nb);
3773 kfree(ehea_fw_handles.arr); 3802 kfree(ehea_fw_handles.arr);
3774 kfree(ehea_bcmc_regs.arr); 3803 kfree(ehea_bcmc_regs.arr);