diff options
Diffstat (limited to 'drivers/infiniband/hw/nes/nes_nic.c')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_nic.c | 180 |
1 files changed, 107 insertions, 73 deletions
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index e5366b013c1a..1b0938c87774 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -185,12 +185,13 @@ static int nes_netdev_open(struct net_device *netdev) | |||
185 | nic_active |= nic_active_bit; | 185 | nic_active |= nic_active_bit; |
186 | nes_write_indexed(nesdev, NES_IDX_NIC_BROADCAST_ON, nic_active); | 186 | nes_write_indexed(nesdev, NES_IDX_NIC_BROADCAST_ON, nic_active); |
187 | 187 | ||
188 | macaddr_high = ((u16)netdev->dev_addr[0]) << 8; | 188 | macaddr_high = ((u16)netdev->dev_addr[0]) << 8; |
189 | macaddr_high += (u16)netdev->dev_addr[1]; | 189 | macaddr_high += (u16)netdev->dev_addr[1]; |
190 | macaddr_low = ((u32)netdev->dev_addr[2]) << 24; | 190 | |
191 | macaddr_low += ((u32)netdev->dev_addr[3]) << 16; | 191 | macaddr_low = ((u32)netdev->dev_addr[2]) << 24; |
192 | macaddr_low += ((u32)netdev->dev_addr[4]) << 8; | 192 | macaddr_low += ((u32)netdev->dev_addr[3]) << 16; |
193 | macaddr_low += (u32)netdev->dev_addr[5]; | 193 | macaddr_low += ((u32)netdev->dev_addr[4]) << 8; |
194 | macaddr_low += (u32)netdev->dev_addr[5]; | ||
194 | 195 | ||
195 | /* Program the various MAC regs */ | 196 | /* Program the various MAC regs */ |
196 | for (i = 0; i < NES_MAX_PORT_COUNT; i++) { | 197 | for (i = 0; i < NES_MAX_PORT_COUNT; i++) { |
@@ -451,7 +452,7 @@ static int nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
451 | __le16 *wqe_fragment_length; | 452 | __le16 *wqe_fragment_length; |
452 | u32 nr_frags; | 453 | u32 nr_frags; |
453 | u32 original_first_length; | 454 | u32 original_first_length; |
454 | // u64 *wqe_fragment_address; | 455 | /* u64 *wqe_fragment_address; */ |
455 | /* first fragment (0) is used by copy buffer */ | 456 | /* first fragment (0) is used by copy buffer */ |
456 | u16 wqe_fragment_index=1; | 457 | u16 wqe_fragment_index=1; |
457 | u16 hoffset; | 458 | u16 hoffset; |
@@ -461,11 +462,12 @@ static int nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
461 | u32 old_head; | 462 | u32 old_head; |
462 | u32 wqe_misc; | 463 | u32 wqe_misc; |
463 | 464 | ||
464 | /* nes_debug(NES_DBG_NIC_TX, "%s Request to tx NIC packet length %u, headlen %u," | 465 | /* |
465 | " (%u frags), tso_size=%u\n", | 466 | * nes_debug(NES_DBG_NIC_TX, "%s Request to tx NIC packet length %u, headlen %u," |
466 | netdev->name, skb->len, skb_headlen(skb), | 467 | * " (%u frags), tso_size=%u\n", |
467 | skb_shinfo(skb)->nr_frags, skb_is_gso(skb)); | 468 | * netdev->name, skb->len, skb_headlen(skb), |
468 | */ | 469 | * skb_shinfo(skb)->nr_frags, skb_is_gso(skb)); |
470 | */ | ||
469 | 471 | ||
470 | if (!netif_carrier_ok(netdev)) | 472 | if (!netif_carrier_ok(netdev)) |
471 | return NETDEV_TX_OK; | 473 | return NETDEV_TX_OK; |
@@ -795,12 +797,12 @@ static int nes_netdev_set_mac_address(struct net_device *netdev, void *p) | |||
795 | memcpy(netdev->dev_addr, mac_addr->sa_data, netdev->addr_len); | 797 | memcpy(netdev->dev_addr, mac_addr->sa_data, netdev->addr_len); |
796 | printk(PFX "%s: Address length = %d, Address = %s\n", | 798 | printk(PFX "%s: Address length = %d, Address = %s\n", |
797 | __func__, netdev->addr_len, print_mac(mac, mac_addr->sa_data)); | 799 | __func__, netdev->addr_len, print_mac(mac, mac_addr->sa_data)); |
798 | macaddr_high = ((u16)netdev->dev_addr[0]) << 8; | 800 | macaddr_high = ((u16)netdev->dev_addr[0]) << 8; |
799 | macaddr_high += (u16)netdev->dev_addr[1]; | 801 | macaddr_high += (u16)netdev->dev_addr[1]; |
800 | macaddr_low = ((u32)netdev->dev_addr[2]) << 24; | 802 | macaddr_low = ((u32)netdev->dev_addr[2]) << 24; |
801 | macaddr_low += ((u32)netdev->dev_addr[3]) << 16; | 803 | macaddr_low += ((u32)netdev->dev_addr[3]) << 16; |
802 | macaddr_low += ((u32)netdev->dev_addr[4]) << 8; | 804 | macaddr_low += ((u32)netdev->dev_addr[4]) << 8; |
803 | macaddr_low += (u32)netdev->dev_addr[5]; | 805 | macaddr_low += (u32)netdev->dev_addr[5]; |
804 | 806 | ||
805 | for (i = 0; i < NES_MAX_PORT_COUNT; i++) { | 807 | for (i = 0; i < NES_MAX_PORT_COUNT; i++) { |
806 | if (nesvnic->qp_nic_index[i] == 0xf) { | 808 | if (nesvnic->qp_nic_index[i] == 0xf) { |
@@ -881,12 +883,12 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev) | |||
881 | print_mac(mac, multicast_addr->dmi_addr), | 883 | print_mac(mac, multicast_addr->dmi_addr), |
882 | perfect_filter_register_address+(mc_index * 8), | 884 | perfect_filter_register_address+(mc_index * 8), |
883 | mc_nic_index); | 885 | mc_nic_index); |
884 | macaddr_high = ((u16)multicast_addr->dmi_addr[0]) << 8; | 886 | macaddr_high = ((u16)multicast_addr->dmi_addr[0]) << 8; |
885 | macaddr_high += (u16)multicast_addr->dmi_addr[1]; | 887 | macaddr_high += (u16)multicast_addr->dmi_addr[1]; |
886 | macaddr_low = ((u32)multicast_addr->dmi_addr[2]) << 24; | 888 | macaddr_low = ((u32)multicast_addr->dmi_addr[2]) << 24; |
887 | macaddr_low += ((u32)multicast_addr->dmi_addr[3]) << 16; | 889 | macaddr_low += ((u32)multicast_addr->dmi_addr[3]) << 16; |
888 | macaddr_low += ((u32)multicast_addr->dmi_addr[4]) << 8; | 890 | macaddr_low += ((u32)multicast_addr->dmi_addr[4]) << 8; |
889 | macaddr_low += (u32)multicast_addr->dmi_addr[5]; | 891 | macaddr_low += (u32)multicast_addr->dmi_addr[5]; |
890 | nes_write_indexed(nesdev, | 892 | nes_write_indexed(nesdev, |
891 | perfect_filter_register_address+(mc_index * 8), | 893 | perfect_filter_register_address+(mc_index * 8), |
892 | macaddr_low); | 894 | macaddr_low); |
@@ -910,23 +912,23 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev) | |||
910 | /** | 912 | /** |
911 | * nes_netdev_change_mtu | 913 | * nes_netdev_change_mtu |
912 | */ | 914 | */ |
913 | static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu) | 915 | static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu) |
914 | { | 916 | { |
915 | struct nes_vnic *nesvnic = netdev_priv(netdev); | 917 | struct nes_vnic *nesvnic = netdev_priv(netdev); |
916 | struct nes_device *nesdev = nesvnic->nesdev; | 918 | struct nes_device *nesdev = nesvnic->nesdev; |
917 | int ret = 0; | 919 | int ret = 0; |
918 | u8 jumbomode=0; | 920 | u8 jumbomode = 0; |
919 | 921 | ||
920 | if ((new_mtu < ETH_ZLEN) || (new_mtu > max_mtu)) | 922 | if ((new_mtu < ETH_ZLEN) || (new_mtu > max_mtu)) |
921 | return -EINVAL; | 923 | return -EINVAL; |
922 | 924 | ||
923 | netdev->mtu = new_mtu; | 925 | netdev->mtu = new_mtu; |
924 | nesvnic->max_frame_size = new_mtu + VLAN_ETH_HLEN; | 926 | nesvnic->max_frame_size = new_mtu + VLAN_ETH_HLEN; |
925 | 927 | ||
926 | if (netdev->mtu > 1500) { | 928 | if (netdev->mtu > 1500) { |
927 | jumbomode=1; | 929 | jumbomode=1; |
928 | } | 930 | } |
929 | nes_nic_init_timer_defaults(nesdev, jumbomode); | 931 | nes_nic_init_timer_defaults(nesdev, jumbomode); |
930 | 932 | ||
931 | if (netif_running(netdev)) { | 933 | if (netif_running(netdev)) { |
932 | nes_netdev_stop(netdev); | 934 | nes_netdev_stop(netdev); |
@@ -936,8 +938,7 @@ static int nes_netdev_change_mtu(struct net_device *netdev, int new_mtu) | |||
936 | return ret; | 938 | return ret; |
937 | } | 939 | } |
938 | 940 | ||
939 | #define NES_ETHTOOL_STAT_COUNT 55 | 941 | static const char nes_ethtool_stringset[][ETH_GSTRING_LEN] = { |
940 | static const char nes_ethtool_stringset[NES_ETHTOOL_STAT_COUNT][ETH_GSTRING_LEN] = { | ||
941 | "Link Change Interrupts", | 942 | "Link Change Interrupts", |
942 | "Linearized SKBs", | 943 | "Linearized SKBs", |
943 | "T/GSO Requests", | 944 | "T/GSO Requests", |
@@ -993,8 +994,12 @@ static const char nes_ethtool_stringset[NES_ETHTOOL_STAT_COUNT][ETH_GSTRING_LEN] | |||
993 | "CQ Depth 32", | 994 | "CQ Depth 32", |
994 | "CQ Depth 128", | 995 | "CQ Depth 128", |
995 | "CQ Depth 256", | 996 | "CQ Depth 256", |
997 | "LRO aggregated", | ||
998 | "LRO flushed", | ||
999 | "LRO no_desc", | ||
996 | }; | 1000 | }; |
997 | 1001 | ||
1002 | #define NES_ETHTOOL_STAT_COUNT ARRAY_SIZE(nes_ethtool_stringset) | ||
998 | 1003 | ||
999 | /** | 1004 | /** |
1000 | * nes_netdev_get_rx_csum | 1005 | * nes_netdev_get_rx_csum |
@@ -1189,6 +1194,9 @@ static void nes_netdev_get_ethtool_stats(struct net_device *netdev, | |||
1189 | target_stat_values[52] = int_mod_cq_depth_32; | 1194 | target_stat_values[52] = int_mod_cq_depth_32; |
1190 | target_stat_values[53] = int_mod_cq_depth_128; | 1195 | target_stat_values[53] = int_mod_cq_depth_128; |
1191 | target_stat_values[54] = int_mod_cq_depth_256; | 1196 | target_stat_values[54] = int_mod_cq_depth_256; |
1197 | target_stat_values[55] = nesvnic->lro_mgr.stats.aggregated; | ||
1198 | target_stat_values[56] = nesvnic->lro_mgr.stats.flushed; | ||
1199 | target_stat_values[57] = nesvnic->lro_mgr.stats.no_desc; | ||
1192 | 1200 | ||
1193 | } | 1201 | } |
1194 | 1202 | ||
@@ -1219,14 +1227,14 @@ static int nes_netdev_set_coalesce(struct net_device *netdev, | |||
1219 | struct ethtool_coalesce *et_coalesce) | 1227 | struct ethtool_coalesce *et_coalesce) |
1220 | { | 1228 | { |
1221 | struct nes_vnic *nesvnic = netdev_priv(netdev); | 1229 | struct nes_vnic *nesvnic = netdev_priv(netdev); |
1222 | struct nes_device *nesdev = nesvnic->nesdev; | 1230 | struct nes_device *nesdev = nesvnic->nesdev; |
1223 | struct nes_adapter *nesadapter = nesdev->nesadapter; | 1231 | struct nes_adapter *nesadapter = nesdev->nesadapter; |
1224 | struct nes_hw_tune_timer *shared_timer = &nesadapter->tune_timer; | 1232 | struct nes_hw_tune_timer *shared_timer = &nesadapter->tune_timer; |
1225 | unsigned long flags; | 1233 | unsigned long flags; |
1226 | 1234 | ||
1227 | spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags); | 1235 | spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags); |
1228 | if (et_coalesce->rx_max_coalesced_frames_low) { | 1236 | if (et_coalesce->rx_max_coalesced_frames_low) { |
1229 | shared_timer->threshold_low = et_coalesce->rx_max_coalesced_frames_low; | 1237 | shared_timer->threshold_low = et_coalesce->rx_max_coalesced_frames_low; |
1230 | } | 1238 | } |
1231 | if (et_coalesce->rx_max_coalesced_frames_irq) { | 1239 | if (et_coalesce->rx_max_coalesced_frames_irq) { |
1232 | shared_timer->threshold_target = et_coalesce->rx_max_coalesced_frames_irq; | 1240 | shared_timer->threshold_target = et_coalesce->rx_max_coalesced_frames_irq; |
@@ -1246,14 +1254,14 @@ static int nes_netdev_set_coalesce(struct net_device *netdev, | |||
1246 | nesadapter->et_rx_coalesce_usecs_irq = et_coalesce->rx_coalesce_usecs_irq; | 1254 | nesadapter->et_rx_coalesce_usecs_irq = et_coalesce->rx_coalesce_usecs_irq; |
1247 | if (et_coalesce->use_adaptive_rx_coalesce) { | 1255 | if (et_coalesce->use_adaptive_rx_coalesce) { |
1248 | nesadapter->et_use_adaptive_rx_coalesce = 1; | 1256 | nesadapter->et_use_adaptive_rx_coalesce = 1; |
1249 | nesadapter->timer_int_limit = NES_TIMER_INT_LIMIT_DYNAMIC; | 1257 | nesadapter->timer_int_limit = NES_TIMER_INT_LIMIT_DYNAMIC; |
1250 | nesadapter->et_rx_coalesce_usecs_irq = 0; | 1258 | nesadapter->et_rx_coalesce_usecs_irq = 0; |
1251 | if (et_coalesce->pkt_rate_low) { | 1259 | if (et_coalesce->pkt_rate_low) { |
1252 | nesadapter->et_pkt_rate_low = et_coalesce->pkt_rate_low; | 1260 | nesadapter->et_pkt_rate_low = et_coalesce->pkt_rate_low; |
1253 | } | 1261 | } |
1254 | } else { | 1262 | } else { |
1255 | nesadapter->et_use_adaptive_rx_coalesce = 0; | 1263 | nesadapter->et_use_adaptive_rx_coalesce = 0; |
1256 | nesadapter->timer_int_limit = NES_TIMER_INT_LIMIT; | 1264 | nesadapter->timer_int_limit = NES_TIMER_INT_LIMIT; |
1257 | if (nesadapter->et_rx_coalesce_usecs_irq) { | 1265 | if (nesadapter->et_rx_coalesce_usecs_irq) { |
1258 | nes_write32(nesdev->regs+NES_PERIODIC_CONTROL, | 1266 | nes_write32(nesdev->regs+NES_PERIODIC_CONTROL, |
1259 | 0x80000000 | ((u32)(nesadapter->et_rx_coalesce_usecs_irq*8))); | 1267 | 0x80000000 | ((u32)(nesadapter->et_rx_coalesce_usecs_irq*8))); |
@@ -1270,28 +1278,28 @@ static int nes_netdev_get_coalesce(struct net_device *netdev, | |||
1270 | struct ethtool_coalesce *et_coalesce) | 1278 | struct ethtool_coalesce *et_coalesce) |
1271 | { | 1279 | { |
1272 | struct nes_vnic *nesvnic = netdev_priv(netdev); | 1280 | struct nes_vnic *nesvnic = netdev_priv(netdev); |
1273 | struct nes_device *nesdev = nesvnic->nesdev; | 1281 | struct nes_device *nesdev = nesvnic->nesdev; |
1274 | struct nes_adapter *nesadapter = nesdev->nesadapter; | 1282 | struct nes_adapter *nesadapter = nesdev->nesadapter; |
1275 | struct ethtool_coalesce temp_et_coalesce; | 1283 | struct ethtool_coalesce temp_et_coalesce; |
1276 | struct nes_hw_tune_timer *shared_timer = &nesadapter->tune_timer; | 1284 | struct nes_hw_tune_timer *shared_timer = &nesadapter->tune_timer; |
1277 | unsigned long flags; | 1285 | unsigned long flags; |
1278 | 1286 | ||
1279 | memset(&temp_et_coalesce, 0, sizeof(temp_et_coalesce)); | 1287 | memset(&temp_et_coalesce, 0, sizeof(temp_et_coalesce)); |
1280 | temp_et_coalesce.rx_coalesce_usecs_irq = nesadapter->et_rx_coalesce_usecs_irq; | 1288 | temp_et_coalesce.rx_coalesce_usecs_irq = nesadapter->et_rx_coalesce_usecs_irq; |
1281 | temp_et_coalesce.use_adaptive_rx_coalesce = nesadapter->et_use_adaptive_rx_coalesce; | 1289 | temp_et_coalesce.use_adaptive_rx_coalesce = nesadapter->et_use_adaptive_rx_coalesce; |
1282 | temp_et_coalesce.rate_sample_interval = nesadapter->et_rate_sample_interval; | 1290 | temp_et_coalesce.rate_sample_interval = nesadapter->et_rate_sample_interval; |
1283 | temp_et_coalesce.pkt_rate_low = nesadapter->et_pkt_rate_low; | 1291 | temp_et_coalesce.pkt_rate_low = nesadapter->et_pkt_rate_low; |
1284 | spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags); | 1292 | spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags); |
1285 | temp_et_coalesce.rx_max_coalesced_frames_low = shared_timer->threshold_low; | 1293 | temp_et_coalesce.rx_max_coalesced_frames_low = shared_timer->threshold_low; |
1286 | temp_et_coalesce.rx_max_coalesced_frames_irq = shared_timer->threshold_target; | 1294 | temp_et_coalesce.rx_max_coalesced_frames_irq = shared_timer->threshold_target; |
1287 | temp_et_coalesce.rx_max_coalesced_frames_high = shared_timer->threshold_high; | 1295 | temp_et_coalesce.rx_max_coalesced_frames_high = shared_timer->threshold_high; |
1288 | temp_et_coalesce.rx_coalesce_usecs_low = shared_timer->timer_in_use_min; | 1296 | temp_et_coalesce.rx_coalesce_usecs_low = shared_timer->timer_in_use_min; |
1289 | temp_et_coalesce.rx_coalesce_usecs_high = shared_timer->timer_in_use_max; | 1297 | temp_et_coalesce.rx_coalesce_usecs_high = shared_timer->timer_in_use_max; |
1290 | if (nesadapter->et_use_adaptive_rx_coalesce) { | 1298 | if (nesadapter->et_use_adaptive_rx_coalesce) { |
1291 | temp_et_coalesce.rx_coalesce_usecs_irq = shared_timer->timer_in_use; | 1299 | temp_et_coalesce.rx_coalesce_usecs_irq = shared_timer->timer_in_use; |
1292 | } | 1300 | } |
1293 | spin_unlock_irqrestore(&nesadapter->periodic_timer_lock, flags); | 1301 | spin_unlock_irqrestore(&nesadapter->periodic_timer_lock, flags); |
1294 | memcpy(et_coalesce, &temp_et_coalesce, sizeof(*et_coalesce)); | 1302 | memcpy(et_coalesce, &temp_et_coalesce, sizeof(*et_coalesce)); |
1295 | return 0; | 1303 | return 0; |
1296 | } | 1304 | } |
1297 | 1305 | ||
@@ -1370,30 +1378,38 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd | |||
1370 | u16 phy_data; | 1378 | u16 phy_data; |
1371 | 1379 | ||
1372 | et_cmd->duplex = DUPLEX_FULL; | 1380 | et_cmd->duplex = DUPLEX_FULL; |
1373 | et_cmd->port = PORT_MII; | 1381 | et_cmd->port = PORT_MII; |
1382 | |||
1374 | if (nesadapter->OneG_Mode) { | 1383 | if (nesadapter->OneG_Mode) { |
1375 | et_cmd->supported = SUPPORTED_1000baseT_Full|SUPPORTED_Autoneg; | ||
1376 | et_cmd->advertising = ADVERTISED_1000baseT_Full|ADVERTISED_Autoneg; | ||
1377 | et_cmd->speed = SPEED_1000; | 1384 | et_cmd->speed = SPEED_1000; |
1378 | nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], | 1385 | if (nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_PUMA_1G) { |
1379 | &phy_data); | 1386 | et_cmd->supported = SUPPORTED_1000baseT_Full; |
1380 | if (phy_data&0x1000) { | 1387 | et_cmd->advertising = ADVERTISED_1000baseT_Full; |
1381 | et_cmd->autoneg = AUTONEG_ENABLE; | 1388 | et_cmd->autoneg = AUTONEG_DISABLE; |
1389 | et_cmd->transceiver = XCVR_INTERNAL; | ||
1390 | et_cmd->phy_address = nesdev->mac_index; | ||
1382 | } else { | 1391 | } else { |
1383 | et_cmd->autoneg = AUTONEG_DISABLE; | 1392 | et_cmd->supported = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg; |
1393 | et_cmd->advertising = ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg; | ||
1394 | nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], &phy_data); | ||
1395 | if (phy_data & 0x1000) | ||
1396 | et_cmd->autoneg = AUTONEG_ENABLE; | ||
1397 | else | ||
1398 | et_cmd->autoneg = AUTONEG_DISABLE; | ||
1399 | et_cmd->transceiver = XCVR_EXTERNAL; | ||
1400 | et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index]; | ||
1384 | } | 1401 | } |
1385 | et_cmd->transceiver = XCVR_EXTERNAL; | ||
1386 | et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index]; | ||
1387 | } else { | 1402 | } else { |
1388 | if (nesadapter->phy_type[nesvnic->logical_port] == NES_PHY_TYPE_IRIS) { | 1403 | if ((nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_IRIS) || |
1404 | (nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_ARGUS)) { | ||
1389 | et_cmd->transceiver = XCVR_EXTERNAL; | 1405 | et_cmd->transceiver = XCVR_EXTERNAL; |
1390 | et_cmd->port = PORT_FIBRE; | 1406 | et_cmd->port = PORT_FIBRE; |
1391 | et_cmd->supported = SUPPORTED_FIBRE; | 1407 | et_cmd->supported = SUPPORTED_FIBRE; |
1392 | et_cmd->advertising = ADVERTISED_FIBRE; | 1408 | et_cmd->advertising = ADVERTISED_FIBRE; |
1393 | et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index]; | 1409 | et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index]; |
1394 | } else { | 1410 | } else { |
1395 | et_cmd->transceiver = XCVR_INTERNAL; | 1411 | et_cmd->transceiver = XCVR_INTERNAL; |
1396 | et_cmd->supported = SUPPORTED_10000baseT_Full; | 1412 | et_cmd->supported = SUPPORTED_10000baseT_Full; |
1397 | et_cmd->advertising = ADVERTISED_10000baseT_Full; | 1413 | et_cmd->advertising = ADVERTISED_10000baseT_Full; |
1398 | et_cmd->phy_address = nesdev->mac_index; | 1414 | et_cmd->phy_address = nesdev->mac_index; |
1399 | } | 1415 | } |
@@ -1416,14 +1432,15 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd | |||
1416 | struct nes_adapter *nesadapter = nesdev->nesadapter; | 1432 | struct nes_adapter *nesadapter = nesdev->nesadapter; |
1417 | u16 phy_data; | 1433 | u16 phy_data; |
1418 | 1434 | ||
1419 | if (nesadapter->OneG_Mode) { | 1435 | if ((nesadapter->OneG_Mode) && |
1436 | (nesadapter->phy_type[nesdev->mac_index] != NES_PHY_TYPE_PUMA_1G)) { | ||
1420 | nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], | 1437 | nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], |
1421 | &phy_data); | 1438 | &phy_data); |
1422 | if (et_cmd->autoneg) { | 1439 | if (et_cmd->autoneg) { |
1423 | /* Turn on Full duplex, Autoneg, and restart autonegotiation */ | 1440 | /* Turn on Full duplex, Autoneg, and restart autonegotiation */ |
1424 | phy_data |= 0x1300; | 1441 | phy_data |= 0x1300; |
1425 | } else { | 1442 | } else { |
1426 | // Turn off autoneg | 1443 | /* Turn off autoneg */ |
1427 | phy_data &= ~0x1000; | 1444 | phy_data &= ~0x1000; |
1428 | } | 1445 | } |
1429 | nes_write_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], | 1446 | nes_write_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], |
@@ -1454,6 +1471,8 @@ static struct ethtool_ops nes_ethtool_ops = { | |||
1454 | .set_sg = ethtool_op_set_sg, | 1471 | .set_sg = ethtool_op_set_sg, |
1455 | .get_tso = ethtool_op_get_tso, | 1472 | .get_tso = ethtool_op_get_tso, |
1456 | .set_tso = ethtool_op_set_tso, | 1473 | .set_tso = ethtool_op_set_tso, |
1474 | .get_flags = ethtool_op_get_flags, | ||
1475 | .set_flags = ethtool_op_set_flags, | ||
1457 | }; | 1476 | }; |
1458 | 1477 | ||
1459 | 1478 | ||
@@ -1607,27 +1626,34 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, | |||
1607 | list_add_tail(&nesvnic->list, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]); | 1626 | list_add_tail(&nesvnic->list, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]); |
1608 | 1627 | ||
1609 | if ((nesdev->netdev_count == 0) && | 1628 | if ((nesdev->netdev_count == 0) && |
1610 | (PCI_FUNC(nesdev->pcidev->devfn) == nesdev->mac_index)) { | 1629 | ((PCI_FUNC(nesdev->pcidev->devfn) == nesdev->mac_index) || |
1611 | nes_debug(NES_DBG_INIT, "Setting up PHY interrupt mask. Using register index 0x%04X\n", | 1630 | ((nesdev->nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_PUMA_1G) && |
1612 | NES_IDX_PHY_PCS_CONTROL_STATUS0+(0x200*(nesvnic->logical_port&1))); | 1631 | (((PCI_FUNC(nesdev->pcidev->devfn) == 1) && (nesdev->mac_index == 2)) || |
1632 | ((PCI_FUNC(nesdev->pcidev->devfn) == 2) && (nesdev->mac_index == 1)))))) { | ||
1633 | /* | ||
1634 | * nes_debug(NES_DBG_INIT, "Setting up PHY interrupt mask. Using register index 0x%04X\n", | ||
1635 | * NES_IDX_PHY_PCS_CONTROL_STATUS0 + (0x200 * (nesvnic->logical_port & 1))); | ||
1636 | */ | ||
1613 | u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + | 1637 | u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + |
1614 | (0x200*(nesvnic->logical_port&1))); | 1638 | (0x200 * (nesdev->mac_index & 1))); |
1615 | u32temp |= 0x00200000; | 1639 | if (nesdev->nesadapter->phy_type[nesdev->mac_index] != NES_PHY_TYPE_PUMA_1G) { |
1616 | nes_write_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + | 1640 | u32temp |= 0x00200000; |
1617 | (0x200*(nesvnic->logical_port&1)), u32temp); | 1641 | nes_write_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + |
1642 | (0x200 * (nesdev->mac_index & 1)), u32temp); | ||
1643 | } | ||
1644 | |||
1618 | u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + | 1645 | u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + |
1619 | (0x200*(nesvnic->logical_port&1)) ); | 1646 | (0x200 * (nesdev->mac_index & 1))); |
1647 | |||
1620 | if ((u32temp&0x0f1f0000) == 0x0f0f0000) { | 1648 | if ((u32temp&0x0f1f0000) == 0x0f0f0000) { |
1621 | if (nesdev->nesadapter->phy_type[nesvnic->logical_port] == NES_PHY_TYPE_IRIS) { | 1649 | if (nesdev->nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_IRIS) { |
1622 | nes_init_phy(nesdev); | 1650 | nes_init_phy(nesdev); |
1623 | nes_read_10G_phy_reg(nesdev, 1, | 1651 | nes_read_10G_phy_reg(nesdev, nesdev->nesadapter->phy_index[nesdev->mac_index], 1, 1); |
1624 | nesdev->nesadapter->phy_index[nesvnic->logical_port]); | ||
1625 | temp_phy_data = (u16)nes_read_indexed(nesdev, | 1652 | temp_phy_data = (u16)nes_read_indexed(nesdev, |
1626 | NES_IDX_MAC_MDIO_CONTROL); | 1653 | NES_IDX_MAC_MDIO_CONTROL); |
1627 | u32temp = 20; | 1654 | u32temp = 20; |
1628 | do { | 1655 | do { |
1629 | nes_read_10G_phy_reg(nesdev, 1, | 1656 | nes_read_10G_phy_reg(nesdev, nesdev->nesadapter->phy_index[nesdev->mac_index], 1, 1); |
1630 | nesdev->nesadapter->phy_index[nesvnic->logical_port]); | ||
1631 | phy_data = (u16)nes_read_indexed(nesdev, | 1657 | phy_data = (u16)nes_read_indexed(nesdev, |
1632 | NES_IDX_MAC_MDIO_CONTROL); | 1658 | NES_IDX_MAC_MDIO_CONTROL); |
1633 | if ((phy_data == temp_phy_data) || (!(--u32temp))) | 1659 | if ((phy_data == temp_phy_data) || (!(--u32temp))) |
@@ -1644,6 +1670,14 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, | |||
1644 | nes_debug(NES_DBG_INIT, "The Link is UP!!.\n"); | 1670 | nes_debug(NES_DBG_INIT, "The Link is UP!!.\n"); |
1645 | nesvnic->linkup = 1; | 1671 | nesvnic->linkup = 1; |
1646 | } | 1672 | } |
1673 | } else if (nesdev->nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_PUMA_1G) { | ||
1674 | nes_debug(NES_DBG_INIT, "mac_index=%d, logical_port=%d, u32temp=0x%04X, PCI_FUNC=%d\n", | ||
1675 | nesdev->mac_index, nesvnic->logical_port, u32temp, PCI_FUNC(nesdev->pcidev->devfn)); | ||
1676 | if (((nesdev->mac_index < 2) && ((u32temp&0x01010000) == 0x01010000)) || | ||
1677 | ((nesdev->mac_index > 1) && ((u32temp&0x02020000) == 0x02020000))) { | ||
1678 | nes_debug(NES_DBG_INIT, "The Link is UP!!.\n"); | ||
1679 | nesvnic->linkup = 1; | ||
1680 | } | ||
1647 | } | 1681 | } |
1648 | /* clear the MAC interrupt status, assumes direct logical to physical mapping */ | 1682 | /* clear the MAC interrupt status, assumes direct logical to physical mapping */ |
1649 | u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index)); | 1683 | u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index)); |