aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-31 23:03:15 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-31 23:03:15 -0400
commit618a821dc24a4018b0c5c01785d052459a90edb4 (patch)
tree03f778b1afe89a4b733d1cdd0f34a648a4ff84bb /drivers
parent5e7a39275b00ec881790ce47b8f7363fdfa097fa (diff)
parent47330077650a25d417155848516b2cba97999602 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: - cxgb3 engine microcode load cxgb3 - Fix dev->priv usage qeth: Drop ARP packages on HiperSockets interface with NOARP attribute. qeth: provide specific message for OSA-adapters exclusively used qeth: crash during reboot after failing online setting qeth: Announce tx checksumming for qeth devices in TSO/EDDP mode qeth: dont return the return values of void functions. qeth: enforce a rate limit for inbound scatter gather messages qeth: ungrouping a device must not be interruptible netxen: fix crashes during module unload netxen: Avoid firmware load in PCI probe PS3: fix the bug that 'ifconfig down' would hang IOC3: Program UART predividers.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_hal.c2
-rw-r--r--drivers/net/cxgb3/adapter.h2
-rw-r--r--drivers/net/cxgb3/common.h3
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c252
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c16
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.h2
-rw-r--r--drivers/net/cxgb3/sge.c23
-rw-r--r--drivers/net/cxgb3/t3_hw.c46
-rw-r--r--drivers/net/cxgb3/t3cdev.h3
-rw-r--r--drivers/net/ioc3-eth.c80
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h6
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c8
-rw-r--r--drivers/net/netxen/netxen_nic_main.c19
-rw-r--r--drivers/net/ps3_gelic_net.c1
-rw-r--r--drivers/s390/net/qeth.h4
-rw-r--r--drivers/s390/net/qeth_main.c158
-rw-r--r--drivers/s390/net/qeth_mpc.h1
-rw-r--r--drivers/s390/net/qeth_sys.c8
18 files changed, 428 insertions, 206 deletions
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 1518b41482ae..beb2a381467f 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -916,7 +916,7 @@ int cxio_rdev_open(struct cxio_rdev *rdev_p)
916 PDBG("%s opening rnic dev %s\n", __FUNCTION__, rdev_p->dev_name); 916 PDBG("%s opening rnic dev %s\n", __FUNCTION__, rdev_p->dev_name);
917 memset(&rdev_p->ctrl_qp, 0, sizeof(rdev_p->ctrl_qp)); 917 memset(&rdev_p->ctrl_qp, 0, sizeof(rdev_p->ctrl_qp));
918 if (!rdev_p->t3cdev_p) 918 if (!rdev_p->t3cdev_p)
919 rdev_p->t3cdev_p = T3CDEV(netdev_p); 919 rdev_p->t3cdev_p = dev2t3cdev(netdev_p);
920 rdev_p->t3cdev_p->ulp = (void *) rdev_p; 920 rdev_p->t3cdev_p->ulp = (void *) rdev_p;
921 err = rdev_p->t3cdev_p->ctl(rdev_p->t3cdev_p, RDMA_GET_PARAMS, 921 err = rdev_p->t3cdev_p->ctl(rdev_p->t3cdev_p, RDMA_GET_PARAMS,
922 &(rdev_p->rnic_info)); 922 &(rdev_p->rnic_info));
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index ab72563b81ee..20e887de2545 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -50,7 +50,9 @@ typedef irqreturn_t(*intr_handler_t) (int, void *);
50 50
51struct vlan_group; 51struct vlan_group;
52 52
53struct adapter;
53struct port_info { 54struct port_info {
55 struct adapter *adapter;
54 struct vlan_group *vlan_grp; 56 struct vlan_group *vlan_grp;
55 const struct port_type_info *port_type; 57 const struct port_type_info *port_type;
56 u8 port_id; 58 u8 port_id;
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index 16378004507a..2129210a67c1 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -679,7 +679,8 @@ const struct adapter_info *t3_get_adapter_info(unsigned int board_id);
679int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data); 679int t3_seeprom_read(struct adapter *adapter, u32 addr, u32 *data);
680int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data); 680int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data);
681int t3_seeprom_wp(struct adapter *adapter, int enable); 681int t3_seeprom_wp(struct adapter *adapter, int enable);
682int t3_check_tpsram_version(struct adapter *adapter); 682int t3_get_tp_version(struct adapter *adapter, u32 *vers);
683int t3_check_tpsram_version(struct adapter *adapter, int *must_load);
683int t3_check_tpsram(struct adapter *adapter, u8 *tp_ram, unsigned int size); 684int t3_check_tpsram(struct adapter *adapter, u8 *tp_ram, unsigned int size);
684int t3_set_proto_sram(struct adapter *adap, u8 *data); 685int t3_set_proto_sram(struct adapter *adap, u8 *data);
685int t3_read_flash(struct adapter *adapter, unsigned int addr, 686int t3_read_flash(struct adapter *adapter, unsigned int addr,
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index dc5d26988bb3..5ab319cfe5de 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -358,11 +358,14 @@ static int init_dummy_netdevs(struct adapter *adap)
358 358
359 for (j = 0; j < pi->nqsets - 1; j++) { 359 for (j = 0; j < pi->nqsets - 1; j++) {
360 if (!adap->dummy_netdev[dummy_idx]) { 360 if (!adap->dummy_netdev[dummy_idx]) {
361 nd = alloc_netdev(0, "", ether_setup); 361 struct port_info *p;
362
363 nd = alloc_netdev(sizeof(*p), "", ether_setup);
362 if (!nd) 364 if (!nd)
363 goto free_all; 365 goto free_all;
364 366
365 nd->priv = adap; 367 p = netdev_priv(nd);
368 p->adapter = adap;
366 nd->weight = 64; 369 nd->weight = 64;
367 set_bit(__LINK_STATE_START, &nd->state); 370 set_bit(__LINK_STATE_START, &nd->state);
368 adap->dummy_netdev[dummy_idx] = nd; 371 adap->dummy_netdev[dummy_idx] = nd;
@@ -482,7 +485,8 @@ static ssize_t attr_store(struct device *d, struct device_attribute *attr,
482#define CXGB3_SHOW(name, val_expr) \ 485#define CXGB3_SHOW(name, val_expr) \
483static ssize_t format_##name(struct net_device *dev, char *buf) \ 486static ssize_t format_##name(struct net_device *dev, char *buf) \
484{ \ 487{ \
485 struct adapter *adap = dev->priv; \ 488 struct port_info *pi = netdev_priv(dev); \
489 struct adapter *adap = pi->adapter; \
486 return sprintf(buf, "%u\n", val_expr); \ 490 return sprintf(buf, "%u\n", val_expr); \
487} \ 491} \
488static ssize_t show_##name(struct device *d, struct device_attribute *attr, \ 492static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
@@ -493,7 +497,8 @@ static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
493 497
494static ssize_t set_nfilters(struct net_device *dev, unsigned int val) 498static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
495{ 499{
496 struct adapter *adap = dev->priv; 500 struct port_info *pi = netdev_priv(dev);
501 struct adapter *adap = pi->adapter;
497 int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0; 502 int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
498 503
499 if (adap->flags & FULL_INIT_DONE) 504 if (adap->flags & FULL_INIT_DONE)
@@ -515,7 +520,8 @@ static ssize_t store_nfilters(struct device *d, struct device_attribute *attr,
515 520
516static ssize_t set_nservers(struct net_device *dev, unsigned int val) 521static ssize_t set_nservers(struct net_device *dev, unsigned int val)
517{ 522{
518 struct adapter *adap = dev->priv; 523 struct port_info *pi = netdev_priv(dev);
524 struct adapter *adap = pi->adapter;
519 525
520 if (adap->flags & FULL_INIT_DONE) 526 if (adap->flags & FULL_INIT_DONE)
521 return -EBUSY; 527 return -EBUSY;
@@ -556,9 +562,10 @@ static struct attribute_group cxgb3_attr_group = {.attrs = cxgb3_attrs };
556static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr, 562static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr,
557 char *buf, int sched) 563 char *buf, int sched)
558{ 564{
559 ssize_t len; 565 struct port_info *pi = netdev_priv(to_net_dev(d));
566 struct adapter *adap = pi->adapter;
560 unsigned int v, addr, bpt, cpt; 567 unsigned int v, addr, bpt, cpt;
561 struct adapter *adap = to_net_dev(d)->priv; 568 ssize_t len;
562 569
563 addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2; 570 addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2;
564 rtnl_lock(); 571 rtnl_lock();
@@ -581,10 +588,11 @@ static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr,
581static ssize_t tm_attr_store(struct device *d, struct device_attribute *attr, 588static ssize_t tm_attr_store(struct device *d, struct device_attribute *attr,
582 const char *buf, size_t len, int sched) 589 const char *buf, size_t len, int sched)
583{ 590{
591 struct port_info *pi = netdev_priv(to_net_dev(d));
592 struct adapter *adap = pi->adapter;
593 unsigned int val;
584 char *endp; 594 char *endp;
585 ssize_t ret; 595 ssize_t ret;
586 unsigned int val;
587 struct adapter *adap = to_net_dev(d)->priv;
588 596
589 if (!capable(CAP_NET_ADMIN)) 597 if (!capable(CAP_NET_ADMIN))
590 return -EPERM; 598 return -EPERM;
@@ -721,6 +729,7 @@ static void bind_qsets(struct adapter *adap)
721} 729}
722 730
723#define FW_FNAME "t3fw-%d.%d.%d.bin" 731#define FW_FNAME "t3fw-%d.%d.%d.bin"
732#define TPSRAM_NAME "t3%c_protocol_sram-%d.%d.%d.bin"
724 733
725static int upgrade_fw(struct adapter *adap) 734static int upgrade_fw(struct adapter *adap)
726{ 735{
@@ -739,6 +748,71 @@ static int upgrade_fw(struct adapter *adap)
739 } 748 }
740 ret = t3_load_fw(adap, fw->data, fw->size); 749 ret = t3_load_fw(adap, fw->data, fw->size);
741 release_firmware(fw); 750 release_firmware(fw);
751
752 if (ret == 0)
753 dev_info(dev, "successful upgrade to firmware %d.%d.%d\n",
754 FW_VERSION_MAJOR, FW_VERSION_MINOR, FW_VERSION_MICRO);
755 else
756 dev_err(dev, "failed to upgrade to firmware %d.%d.%d\n",
757 FW_VERSION_MAJOR, FW_VERSION_MINOR, FW_VERSION_MICRO);
758
759 return ret;
760}
761
762static inline char t3rev2char(struct adapter *adapter)
763{
764 char rev = 0;
765
766 switch(adapter->params.rev) {
767 case T3_REV_B:
768 case T3_REV_B2:
769 rev = 'b';
770 break;
771 }
772 return rev;
773}
774
775int update_tpsram(struct adapter *adap)
776{
777 const struct firmware *tpsram;
778 char buf[64];
779 struct device *dev = &adap->pdev->dev;
780 int ret;
781 char rev;
782
783 rev = t3rev2char(adap);
784 if (!rev)
785 return 0;
786
787 snprintf(buf, sizeof(buf), TPSRAM_NAME, rev,
788 TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
789
790 ret = request_firmware(&tpsram, buf, dev);
791 if (ret < 0) {
792 dev_err(dev, "could not load TP SRAM: unable to load %s\n",
793 buf);
794 return ret;
795 }
796
797 ret = t3_check_tpsram(adap, tpsram->data, tpsram->size);
798 if (ret)
799 goto release_tpsram;
800
801 ret = t3_set_proto_sram(adap, tpsram->data);
802 if (ret == 0)
803 dev_info(dev,
804 "successful update of protocol engine "
805 "to %d.%d.%d\n",
806 TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
807 else
808 dev_err(dev, "failed to update of protocol engine %d.%d.%d\n",
809 TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
810 if (ret)
811 dev_err(dev, "loading protocol SRAM failed\n");
812
813release_tpsram:
814 release_firmware(tpsram);
815
742 return ret; 816 return ret;
743} 817}
744 818
@@ -755,6 +829,7 @@ static int upgrade_fw(struct adapter *adap)
755static int cxgb_up(struct adapter *adap) 829static int cxgb_up(struct adapter *adap)
756{ 830{
757 int err = 0; 831 int err = 0;
832 int must_load;
758 833
759 if (!(adap->flags & FULL_INIT_DONE)) { 834 if (!(adap->flags & FULL_INIT_DONE)) {
760 err = t3_check_fw_version(adap); 835 err = t3_check_fw_version(adap);
@@ -763,6 +838,13 @@ static int cxgb_up(struct adapter *adap)
763 if (err) 838 if (err)
764 goto out; 839 goto out;
765 840
841 err = t3_check_tpsram_version(adap, &must_load);
842 if (err == -EINVAL) {
843 err = update_tpsram(adap);
844 if (err && must_load)
845 goto out;
846 }
847
766 err = init_dummy_netdevs(adap); 848 err = init_dummy_netdevs(adap);
767 if (err) 849 if (err)
768 goto out; 850 goto out;
@@ -858,8 +940,9 @@ static void schedule_chk_task(struct adapter *adap)
858 940
859static int offload_open(struct net_device *dev) 941static int offload_open(struct net_device *dev)
860{ 942{
861 struct adapter *adapter = dev->priv; 943 struct port_info *pi = netdev_priv(dev);
862 struct t3cdev *tdev = T3CDEV(dev); 944 struct adapter *adapter = pi->adapter;
945 struct t3cdev *tdev = dev2t3cdev(dev);
863 int adap_up = adapter->open_device_map & PORT_MASK; 946 int adap_up = adapter->open_device_map & PORT_MASK;
864 int err = 0; 947 int err = 0;
865 948
@@ -924,10 +1007,10 @@ static int offload_close(struct t3cdev *tdev)
924 1007
925static int cxgb_open(struct net_device *dev) 1008static int cxgb_open(struct net_device *dev)
926{ 1009{
927 int err;
928 struct adapter *adapter = dev->priv;
929 struct port_info *pi = netdev_priv(dev); 1010 struct port_info *pi = netdev_priv(dev);
1011 struct adapter *adapter = pi->adapter;
930 int other_ports = adapter->open_device_map & PORT_MASK; 1012 int other_ports = adapter->open_device_map & PORT_MASK;
1013 int err;
931 1014
932 if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0) 1015 if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0)
933 return err; 1016 return err;
@@ -951,17 +1034,17 @@ static int cxgb_open(struct net_device *dev)
951 1034
952static int cxgb_close(struct net_device *dev) 1035static int cxgb_close(struct net_device *dev)
953{ 1036{
954 struct adapter *adapter = dev->priv; 1037 struct port_info *pi = netdev_priv(dev);
955 struct port_info *p = netdev_priv(dev); 1038 struct adapter *adapter = pi->adapter;
956 1039
957 t3_port_intr_disable(adapter, p->port_id); 1040 t3_port_intr_disable(adapter, pi->port_id);
958 netif_stop_queue(dev); 1041 netif_stop_queue(dev);
959 p->phy.ops->power_down(&p->phy, 1); 1042 pi->phy.ops->power_down(&pi->phy, 1);
960 netif_carrier_off(dev); 1043 netif_carrier_off(dev);
961 t3_mac_disable(&p->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX); 1044 t3_mac_disable(&pi->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
962 1045
963 spin_lock(&adapter->work_lock); /* sync with update task */ 1046 spin_lock(&adapter->work_lock); /* sync with update task */
964 clear_bit(p->port_id, &adapter->open_device_map); 1047 clear_bit(pi->port_id, &adapter->open_device_map);
965 spin_unlock(&adapter->work_lock); 1048 spin_unlock(&adapter->work_lock);
966 1049
967 if (!(adapter->open_device_map & PORT_MASK)) 1050 if (!(adapter->open_device_map & PORT_MASK))
@@ -976,13 +1059,13 @@ static int cxgb_close(struct net_device *dev)
976 1059
977static struct net_device_stats *cxgb_get_stats(struct net_device *dev) 1060static struct net_device_stats *cxgb_get_stats(struct net_device *dev)
978{ 1061{
979 struct adapter *adapter = dev->priv; 1062 struct port_info *pi = netdev_priv(dev);
980 struct port_info *p = netdev_priv(dev); 1063 struct adapter *adapter = pi->adapter;
981 struct net_device_stats *ns = &p->netstats; 1064 struct net_device_stats *ns = &pi->netstats;
982 const struct mac_stats *pstats; 1065 const struct mac_stats *pstats;
983 1066
984 spin_lock(&adapter->stats_lock); 1067 spin_lock(&adapter->stats_lock);
985 pstats = t3_mac_update_stats(&p->mac); 1068 pstats = t3_mac_update_stats(&pi->mac);
986 spin_unlock(&adapter->stats_lock); 1069 spin_unlock(&adapter->stats_lock);
987 1070
988 ns->tx_bytes = pstats->tx_octets; 1071 ns->tx_bytes = pstats->tx_octets;
@@ -1015,14 +1098,16 @@ static struct net_device_stats *cxgb_get_stats(struct net_device *dev)
1015 1098
1016static u32 get_msglevel(struct net_device *dev) 1099static u32 get_msglevel(struct net_device *dev)
1017{ 1100{
1018 struct adapter *adapter = dev->priv; 1101 struct port_info *pi = netdev_priv(dev);
1102 struct adapter *adapter = pi->adapter;
1019 1103
1020 return adapter->msg_enable; 1104 return adapter->msg_enable;
1021} 1105}
1022 1106
1023static void set_msglevel(struct net_device *dev, u32 val) 1107static void set_msglevel(struct net_device *dev, u32 val)
1024{ 1108{
1025 struct adapter *adapter = dev->priv; 1109 struct port_info *pi = netdev_priv(dev);
1110 struct adapter *adapter = pi->adapter;
1026 1111
1027 adapter->msg_enable = val; 1112 adapter->msg_enable = val;
1028} 1113}
@@ -1096,10 +1181,13 @@ static int get_eeprom_len(struct net_device *dev)
1096 1181
1097static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) 1182static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1098{ 1183{
1184 struct port_info *pi = netdev_priv(dev);
1185 struct adapter *adapter = pi->adapter;
1099 u32 fw_vers = 0; 1186 u32 fw_vers = 0;
1100 struct adapter *adapter = dev->priv; 1187 u32 tp_vers = 0;
1101 1188
1102 t3_get_fw_version(adapter, &fw_vers); 1189 t3_get_fw_version(adapter, &fw_vers);
1190 t3_get_tp_version(adapter, &tp_vers);
1103 1191
1104 strcpy(info->driver, DRV_NAME); 1192 strcpy(info->driver, DRV_NAME);
1105 strcpy(info->version, DRV_VERSION); 1193 strcpy(info->version, DRV_VERSION);
@@ -1108,11 +1196,14 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1108 strcpy(info->fw_version, "N/A"); 1196 strcpy(info->fw_version, "N/A");
1109 else { 1197 else {
1110 snprintf(info->fw_version, sizeof(info->fw_version), 1198 snprintf(info->fw_version, sizeof(info->fw_version),
1111 "%s %u.%u.%u", 1199 "%s %u.%u.%u TP %u.%u.%u",
1112 G_FW_VERSION_TYPE(fw_vers) ? "T" : "N", 1200 G_FW_VERSION_TYPE(fw_vers) ? "T" : "N",
1113 G_FW_VERSION_MAJOR(fw_vers), 1201 G_FW_VERSION_MAJOR(fw_vers),
1114 G_FW_VERSION_MINOR(fw_vers), 1202 G_FW_VERSION_MINOR(fw_vers),
1115 G_FW_VERSION_MICRO(fw_vers)); 1203 G_FW_VERSION_MICRO(fw_vers),
1204 G_TP_VERSION_MAJOR(tp_vers),
1205 G_TP_VERSION_MINOR(tp_vers),
1206 G_TP_VERSION_MICRO(tp_vers));
1116 } 1207 }
1117} 1208}
1118 1209
@@ -1136,8 +1227,8 @@ static unsigned long collect_sge_port_stats(struct adapter *adapter,
1136static void get_stats(struct net_device *dev, struct ethtool_stats *stats, 1227static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
1137 u64 *data) 1228 u64 *data)
1138{ 1229{
1139 struct adapter *adapter = dev->priv;
1140 struct port_info *pi = netdev_priv(dev); 1230 struct port_info *pi = netdev_priv(dev);
1231 struct adapter *adapter = pi->adapter;
1141 const struct mac_stats *s; 1232 const struct mac_stats *s;
1142 1233
1143 spin_lock(&adapter->stats_lock); 1234 spin_lock(&adapter->stats_lock);
@@ -1205,7 +1296,8 @@ static inline void reg_block_dump(struct adapter *ap, void *buf,
1205static void get_regs(struct net_device *dev, struct ethtool_regs *regs, 1296static void get_regs(struct net_device *dev, struct ethtool_regs *regs,
1206 void *buf) 1297 void *buf)
1207{ 1298{
1208 struct adapter *ap = dev->priv; 1299 struct port_info *pi = netdev_priv(dev);
1300 struct adapter *ap = pi->adapter;
1209 1301
1210 /* 1302 /*
1211 * Version scheme: 1303 * Version scheme:
@@ -1246,8 +1338,9 @@ static int restart_autoneg(struct net_device *dev)
1246 1338
1247static int cxgb3_phys_id(struct net_device *dev, u32 data) 1339static int cxgb3_phys_id(struct net_device *dev, u32 data)
1248{ 1340{
1341 struct port_info *pi = netdev_priv(dev);
1342 struct adapter *adapter = pi->adapter;
1249 int i; 1343 int i;
1250 struct adapter *adapter = dev->priv;
1251 1344
1252 if (data == 0) 1345 if (data == 0)
1253 data = 2; 1346 data = 2;
@@ -1408,8 +1501,8 @@ static int set_rx_csum(struct net_device *dev, u32 data)
1408 1501
1409static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) 1502static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1410{ 1503{
1411 const struct adapter *adapter = dev->priv; 1504 struct port_info *pi = netdev_priv(dev);
1412 const struct port_info *pi = netdev_priv(dev); 1505 struct adapter *adapter = pi->adapter;
1413 const struct qset_params *q = &adapter->params.sge.qset[pi->first_qset]; 1506 const struct qset_params *q = &adapter->params.sge.qset[pi->first_qset];
1414 1507
1415 e->rx_max_pending = MAX_RX_BUFFERS; 1508 e->rx_max_pending = MAX_RX_BUFFERS;
@@ -1425,10 +1518,10 @@ static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1425 1518
1426static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e) 1519static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1427{ 1520{
1428 int i; 1521 struct port_info *pi = netdev_priv(dev);
1522 struct adapter *adapter = pi->adapter;
1429 struct qset_params *q; 1523 struct qset_params *q;
1430 struct adapter *adapter = dev->priv; 1524 int i;
1431 const struct port_info *pi = netdev_priv(dev);
1432 1525
1433 if (e->rx_pending > MAX_RX_BUFFERS || 1526 if (e->rx_pending > MAX_RX_BUFFERS ||
1434 e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS || 1527 e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS ||
@@ -1457,7 +1550,8 @@ static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1457 1550
1458static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c) 1551static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
1459{ 1552{
1460 struct adapter *adapter = dev->priv; 1553 struct port_info *pi = netdev_priv(dev);
1554 struct adapter *adapter = pi->adapter;
1461 struct qset_params *qsp = &adapter->params.sge.qset[0]; 1555 struct qset_params *qsp = &adapter->params.sge.qset[0];
1462 struct sge_qset *qs = &adapter->sge.qs[0]; 1556 struct sge_qset *qs = &adapter->sge.qs[0];
1463 1557
@@ -1471,7 +1565,8 @@ static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
1471 1565
1472static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) 1566static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
1473{ 1567{
1474 struct adapter *adapter = dev->priv; 1568 struct port_info *pi = netdev_priv(dev);
1569 struct adapter *adapter = pi->adapter;
1475 struct qset_params *q = adapter->params.sge.qset; 1570 struct qset_params *q = adapter->params.sge.qset;
1476 1571
1477 c->rx_coalesce_usecs = q->coalesce_usecs; 1572 c->rx_coalesce_usecs = q->coalesce_usecs;
@@ -1481,8 +1576,9 @@ static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
1481static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e, 1576static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e,
1482 u8 * data) 1577 u8 * data)
1483{ 1578{
1579 struct port_info *pi = netdev_priv(dev);
1580 struct adapter *adapter = pi->adapter;
1484 int i, err = 0; 1581 int i, err = 0;
1485 struct adapter *adapter = dev->priv;
1486 1582
1487 u8 *buf = kmalloc(EEPROMSIZE, GFP_KERNEL); 1583 u8 *buf = kmalloc(EEPROMSIZE, GFP_KERNEL);
1488 if (!buf) 1584 if (!buf)
@@ -1501,10 +1597,11 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e,
1501static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, 1597static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
1502 u8 * data) 1598 u8 * data)
1503{ 1599{
1600 struct port_info *pi = netdev_priv(dev);
1601 struct adapter *adapter = pi->adapter;
1602 u32 aligned_offset, aligned_len, *p;
1504 u8 *buf; 1603 u8 *buf;
1505 int err = 0; 1604 int err = 0;
1506 u32 aligned_offset, aligned_len, *p;
1507 struct adapter *adapter = dev->priv;
1508 1605
1509 if (eeprom->magic != EEPROM_MAGIC) 1606 if (eeprom->magic != EEPROM_MAGIC)
1510 return -EINVAL; 1607 return -EINVAL;
@@ -1592,9 +1689,10 @@ static int in_range(int val, int lo, int hi)
1592 1689
1593static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) 1690static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1594{ 1691{
1595 int ret; 1692 struct port_info *pi = netdev_priv(dev);
1693 struct adapter *adapter = pi->adapter;
1596 u32 cmd; 1694 u32 cmd;
1597 struct adapter *adapter = dev->priv; 1695 int ret;
1598 1696
1599 if (copy_from_user(&cmd, useraddr, sizeof(cmd))) 1697 if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
1600 return -EFAULT; 1698 return -EFAULT;
@@ -1923,10 +2021,10 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
1923 2021
1924static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd) 2022static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
1925{ 2023{
1926 int ret, mmd;
1927 struct adapter *adapter = dev->priv;
1928 struct port_info *pi = netdev_priv(dev);
1929 struct mii_ioctl_data *data = if_mii(req); 2024 struct mii_ioctl_data *data = if_mii(req);
2025 struct port_info *pi = netdev_priv(dev);
2026 struct adapter *adapter = pi->adapter;
2027 int ret, mmd;
1930 2028
1931 switch (cmd) { 2029 switch (cmd) {
1932 case SIOCGMIIPHY: 2030 case SIOCGMIIPHY:
@@ -1994,9 +2092,9 @@ static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
1994 2092
1995static int cxgb_change_mtu(struct net_device *dev, int new_mtu) 2093static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
1996{ 2094{
1997 int ret;
1998 struct adapter *adapter = dev->priv;
1999 struct port_info *pi = netdev_priv(dev); 2095 struct port_info *pi = netdev_priv(dev);
2096 struct adapter *adapter = pi->adapter;
2097 int ret;
2000 2098
2001 if (new_mtu < 81) /* accommodate SACK */ 2099 if (new_mtu < 81) /* accommodate SACK */
2002 return -EINVAL; 2100 return -EINVAL;
@@ -2013,8 +2111,8 @@ static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
2013 2111
2014static int cxgb_set_mac_addr(struct net_device *dev, void *p) 2112static int cxgb_set_mac_addr(struct net_device *dev, void *p)
2015{ 2113{
2016 struct adapter *adapter = dev->priv;
2017 struct port_info *pi = netdev_priv(dev); 2114 struct port_info *pi = netdev_priv(dev);
2115 struct adapter *adapter = pi->adapter;
2018 struct sockaddr *addr = p; 2116 struct sockaddr *addr = p;
2019 2117
2020 if (!is_valid_ether_addr(addr->sa_data)) 2118 if (!is_valid_ether_addr(addr->sa_data))
@@ -2050,8 +2148,8 @@ static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
2050 2148
2051static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp) 2149static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2052{ 2150{
2053 struct adapter *adapter = dev->priv;
2054 struct port_info *pi = netdev_priv(dev); 2151 struct port_info *pi = netdev_priv(dev);
2152 struct adapter *adapter = pi->adapter;
2055 2153
2056 pi->vlan_grp = grp; 2154 pi->vlan_grp = grp;
2057 if (adapter->params.rev > 0) 2155 if (adapter->params.rev > 0)
@@ -2070,8 +2168,8 @@ static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2070#ifdef CONFIG_NET_POLL_CONTROLLER 2168#ifdef CONFIG_NET_POLL_CONTROLLER
2071static void cxgb_netpoll(struct net_device *dev) 2169static void cxgb_netpoll(struct net_device *dev)
2072{ 2170{
2073 struct adapter *adapter = dev->priv;
2074 struct port_info *pi = netdev_priv(dev); 2171 struct port_info *pi = netdev_priv(dev);
2172 struct adapter *adapter = pi->adapter;
2075 int qidx; 2173 int qidx;
2076 2174
2077 for (qidx = pi->first_qset; qidx < pi->first_qset + pi->nqsets; qidx++) { 2175 for (qidx = pi->first_qset; qidx < pi->first_qset + pi->nqsets; qidx++) {
@@ -2088,42 +2186,6 @@ static void cxgb_netpoll(struct net_device *dev)
2088} 2186}
2089#endif 2187#endif
2090 2188
2091#define TPSRAM_NAME "t3%c_protocol_sram-%d.%d.%d.bin"
2092int update_tpsram(struct adapter *adap)
2093{
2094 const struct firmware *tpsram;
2095 char buf[64];
2096 struct device *dev = &adap->pdev->dev;
2097 int ret;
2098 char rev;
2099
2100 rev = adap->params.rev == T3_REV_B2 ? 'b' : 'a';
2101
2102 snprintf(buf, sizeof(buf), TPSRAM_NAME, rev,
2103 TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
2104
2105 ret = request_firmware(&tpsram, buf, dev);
2106 if (ret < 0) {
2107 dev_err(dev, "could not load TP SRAM: unable to load %s\n",
2108 buf);
2109 return ret;
2110 }
2111
2112 ret = t3_check_tpsram(adap, tpsram->data, tpsram->size);
2113 if (ret)
2114 goto release_tpsram;
2115
2116 ret = t3_set_proto_sram(adap, tpsram->data);
2117 if (ret)
2118 dev_err(dev, "loading protocol SRAM failed\n");
2119
2120release_tpsram:
2121 release_firmware(tpsram);
2122
2123 return ret;
2124}
2125
2126
2127/* 2189/*
2128 * Periodic accumulation of MAC statistics. 2190 * Periodic accumulation of MAC statistics.
2129 */ 2191 */
@@ -2433,6 +2495,7 @@ static int __devinit init_one(struct pci_dev *pdev,
2433 2495
2434 adapter->port[i] = netdev; 2496 adapter->port[i] = netdev;
2435 pi = netdev_priv(netdev); 2497 pi = netdev_priv(netdev);
2498 pi->adapter = adapter;
2436 pi->rx_csum_offload = 1; 2499 pi->rx_csum_offload = 1;
2437 pi->nqsets = 1; 2500 pi->nqsets = 1;
2438 pi->first_qset = i; 2501 pi->first_qset = i;
@@ -2442,7 +2505,6 @@ static int __devinit init_one(struct pci_dev *pdev,
2442 netdev->irq = pdev->irq; 2505 netdev->irq = pdev->irq;
2443 netdev->mem_start = mmio_start; 2506 netdev->mem_start = mmio_start;
2444 netdev->mem_end = mmio_start + mmio_len - 1; 2507 netdev->mem_end = mmio_start + mmio_len - 1;
2445 netdev->priv = adapter;
2446 netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; 2508 netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
2447 netdev->features |= NETIF_F_LLTX; 2509 netdev->features |= NETIF_F_LLTX;
2448 if (pci_using_dac) 2510 if (pci_using_dac)
@@ -2467,18 +2529,11 @@ static int __devinit init_one(struct pci_dev *pdev,
2467 SET_ETHTOOL_OPS(netdev, &cxgb_ethtool_ops); 2529 SET_ETHTOOL_OPS(netdev, &cxgb_ethtool_ops);
2468 } 2530 }
2469 2531
2470 pci_set_drvdata(pdev, adapter->port[0]); 2532 pci_set_drvdata(pdev, adapter);
2471 if (t3_prep_adapter(adapter, ai, 1) < 0) { 2533 if (t3_prep_adapter(adapter, ai, 1) < 0) {
2472 err = -ENODEV; 2534 err = -ENODEV;
2473 goto out_free_dev; 2535 goto out_free_dev;
2474 } 2536 }
2475
2476 err = t3_check_tpsram_version(adapter);
2477 if (err == -EINVAL)
2478 err = update_tpsram(adapter);
2479
2480 if (err)
2481 goto out_free_dev;
2482 2537
2483 /* 2538 /*
2484 * The card is now ready to go. If any errors occur during device 2539 * The card is now ready to go. If any errors occur during device
@@ -2547,11 +2602,10 @@ out_release_regions:
2547 2602
2548static void __devexit remove_one(struct pci_dev *pdev) 2603static void __devexit remove_one(struct pci_dev *pdev)
2549{ 2604{
2550 struct net_device *dev = pci_get_drvdata(pdev); 2605 struct adapter *adapter = pci_get_drvdata(pdev);
2551 2606
2552 if (dev) { 2607 if (adapter) {
2553 int i; 2608 int i;
2554 struct adapter *adapter = dev->priv;
2555 2609
2556 t3_sge_stop(adapter); 2610 t3_sge_stop(adapter);
2557 sysfs_remove_group(&adapter->port[0]->dev.kobj, 2611 sysfs_remove_group(&adapter->port[0]->dev.kobj,
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index e620ed4c3ff0..bdff7baeb59d 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -593,6 +593,16 @@ int cxgb3_alloc_stid(struct t3cdev *tdev, struct cxgb3_client *client,
593 593
594EXPORT_SYMBOL(cxgb3_alloc_stid); 594EXPORT_SYMBOL(cxgb3_alloc_stid);
595 595
596/* Get the t3cdev associated with a net_device */
597struct t3cdev *dev2t3cdev(struct net_device *dev)
598{
599 const struct port_info *pi = netdev_priv(dev);
600
601 return (struct t3cdev *)pi->adapter;
602}
603
604EXPORT_SYMBOL(dev2t3cdev);
605
596static int do_smt_write_rpl(struct t3cdev *dev, struct sk_buff *skb) 606static int do_smt_write_rpl(struct t3cdev *dev, struct sk_buff *skb)
597{ 607{
598 struct cpl_smt_write_rpl *rpl = cplhdr(skb); 608 struct cpl_smt_write_rpl *rpl = cplhdr(skb);
@@ -925,7 +935,7 @@ void cxgb_neigh_update(struct neighbour *neigh)
925 struct net_device *dev = neigh->dev; 935 struct net_device *dev = neigh->dev;
926 936
927 if (dev && (is_offloading(dev))) { 937 if (dev && (is_offloading(dev))) {
928 struct t3cdev *tdev = T3CDEV(dev); 938 struct t3cdev *tdev = dev2t3cdev(dev);
929 939
930 BUG_ON(!tdev); 940 BUG_ON(!tdev);
931 t3_l2t_update(tdev, neigh); 941 t3_l2t_update(tdev, neigh);
@@ -973,9 +983,9 @@ void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
973 "device ignored.\n", __FUNCTION__); 983 "device ignored.\n", __FUNCTION__);
974 return; 984 return;
975 } 985 }
976 tdev = T3CDEV(olddev); 986 tdev = dev2t3cdev(olddev);
977 BUG_ON(!tdev); 987 BUG_ON(!tdev);
978 if (tdev != T3CDEV(newdev)) { 988 if (tdev != dev2t3cdev(newdev)) {
979 printk(KERN_WARNING "%s: Redirect to different " 989 printk(KERN_WARNING "%s: Redirect to different "
980 "offload device ignored.\n", __FUNCTION__); 990 "offload device ignored.\n", __FUNCTION__);
981 return; 991 return;
diff --git a/drivers/net/cxgb3/cxgb3_offload.h b/drivers/net/cxgb3/cxgb3_offload.h
index f15446a32efc..7a379138b5a6 100644
--- a/drivers/net/cxgb3/cxgb3_offload.h
+++ b/drivers/net/cxgb3/cxgb3_offload.h
@@ -51,6 +51,8 @@ void cxgb3_offload_deactivate(struct adapter *adapter);
51 51
52void cxgb3_set_dummy_ops(struct t3cdev *dev); 52void cxgb3_set_dummy_ops(struct t3cdev *dev);
53 53
54struct t3cdev *dev2t3cdev(struct net_device *dev);
55
54/* 56/*
55 * Client registration. Users of T3 driver must register themselves. 57 * Client registration. Users of T3 driver must register themselves.
56 * The T3 driver will call the add function of every client for each T3 58 * The T3 driver will call the add function of every client for each T3
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index a2cfd68ac757..58a5f60521ed 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1073,7 +1073,7 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1073{ 1073{
1074 unsigned int ndesc, pidx, credits, gen, compl; 1074 unsigned int ndesc, pidx, credits, gen, compl;
1075 const struct port_info *pi = netdev_priv(dev); 1075 const struct port_info *pi = netdev_priv(dev);
1076 struct adapter *adap = dev->priv; 1076 struct adapter *adap = pi->adapter;
1077 struct sge_qset *qs = dev2qset(dev); 1077 struct sge_qset *qs = dev2qset(dev);
1078 struct sge_txq *q = &qs->txq[TXQ_ETH]; 1078 struct sge_txq *q = &qs->txq[TXQ_ETH];
1079 1079
@@ -1326,7 +1326,8 @@ static void restart_ctrlq(unsigned long data)
1326 struct sk_buff *skb; 1326 struct sk_buff *skb;
1327 struct sge_qset *qs = (struct sge_qset *)data; 1327 struct sge_qset *qs = (struct sge_qset *)data;
1328 struct sge_txq *q = &qs->txq[TXQ_CTRL]; 1328 struct sge_txq *q = &qs->txq[TXQ_CTRL];
1329 struct adapter *adap = qs->netdev->priv; 1329 const struct port_info *pi = netdev_priv(qs->netdev);
1330 struct adapter *adap = pi->adapter;
1330 1331
1331 spin_lock(&q->lock); 1332 spin_lock(&q->lock);
1332 again:reclaim_completed_tx_imm(q); 1333 again:reclaim_completed_tx_imm(q);
@@ -1531,7 +1532,8 @@ static void restart_offloadq(unsigned long data)
1531 struct sk_buff *skb; 1532 struct sk_buff *skb;
1532 struct sge_qset *qs = (struct sge_qset *)data; 1533 struct sge_qset *qs = (struct sge_qset *)data;
1533 struct sge_txq *q = &qs->txq[TXQ_OFLD]; 1534 struct sge_txq *q = &qs->txq[TXQ_OFLD];
1534 struct adapter *adap = qs->netdev->priv; 1535 const struct port_info *pi = netdev_priv(qs->netdev);
1536 struct adapter *adap = pi->adapter;
1535 1537
1536 spin_lock(&q->lock); 1538 spin_lock(&q->lock);
1537 again:reclaim_completed_tx(adap, q); 1539 again:reclaim_completed_tx(adap, q);
@@ -1675,7 +1677,8 @@ static inline void deliver_partial_bundle(struct t3cdev *tdev,
1675 */ 1677 */
1676static int ofld_poll(struct net_device *dev, int *budget) 1678static int ofld_poll(struct net_device *dev, int *budget)
1677{ 1679{
1678 struct adapter *adapter = dev->priv; 1680 const struct port_info *pi = netdev_priv(dev);
1681 struct adapter *adapter = pi->adapter;
1679 struct sge_qset *qs = dev2qset(dev); 1682 struct sge_qset *qs = dev2qset(dev);
1680 struct sge_rspq *q = &qs->rspq; 1683 struct sge_rspq *q = &qs->rspq;
1681 int work_done, limit = min(*budget, dev->quota), avail = limit; 1684 int work_done, limit = min(*budget, dev->quota), avail = limit;
@@ -2075,7 +2078,8 @@ static inline int is_pure_response(const struct rsp_desc *r)
2075 */ 2078 */
2076static int napi_rx_handler(struct net_device *dev, int *budget) 2079static int napi_rx_handler(struct net_device *dev, int *budget)
2077{ 2080{
2078 struct adapter *adap = dev->priv; 2081 const struct port_info *pi = netdev_priv(dev);
2082 struct adapter *adap = pi->adapter;
2079 struct sge_qset *qs = dev2qset(dev); 2083 struct sge_qset *qs = dev2qset(dev);
2080 int effective_budget = min(*budget, dev->quota); 2084 int effective_budget = min(*budget, dev->quota);
2081 2085
@@ -2205,7 +2209,8 @@ static inline int handle_responses(struct adapter *adap, struct sge_rspq *q)
2205irqreturn_t t3_sge_intr_msix(int irq, void *cookie) 2209irqreturn_t t3_sge_intr_msix(int irq, void *cookie)
2206{ 2210{
2207 struct sge_qset *qs = cookie; 2211 struct sge_qset *qs = cookie;
2208 struct adapter *adap = qs->netdev->priv; 2212 const struct port_info *pi = netdev_priv(qs->netdev);
2213 struct adapter *adap = pi->adapter;
2209 struct sge_rspq *q = &qs->rspq; 2214 struct sge_rspq *q = &qs->rspq;
2210 2215
2211 spin_lock(&q->lock); 2216 spin_lock(&q->lock);
@@ -2224,7 +2229,8 @@ irqreturn_t t3_sge_intr_msix(int irq, void *cookie)
2224irqreturn_t t3_sge_intr_msix_napi(int irq, void *cookie) 2229irqreturn_t t3_sge_intr_msix_napi(int irq, void *cookie)
2225{ 2230{
2226 struct sge_qset *qs = cookie; 2231 struct sge_qset *qs = cookie;
2227 struct adapter *adap = qs->netdev->priv; 2232 const struct port_info *pi = netdev_priv(qs->netdev);
2233 struct adapter *adap = pi->adapter;
2228 struct sge_rspq *q = &qs->rspq; 2234 struct sge_rspq *q = &qs->rspq;
2229 2235
2230 spin_lock(&q->lock); 2236 spin_lock(&q->lock);
@@ -2508,7 +2514,8 @@ static void sge_timer_cb(unsigned long data)
2508{ 2514{
2509 spinlock_t *lock; 2515 spinlock_t *lock;
2510 struct sge_qset *qs = (struct sge_qset *)data; 2516 struct sge_qset *qs = (struct sge_qset *)data;
2511 struct adapter *adap = qs->netdev->priv; 2517 const struct port_info *pi = netdev_priv(qs->netdev);
2518 struct adapter *adap = pi->adapter;
2512 2519
2513 if (spin_trylock(&qs->txq[TXQ_ETH].lock)) { 2520 if (spin_trylock(&qs->txq[TXQ_ETH].lock)) {
2514 reclaim_completed_tx(adap, &qs->txq[TXQ_ETH]); 2521 reclaim_completed_tx(adap, &qs->txq[TXQ_ETH]);
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index dd3149d94ba8..b02d15daf5d9 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -848,16 +848,15 @@ static int t3_write_flash(struct adapter *adapter, unsigned int addr,
848} 848}
849 849
850/** 850/**
851 * t3_check_tpsram_version - read the tp sram version 851 * t3_get_tp_version - read the tp sram version
852 * @adapter: the adapter 852 * @adapter: the adapter
853 * @vers: where to place the version
853 * 854 *
854 * Reads the protocol sram version from serial eeprom. 855 * Reads the protocol sram version from sram.
855 */ 856 */
856int t3_check_tpsram_version(struct adapter *adapter) 857int t3_get_tp_version(struct adapter *adapter, u32 *vers)
857{ 858{
858 int ret; 859 int ret;
859 u32 vers;
860 unsigned int major, minor;
861 860
862 /* Get version loaded in SRAM */ 861 /* Get version loaded in SRAM */
863 t3_write_reg(adapter, A_TP_EMBED_OP_FIELD0, 0); 862 t3_write_reg(adapter, A_TP_EMBED_OP_FIELD0, 0);
@@ -866,7 +865,32 @@ int t3_check_tpsram_version(struct adapter *adapter)
866 if (ret) 865 if (ret)
867 return ret; 866 return ret;
868 867
869 vers = t3_read_reg(adapter, A_TP_EMBED_OP_FIELD1); 868 *vers = t3_read_reg(adapter, A_TP_EMBED_OP_FIELD1);
869
870 return 0;
871}
872
873/**
874 * t3_check_tpsram_version - read the tp sram version
875 * @adapter: the adapter
876 * @must_load: set to 1 if loading a new microcode image is required
877 *
878 * Reads the protocol sram version from flash.
879 */
880int t3_check_tpsram_version(struct adapter *adapter, int *must_load)
881{
882 int ret;
883 u32 vers;
884 unsigned int major, minor;
885
886 if (adapter->params.rev == T3_REV_A)
887 return 0;
888
889 *must_load = 1;
890
891 ret = t3_get_tp_version(adapter, &vers);
892 if (ret)
893 return ret;
870 894
871 major = G_TP_VERSION_MAJOR(vers); 895 major = G_TP_VERSION_MAJOR(vers);
872 minor = G_TP_VERSION_MINOR(vers); 896 minor = G_TP_VERSION_MINOR(vers);
@@ -874,6 +898,16 @@ int t3_check_tpsram_version(struct adapter *adapter)
874 if (major == TP_VERSION_MAJOR && minor == TP_VERSION_MINOR) 898 if (major == TP_VERSION_MAJOR && minor == TP_VERSION_MINOR)
875 return 0; 899 return 0;
876 900
901 if (major != TP_VERSION_MAJOR)
902 CH_ERR(adapter, "found wrong TP version (%u.%u), "
903 "driver needs version %d.%d\n", major, minor,
904 TP_VERSION_MAJOR, TP_VERSION_MINOR);
905 else {
906 *must_load = 0;
907 CH_ERR(adapter, "found wrong TP version (%u.%u), "
908 "driver compiled for version %d.%d\n", major, minor,
909 TP_VERSION_MAJOR, TP_VERSION_MINOR);
910 }
877 return -EINVAL; 911 return -EINVAL;
878} 912}
879 913
diff --git a/drivers/net/cxgb3/t3cdev.h b/drivers/net/cxgb3/t3cdev.h
index fa4099bc0416..77fcc1a4984e 100644
--- a/drivers/net/cxgb3/t3cdev.h
+++ b/drivers/net/cxgb3/t3cdev.h
@@ -42,9 +42,6 @@
42 42
43#define T3CNAMSIZ 16 43#define T3CNAMSIZ 16
44 44
45/* Get the t3cdev associated with a net_device */
46#define T3CDEV(netdev) (struct t3cdev *)(netdev->priv)
47
48struct cxgb3_client; 45struct cxgb3_client;
49 46
50enum t3ctype { 47enum t3ctype {
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index 3ca1e8ece548..0834ef0eddb4 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -48,6 +48,7 @@
48#ifdef CONFIG_SERIAL_8250 48#ifdef CONFIG_SERIAL_8250
49#include <linux/serial_core.h> 49#include <linux/serial_core.h>
50#include <linux/serial_8250.h> 50#include <linux/serial_8250.h>
51#include <linux/serial_reg.h>
51#endif 52#endif
52 53
53#include <linux/netdevice.h> 54#include <linux/netdevice.h>
@@ -1151,13 +1152,41 @@ static int ioc3_is_menet(struct pci_dev *pdev)
1151 * Also look in ip27-pci.c:pci_fixup_ioc3() for some comments on working 1152 * Also look in ip27-pci.c:pci_fixup_ioc3() for some comments on working
1152 * around ioc3 oddities in this respect. 1153 * around ioc3 oddities in this respect.
1153 * 1154 *
1154 * The IOC3 serials use a 22MHz clock rate with an additional divider by 3. 1155 * The IOC3 serials use a 22MHz clock rate with an additional divider which
1156 * can be programmed in the SCR register if the DLAB bit is set.
1157 *
1158 * Register to interrupt zero because we share the interrupt with
1159 * the serial driver which we don't properly support yet.
1160 *
1161 * Can't use UPF_IOREMAP as the whole of IOC3 resources have already been
1162 * registered.
1155 */ 1163 */
1164static void __devinit ioc3_8250_register(struct ioc3_uartregs __iomem *uart)
1165{
1166#define COSMISC_CONSTANT 6
1167
1168 struct uart_port port = {
1169 .irq = 0,
1170 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
1171 .iotype = UPIO_MEM,
1172 .regshift = 0,
1173 .uartclk = (22000000 << 1) / COSMISC_CONSTANT,
1174
1175 .membase = (unsigned char __iomem *) uart,
1176 .mapbase = (unsigned long) uart,
1177 };
1178 unsigned char lcr;
1179
1180 lcr = uart->iu_lcr;
1181 uart->iu_lcr = lcr | UART_LCR_DLAB;
1182 uart->iu_scr = COSMISC_CONSTANT,
1183 uart->iu_lcr = lcr;
1184 uart->iu_lcr;
1185 serial8250_register_port(&port);
1186}
1156 1187
1157static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) 1188static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3)
1158{ 1189{
1159 struct uart_port port;
1160
1161 /* 1190 /*
1162 * We need to recognice and treat the fourth MENET serial as it 1191 * We need to recognice and treat the fourth MENET serial as it
1163 * does not have an SuperIO chip attached to it, therefore attempting 1192 * does not have an SuperIO chip attached to it, therefore attempting
@@ -1171,24 +1200,35 @@ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3)
1171 return; 1200 return;
1172 1201
1173 /* 1202 /*
1174 * Register to interrupt zero because we share the interrupt with 1203 * Switch IOC3 to PIO mode. It probably already was but let's be
1175 * the serial driver which we don't properly support yet. 1204 * paranoid
1176 *
1177 * Can't use UPF_IOREMAP as the whole of IOC3 resources have already
1178 * been registered.
1179 */ 1205 */
1180 memset(&port, 0, sizeof(port)); 1206 ioc3->gpcr_s = GPCR_UARTA_MODESEL | GPCR_UARTB_MODESEL;
1181 port.irq = 0; 1207 ioc3->gpcr_s;
1182 port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; 1208 ioc3->gppr_6 = 0;
1183 port.iotype = UPIO_MEM; 1209 ioc3->gppr_6;
1184 port.regshift = 0; 1210 ioc3->gppr_7 = 0;
1185 port.uartclk = 22000000 / 3; 1211 ioc3->gppr_7;
1186 1212 ioc3->sscr_a = ioc3->sscr_a & ~SSCR_DMA_EN;
1187 port.membase = (unsigned char *) &ioc3->sregs.uarta; 1213 ioc3->sscr_a;
1188 serial8250_register_port(&port); 1214 ioc3->sscr_b = ioc3->sscr_b & ~SSCR_DMA_EN;
1189 1215 ioc3->sscr_b;
1190 port.membase = (unsigned char *) &ioc3->sregs.uartb; 1216 /* Disable all SA/B interrupts except for SA/B_INT in SIO_IEC. */
1191 serial8250_register_port(&port); 1217 ioc3->sio_iec &= ~ (SIO_IR_SA_TX_MT | SIO_IR_SA_RX_FULL |
1218 SIO_IR_SA_RX_HIGH | SIO_IR_SA_RX_TIMER |
1219 SIO_IR_SA_DELTA_DCD | SIO_IR_SA_DELTA_CTS |
1220 SIO_IR_SA_TX_EXPLICIT | SIO_IR_SA_MEMERR);
1221 ioc3->sio_iec |= SIO_IR_SA_INT;
1222 ioc3->sscr_a = 0;
1223 ioc3->sio_iec &= ~ (SIO_IR_SB_TX_MT | SIO_IR_SB_RX_FULL |
1224 SIO_IR_SB_RX_HIGH | SIO_IR_SB_RX_TIMER |
1225 SIO_IR_SB_DELTA_DCD | SIO_IR_SB_DELTA_CTS |
1226 SIO_IR_SB_TX_EXPLICIT | SIO_IR_SB_MEMERR);
1227 ioc3->sio_iec |= SIO_IR_SB_INT;
1228 ioc3->sscr_b = 0;
1229
1230 ioc3_8250_register(&ioc3->sregs.uarta);
1231 ioc3_8250_register(&ioc3->sregs.uartb);
1192} 1232}
1193#endif 1233#endif
1194 1234
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index 3276866b17e2..d72f8f8fcb50 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -649,9 +649,11 @@ enum {
649#define PCIX_INT_VECTOR (0x10100) 649#define PCIX_INT_VECTOR (0x10100)
650#define PCIX_INT_MASK (0x10104) 650#define PCIX_INT_MASK (0x10104)
651 651
652#define PCIX_MN_WINDOW (0x10200) 652#define PCIX_MN_WINDOW_F0 (0x10200)
653#define PCIX_MN_WINDOW(_f) (PCIX_MN_WINDOW_F0 + (0x20 * (_f)))
653#define PCIX_MS_WINDOW (0x10204) 654#define PCIX_MS_WINDOW (0x10204)
654#define PCIX_SN_WINDOW (0x10208) 655#define PCIX_SN_WINDOW_F0 (0x10208)
656#define PCIX_SN_WINDOW(_f) (PCIX_SN_WINDOW_F0 + (0x20 * (_f)))
655#define PCIX_CRB_WINDOW (0x10210) 657#define PCIX_CRB_WINDOW (0x10210)
656#define PCIX_CRB_WINDOW_F0 (0x10210) 658#define PCIX_CRB_WINDOW_F0 (0x10210)
657#define PCIX_CRB_WINDOW_F1 (0x10230) 659#define PCIX_CRB_WINDOW_F1 (0x10230)
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index aac15421bd1e..a7b8d7f23259 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -904,11 +904,11 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter,
904 ddr_mn_window = window; 904 ddr_mn_window = window;
905 writel(window, PCI_OFFSET_SECOND_RANGE(adapter, 905 writel(window, PCI_OFFSET_SECOND_RANGE(adapter,
906 NETXEN_PCIX_PH_REG 906 NETXEN_PCIX_PH_REG
907 (PCIX_MN_WINDOW))); 907 (PCIX_MN_WINDOW(adapter->ahw.pci_func))));
908 /* MUST make sure window is set before we forge on... */ 908 /* MUST make sure window is set before we forge on... */
909 readl(PCI_OFFSET_SECOND_RANGE(adapter, 909 readl(PCI_OFFSET_SECOND_RANGE(adapter,
910 NETXEN_PCIX_PH_REG 910 NETXEN_PCIX_PH_REG
911 (PCIX_MN_WINDOW))); 911 (PCIX_MN_WINDOW(adapter->ahw.pci_func))));
912 } 912 }
913 addr -= (window * NETXEN_WINDOW_ONE); 913 addr -= (window * NETXEN_WINDOW_ONE);
914 addr += NETXEN_PCI_DDR_NET; 914 addr += NETXEN_PCI_DDR_NET;
@@ -929,11 +929,11 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter,
929 writel((window << 22), 929 writel((window << 22),
930 PCI_OFFSET_SECOND_RANGE(adapter, 930 PCI_OFFSET_SECOND_RANGE(adapter,
931 NETXEN_PCIX_PH_REG 931 NETXEN_PCIX_PH_REG
932 (PCIX_SN_WINDOW))); 932 (PCIX_SN_WINDOW(adapter->ahw.pci_func))));
933 /* MUST make sure window is set before we forge on... */ 933 /* MUST make sure window is set before we forge on... */
934 readl(PCI_OFFSET_SECOND_RANGE(adapter, 934 readl(PCI_OFFSET_SECOND_RANGE(adapter,
935 NETXEN_PCIX_PH_REG 935 NETXEN_PCIX_PH_REG
936 (PCIX_SN_WINDOW))); 936 (PCIX_SN_WINDOW(adapter->ahw.pci_func))));
937 } 937 }
938 addr -= (window * 0x400000); 938 addr -= (window * 0x400000);
939 addr += NETXEN_PCI_QDR_NET; 939 addr += NETXEN_PCI_QDR_NET;
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 08a62acde8bf..3122d0101638 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -639,10 +639,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
639 NETXEN_CRB_NORMALIZE(adapter, 639 NETXEN_CRB_NORMALIZE(adapter,
640 NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); 640 NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
641 /* Handshake with the card before we register the devices. */ 641 /* Handshake with the card before we register the devices. */
642 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
643 netxen_pinit_from_rom(adapter, 0);
644 msleep(1);
645 netxen_load_firmware(adapter);
646 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 642 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
647 } 643 }
648 644
@@ -750,9 +746,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
750 746
751 netxen_nic_disable_int(adapter); 747 netxen_nic_disable_int(adapter);
752 748
753 if (adapter->irq)
754 free_irq(adapter->irq, adapter);
755
756 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 749 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
757 init_firmware_done++; 750 init_firmware_done++;
758 netxen_free_hw_resources(adapter); 751 netxen_free_hw_resources(adapter);
@@ -776,13 +769,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
776 } 769 }
777 } 770 }
778 771
779 if (adapter->flags & NETXEN_NIC_MSI_ENABLED)
780 pci_disable_msi(pdev);
781
782 vfree(adapter->cmd_buf_arr); 772 vfree(adapter->cmd_buf_arr);
783 773
784 pci_disable_device(pdev);
785
786 if (adapter->portnum == 0) { 774 if (adapter->portnum == 0) {
787 if (init_firmware_done) { 775 if (init_firmware_done) {
788 i = 100; 776 i = 100;
@@ -833,12 +821,19 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
833 } 821 }
834 } 822 }
835 823
824 if (adapter->irq)
825 free_irq(adapter->irq, adapter);
826
827 if (adapter->flags & NETXEN_NIC_MSI_ENABLED)
828 pci_disable_msi(pdev);
829
836 iounmap(adapter->ahw.db_base); 830 iounmap(adapter->ahw.db_base);
837 iounmap(adapter->ahw.pci_base0); 831 iounmap(adapter->ahw.pci_base0);
838 iounmap(adapter->ahw.pci_base1); 832 iounmap(adapter->ahw.pci_base1);
839 iounmap(adapter->ahw.pci_base2); 833 iounmap(adapter->ahw.pci_base2);
840 834
841 pci_release_regions(pdev); 835 pci_release_regions(pdev);
836 pci_disable_device(pdev);
842 pci_set_drvdata(pdev, NULL); 837 pci_set_drvdata(pdev, NULL);
843 838
844 free_netdev(netdev); 839 free_netdev(netdev);
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 13d1c0a2a25f..e56503918436 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -556,7 +556,6 @@ static int gelic_net_stop(struct net_device *netdev)
556{ 556{
557 struct gelic_net_card *card = netdev_priv(netdev); 557 struct gelic_net_card *card = netdev_priv(netdev);
558 558
559 netif_poll_disable(netdev);
560 netif_stop_queue(netdev); 559 netif_stop_queue(netdev);
561 560
562 /* turn off DMA, force end */ 561 /* turn off DMA, force end */
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index ec18bae05df0..6d4959807abc 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -1178,9 +1178,9 @@ qeth_ipaddr_to_string(enum qeth_prot_versions proto, const __u8 *addr,
1178 char *buf) 1178 char *buf)
1179{ 1179{
1180 if (proto == QETH_PROT_IPV4) 1180 if (proto == QETH_PROT_IPV4)
1181 return qeth_ipaddr4_to_string(addr, buf); 1181 qeth_ipaddr4_to_string(addr, buf);
1182 else if (proto == QETH_PROT_IPV6) 1182 else if (proto == QETH_PROT_IPV6)
1183 return qeth_ipaddr6_to_string(addr, buf); 1183 qeth_ipaddr6_to_string(addr, buf);
1184} 1184}
1185 1185
1186static inline int 1186static inline int
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 57f69434fbf9..f3e6fbeb2123 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -561,7 +561,7 @@ qeth_set_offline(struct ccwgroup_device *cgdev)
561} 561}
562 562
563static int 563static int
564qeth_wait_for_threads(struct qeth_card *card, unsigned long threads); 564qeth_threads_running(struct qeth_card *card, unsigned long threads);
565 565
566 566
567static void 567static void
@@ -576,8 +576,7 @@ qeth_remove_device(struct ccwgroup_device *cgdev)
576 if (!card) 576 if (!card)
577 return; 577 return;
578 578
579 if (qeth_wait_for_threads(card, 0xffffffff)) 579 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0);
580 return;
581 580
582 if (cgdev->state == CCWGROUP_ONLINE){ 581 if (cgdev->state == CCWGROUP_ONLINE){
583 card->use_hard_stop = 1; 582 card->use_hard_stop = 1;
@@ -1542,16 +1541,21 @@ qeth_idx_write_cb(struct qeth_channel *channel, struct qeth_cmd_buffer *iob)
1542 card = CARD_FROM_CDEV(channel->ccwdev); 1541 card = CARD_FROM_CDEV(channel->ccwdev);
1543 1542
1544 if (!(QETH_IS_IDX_ACT_POS_REPLY(iob->data))) { 1543 if (!(QETH_IS_IDX_ACT_POS_REPLY(iob->data))) {
1545 PRINT_ERR("IDX_ACTIVATE on write channel device %s: negative " 1544 if (QETH_IDX_ACT_CAUSE_CODE(iob->data) == 0x19)
1546 "reply\n", CARD_WDEV_ID(card)); 1545 PRINT_ERR("IDX_ACTIVATE on write channel device %s: "
1546 "adapter exclusively used by another host\n",
1547 CARD_WDEV_ID(card));
1548 else
1549 PRINT_ERR("IDX_ACTIVATE on write channel device %s: "
1550 "negative reply\n", CARD_WDEV_ID(card));
1547 goto out; 1551 goto out;
1548 } 1552 }
1549 memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2); 1553 memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2);
1550 if ((temp & ~0x0100) != qeth_peer_func_level(card->info.func_level)) { 1554 if ((temp & ~0x0100) != qeth_peer_func_level(card->info.func_level)) {
1551 PRINT_WARN("IDX_ACTIVATE on write channel device %s: " 1555 PRINT_WARN("IDX_ACTIVATE on write channel device %s: "
1552 "function level mismatch " 1556 "function level mismatch "
1553 "(sent: 0x%x, received: 0x%x)\n", 1557 "(sent: 0x%x, received: 0x%x)\n",
1554 CARD_WDEV_ID(card), card->info.func_level, temp); 1558 CARD_WDEV_ID(card), card->info.func_level, temp);
1555 goto out; 1559 goto out;
1556 } 1560 }
1557 channel->state = CH_STATE_UP; 1561 channel->state = CH_STATE_UP;
@@ -1597,8 +1601,13 @@ qeth_idx_read_cb(struct qeth_channel *channel, struct qeth_cmd_buffer *iob)
1597 goto out; 1601 goto out;
1598 } 1602 }
1599 if (!(QETH_IS_IDX_ACT_POS_REPLY(iob->data))) { 1603 if (!(QETH_IS_IDX_ACT_POS_REPLY(iob->data))) {
1600 PRINT_ERR("IDX_ACTIVATE on read channel device %s: negative " 1604 if (QETH_IDX_ACT_CAUSE_CODE(iob->data) == 0x19)
1601 "reply\n", CARD_RDEV_ID(card)); 1605 PRINT_ERR("IDX_ACTIVATE on read channel device %s: "
1606 "adapter exclusively used by another host\n",
1607 CARD_RDEV_ID(card));
1608 else
1609 PRINT_ERR("IDX_ACTIVATE on read channel device %s: "
1610 "negative reply\n", CARD_RDEV_ID(card));
1602 goto out; 1611 goto out;
1603 } 1612 }
1604 1613
@@ -1613,8 +1622,8 @@ qeth_idx_read_cb(struct qeth_channel *channel, struct qeth_cmd_buffer *iob)
1613 memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2); 1622 memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2);
1614 if (temp != qeth_peer_func_level(card->info.func_level)) { 1623 if (temp != qeth_peer_func_level(card->info.func_level)) {
1615 PRINT_WARN("IDX_ACTIVATE on read channel device %s: function " 1624 PRINT_WARN("IDX_ACTIVATE on read channel device %s: function "
1616 "level mismatch (sent: 0x%x, received: 0x%x)\n", 1625 "level mismatch (sent: 0x%x, received: 0x%x)\n",
1617 CARD_RDEV_ID(card), card->info.func_level, temp); 1626 CARD_RDEV_ID(card), card->info.func_level, temp);
1618 goto out; 1627 goto out;
1619 } 1628 }
1620 memcpy(&card->token.issuer_rm_r, 1629 memcpy(&card->token.issuer_rm_r,
@@ -2496,7 +2505,7 @@ qeth_rebuild_skb_fake_ll_tr(struct qeth_card *card, struct sk_buff *skb,
2496 struct iphdr *ip_hdr; 2505 struct iphdr *ip_hdr;
2497 2506
2498 QETH_DBF_TEXT(trace,5,"skbfktr"); 2507 QETH_DBF_TEXT(trace,5,"skbfktr");
2499 skb_set_mac_header(skb, -QETH_FAKE_LL_LEN_TR); 2508 skb_set_mac_header(skb, (int)-QETH_FAKE_LL_LEN_TR);
2500 /* this is a fake ethernet header */ 2509 /* this is a fake ethernet header */
2501 fake_hdr = tr_hdr(skb); 2510 fake_hdr = tr_hdr(skb);
2502 2511
@@ -2804,13 +2813,16 @@ qeth_queue_input_buffer(struct qeth_card *card, int index)
2804 if (newcount < count) { 2813 if (newcount < count) {
2805 /* we are in memory shortage so we switch back to 2814 /* we are in memory shortage so we switch back to
2806 traditional skb allocation and drop packages */ 2815 traditional skb allocation and drop packages */
2807 if (atomic_cmpxchg(&card->force_alloc_skb, 0, 1)) 2816 if (!atomic_read(&card->force_alloc_skb) &&
2808 printk(KERN_WARNING 2817 net_ratelimit())
2809 "qeth: switch to alloc skb\n"); 2818 PRINT_WARN("Switch to alloc skb\n");
2819 atomic_set(&card->force_alloc_skb, 3);
2810 count = newcount; 2820 count = newcount;
2811 } else { 2821 } else {
2812 if (atomic_cmpxchg(&card->force_alloc_skb, 1, 0)) 2822 if ((atomic_read(&card->force_alloc_skb) == 1) &&
2813 printk(KERN_WARNING "qeth: switch to sg\n"); 2823 net_ratelimit())
2824 PRINT_WARN("Switch to sg\n");
2825 atomic_add_unless(&card->force_alloc_skb, -1, 0);
2814 } 2826 }
2815 2827
2816 /* 2828 /*
@@ -3354,10 +3366,12 @@ out_freeoutq:
3354 while (i > 0) 3366 while (i > 0)
3355 kfree(card->qdio.out_qs[--i]); 3367 kfree(card->qdio.out_qs[--i]);
3356 kfree(card->qdio.out_qs); 3368 kfree(card->qdio.out_qs);
3369 card->qdio.out_qs = NULL;
3357out_freepool: 3370out_freepool:
3358 qeth_free_buffer_pool(card); 3371 qeth_free_buffer_pool(card);
3359out_freeinq: 3372out_freeinq:
3360 kfree(card->qdio.in_q); 3373 kfree(card->qdio.in_q);
3374 card->qdio.in_q = NULL;
3361out_nomem: 3375out_nomem:
3362 atomic_set(&card->qdio.state, QETH_QDIO_UNINITIALIZED); 3376 atomic_set(&card->qdio.state, QETH_QDIO_UNINITIALIZED);
3363 return -ENOMEM; 3377 return -ENOMEM;
@@ -3373,16 +3387,20 @@ qeth_free_qdio_buffers(struct qeth_card *card)
3373 QETH_QDIO_UNINITIALIZED) 3387 QETH_QDIO_UNINITIALIZED)
3374 return; 3388 return;
3375 kfree(card->qdio.in_q); 3389 kfree(card->qdio.in_q);
3390 card->qdio.in_q = NULL;
3376 /* inbound buffer pool */ 3391 /* inbound buffer pool */
3377 qeth_free_buffer_pool(card); 3392 qeth_free_buffer_pool(card);
3378 /* free outbound qdio_qs */ 3393 /* free outbound qdio_qs */
3379 for (i = 0; i < card->qdio.no_out_queues; ++i){ 3394 if (card->qdio.out_qs) {
3380 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) 3395 for (i = 0; i < card->qdio.no_out_queues; ++i) {
3381 qeth_clear_output_buffer(card->qdio.out_qs[i], 3396 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j)
3382 &card->qdio.out_qs[i]->bufs[j]); 3397 qeth_clear_output_buffer(card->qdio.out_qs[i],
3383 kfree(card->qdio.out_qs[i]); 3398 &card->qdio.out_qs[i]->bufs[j]);
3399 kfree(card->qdio.out_qs[i]);
3400 }
3401 kfree(card->qdio.out_qs);
3402 card->qdio.out_qs = NULL;
3384 } 3403 }
3385 kfree(card->qdio.out_qs);
3386} 3404}
3387 3405
3388static void 3406static void
@@ -3393,7 +3411,7 @@ qeth_clear_qdio_buffers(struct qeth_card *card)
3393 QETH_DBF_TEXT(trace, 2, "clearqdbf"); 3411 QETH_DBF_TEXT(trace, 2, "clearqdbf");
3394 /* clear outbound buffers to free skbs */ 3412 /* clear outbound buffers to free skbs */
3395 for (i = 0; i < card->qdio.no_out_queues; ++i) 3413 for (i = 0; i < card->qdio.no_out_queues; ++i)
3396 if (card->qdio.out_qs[i]){ 3414 if (card->qdio.out_qs && card->qdio.out_qs[i]) {
3397 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) 3415 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j)
3398 qeth_clear_output_buffer(card->qdio.out_qs[i], 3416 qeth_clear_output_buffer(card->qdio.out_qs[i],
3399 &card->qdio.out_qs[i]->bufs[j]); 3417 &card->qdio.out_qs[i]->bufs[j]);
@@ -4553,6 +4571,53 @@ qeth_get_elements_no(struct qeth_card *card, void *hdr,
4553 return elements_needed; 4571 return elements_needed;
4554} 4572}
4555 4573
4574static void qeth_tx_csum(struct sk_buff *skb)
4575{
4576 int tlen;
4577
4578 if (skb->protocol == htons(ETH_P_IP)) {
4579 tlen = ntohs(ip_hdr(skb)->tot_len) - (ip_hdr(skb)->ihl << 2);
4580 switch (ip_hdr(skb)->protocol) {
4581 case IPPROTO_TCP:
4582 tcp_hdr(skb)->check = 0;
4583 tcp_hdr(skb)->check = csum_tcpudp_magic(
4584 ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
4585 tlen, ip_hdr(skb)->protocol,
4586 skb_checksum(skb, skb_transport_offset(skb),
4587 tlen, 0));
4588 break;
4589 case IPPROTO_UDP:
4590 udp_hdr(skb)->check = 0;
4591 udp_hdr(skb)->check = csum_tcpudp_magic(
4592 ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
4593 tlen, ip_hdr(skb)->protocol,
4594 skb_checksum(skb, skb_transport_offset(skb),
4595 tlen, 0));
4596 break;
4597 }
4598 } else if (skb->protocol == htons(ETH_P_IPV6)) {
4599 switch (ipv6_hdr(skb)->nexthdr) {
4600 case IPPROTO_TCP:
4601 tcp_hdr(skb)->check = 0;
4602 tcp_hdr(skb)->check = csum_ipv6_magic(
4603 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
4604 ipv6_hdr(skb)->payload_len,
4605 ipv6_hdr(skb)->nexthdr,
4606 skb_checksum(skb, skb_transport_offset(skb),
4607 ipv6_hdr(skb)->payload_len, 0));
4608 break;
4609 case IPPROTO_UDP:
4610 udp_hdr(skb)->check = 0;
4611 udp_hdr(skb)->check = csum_ipv6_magic(
4612 &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
4613 ipv6_hdr(skb)->payload_len,
4614 ipv6_hdr(skb)->nexthdr,
4615 skb_checksum(skb, skb_transport_offset(skb),
4616 ipv6_hdr(skb)->payload_len, 0));
4617 break;
4618 }
4619 }
4620}
4556 4621
4557static int 4622static int
4558qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) 4623qeth_send_packet(struct qeth_card *card, struct sk_buff *skb)
@@ -4638,12 +4703,22 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb)
4638 elements_needed += elems; 4703 elements_needed += elems;
4639 } 4704 }
4640 4705
4706 if ((large_send == QETH_LARGE_SEND_NO) &&
4707 (skb->ip_summed == CHECKSUM_PARTIAL))
4708 qeth_tx_csum(new_skb);
4709
4641 if (card->info.type != QETH_CARD_TYPE_IQD) 4710 if (card->info.type != QETH_CARD_TYPE_IQD)
4642 rc = qeth_do_send_packet(card, queue, new_skb, hdr, 4711 rc = qeth_do_send_packet(card, queue, new_skb, hdr,
4643 elements_needed, ctx); 4712 elements_needed, ctx);
4644 else 4713 else {
4714 if ((skb->protocol == htons(ETH_P_ARP)) &&
4715 (card->dev->flags & IFF_NOARP)) {
4716 __qeth_free_new_skb(skb, new_skb);
4717 return -EPERM;
4718 }
4645 rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr, 4719 rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr,
4646 elements_needed, ctx); 4720 elements_needed, ctx);
4721 }
4647 if (!rc) { 4722 if (!rc) {
4648 card->stats.tx_packets++; 4723 card->stats.tx_packets++;
4649 card->stats.tx_bytes += tx_bytes; 4724 card->stats.tx_bytes += tx_bytes;
@@ -6385,20 +6460,18 @@ qeth_deregister_addr_entry(struct qeth_card *card, struct qeth_ipaddr *addr)
6385static u32 6460static u32
6386qeth_ethtool_get_tx_csum(struct net_device *dev) 6461qeth_ethtool_get_tx_csum(struct net_device *dev)
6387{ 6462{
6388 /* We may need to say that we support tx csum offload if 6463 return (dev->features & NETIF_F_HW_CSUM) != 0;
6389 * we do EDDP or TSO. There are discussions going on to
6390 * enforce rules in the stack and in ethtool that make
6391 * SG and TSO depend on HW_CSUM. At the moment there are
6392 * no such rules....
6393 * If we say yes here, we have to checksum outbound packets
6394 * any time. */
6395 return 0;
6396} 6464}
6397 6465
6398static int 6466static int
6399qeth_ethtool_set_tx_csum(struct net_device *dev, u32 data) 6467qeth_ethtool_set_tx_csum(struct net_device *dev, u32 data)
6400{ 6468{
6401 return -EINVAL; 6469 if (data)
6470 dev->features |= NETIF_F_HW_CSUM;
6471 else
6472 dev->features &= ~NETIF_F_HW_CSUM;
6473
6474 return 0;
6402} 6475}
6403 6476
6404static u32 6477static u32
@@ -7412,7 +7485,8 @@ qeth_start_ipa_tso(struct qeth_card *card)
7412 } 7485 }
7413 if (rc && (card->options.large_send == QETH_LARGE_SEND_TSO)){ 7486 if (rc && (card->options.large_send == QETH_LARGE_SEND_TSO)){
7414 card->options.large_send = QETH_LARGE_SEND_NO; 7487 card->options.large_send = QETH_LARGE_SEND_NO;
7415 card->dev->features &= ~ (NETIF_F_TSO | NETIF_F_SG); 7488 card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG |
7489 NETIF_F_HW_CSUM);
7416 } 7490 }
7417 return rc; 7491 return rc;
7418} 7492}
@@ -7552,22 +7626,26 @@ qeth_set_large_send(struct qeth_card *card, enum qeth_large_send_types type)
7552 card->options.large_send = type; 7626 card->options.large_send = type;
7553 switch (card->options.large_send) { 7627 switch (card->options.large_send) {
7554 case QETH_LARGE_SEND_EDDP: 7628 case QETH_LARGE_SEND_EDDP:
7555 card->dev->features |= NETIF_F_TSO | NETIF_F_SG; 7629 card->dev->features |= NETIF_F_TSO | NETIF_F_SG |
7630 NETIF_F_HW_CSUM;
7556 break; 7631 break;
7557 case QETH_LARGE_SEND_TSO: 7632 case QETH_LARGE_SEND_TSO:
7558 if (qeth_is_supported(card, IPA_OUTBOUND_TSO)){ 7633 if (qeth_is_supported(card, IPA_OUTBOUND_TSO)){
7559 card->dev->features |= NETIF_F_TSO | NETIF_F_SG; 7634 card->dev->features |= NETIF_F_TSO | NETIF_F_SG |
7635 NETIF_F_HW_CSUM;
7560 } else { 7636 } else {
7561 PRINT_WARN("TSO not supported on %s. " 7637 PRINT_WARN("TSO not supported on %s. "
7562 "large_send set to 'no'.\n", 7638 "large_send set to 'no'.\n",
7563 card->dev->name); 7639 card->dev->name);
7564 card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG); 7640 card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG |
7641 NETIF_F_HW_CSUM);
7565 card->options.large_send = QETH_LARGE_SEND_NO; 7642 card->options.large_send = QETH_LARGE_SEND_NO;
7566 rc = -EOPNOTSUPP; 7643 rc = -EOPNOTSUPP;
7567 } 7644 }
7568 break; 7645 break;
7569 default: /* includes QETH_LARGE_SEND_NO */ 7646 default: /* includes QETH_LARGE_SEND_NO */
7570 card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG); 7647 card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG |
7648 NETIF_F_HW_CSUM);
7571 break; 7649 break;
7572 } 7650 }
7573 if (card->state == CARD_STATE_UP) 7651 if (card->state == CARD_STATE_UP)
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h
index 1d8083c91765..6de2da5ed5fd 100644
--- a/drivers/s390/net/qeth_mpc.h
+++ b/drivers/s390/net/qeth_mpc.h
@@ -565,6 +565,7 @@ extern unsigned char IDX_ACTIVATE_WRITE[];
565#define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer+0x20) 565#define QETH_IDX_ACT_QDIO_DEV_REALADDR(buffer) (buffer+0x20)
566#define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08]&3)==2) 566#define QETH_IS_IDX_ACT_POS_REPLY(buffer) (((buffer)[0x08]&3)==2)
567#define QETH_IDX_REPLY_LEVEL(buffer) (buffer+0x12) 567#define QETH_IDX_REPLY_LEVEL(buffer) (buffer+0x12)
568#define QETH_IDX_ACT_CAUSE_CODE(buffer) (buffer)[0x09]
568 569
569#define PDU_ENCAPSULATION(buffer) \ 570#define PDU_ENCAPSULATION(buffer) \
570 (buffer + *(buffer + (*(buffer+0x0b)) + \ 571 (buffer + *(buffer + (*(buffer+0x0b)) + \
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c
index bb0287ad1aac..2cc3f3a0e393 100644
--- a/drivers/s390/net/qeth_sys.c
+++ b/drivers/s390/net/qeth_sys.c
@@ -1760,10 +1760,10 @@ qeth_remove_device_attributes(struct device *dev)
1760{ 1760{
1761 struct qeth_card *card = dev->driver_data; 1761 struct qeth_card *card = dev->driver_data;
1762 1762
1763 if (card->info.type == QETH_CARD_TYPE_OSN) 1763 if (card->info.type == QETH_CARD_TYPE_OSN) {
1764 return sysfs_remove_group(&dev->kobj, 1764 sysfs_remove_group(&dev->kobj, &qeth_osn_device_attr_group);
1765 &qeth_osn_device_attr_group); 1765 return;
1766 1766 }
1767 sysfs_remove_group(&dev->kobj, &qeth_device_attr_group); 1767 sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
1768 sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group); 1768 sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
1769 sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group); 1769 sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group);