34 #include <linux/module.h>
36 #include <linux/netdevice.h>
39 #include <linux/tcp.h>
40 #include <linux/if_arp.h>
41 #include <linux/if_vlan.h>
42 #include <linux/ethtool.h>
43 #include <linux/slab.h>
51 static struct nic_qp_map nic_qp_mapping_0[] = {
52 {16,0,0,1},{24,4,0,0},{28,8,0,0},{32,12,0,0},
53 {20,2,2,1},{26,6,2,0},{30,10,2,0},{34,14,2,0},
54 {18,1,1,1},{25,5,1,0},{29,9,1,0},{33,13,1,0},
55 {22,3,3,1},{27,7,3,0},{31,11,3,0},{35,15,3,0}
58 static struct nic_qp_map nic_qp_mapping_1[] = {
59 {18,1,1,1},{25,5,1,0},{29,9,1,0},{33,13,1,0},
60 {22,3,3,1},{27,7,3,0},{31,11,3,0},{35,15,3,0}
63 static struct nic_qp_map nic_qp_mapping_2[] = {
64 {20,2,2,1},{26,6,2,0},{30,10,2,0},{34,14,2,0}
67 static struct nic_qp_map nic_qp_mapping_3[] = {
68 {22,3,3,1},{27,7,3,0},{31,11,3,0},{35,15,3,0}
71 static struct nic_qp_map nic_qp_mapping_4[] = {
72 {28,8,0,0},{32,12,0,0}
75 static struct nic_qp_map nic_qp_mapping_5[] = {
76 {29,9,1,0},{33,13,1,0}
79 static struct nic_qp_map nic_qp_mapping_6[] = {
80 {30,10,2,0},{34,14,2,0}
83 static struct nic_qp_map nic_qp_mapping_7[] = {
84 {31,11,3,0},{35,15,3,0}
87 static struct nic_qp_map *nic_qp_mapping_per_function[] = {
88 nic_qp_mapping_0, nic_qp_mapping_1, nic_qp_mapping_2, nic_qp_mapping_3,
89 nic_qp_mapping_4, nic_qp_mapping_5, nic_qp_mapping_6, nic_qp_mapping_7
94 static int debug = -1;
95 static int nics_per_function = 1;
135 static int nes_netdev_open(
struct net_device *netdev)
139 struct nes_vnic *nesvnic = netdev_priv(netdev);
163 netif_stop_queue(netdev);
170 nesvnic->
nesibdev->nesvnic = nesvnic;
179 nic_active_bit = 1 << nesvnic->
nic_index;
181 nic_active |= nic_active_bit;
184 nic_active |= nic_active_bit;
187 nic_active |= nic_active_bit;
204 " (Addr:%08X) = %08X, HIGH = %08X.\n",
211 nes_write_indexed(nesdev,
214 nes_write_indexed(nesdev,
222 nesvnic->
nic_cq.cq_number);
234 first_nesvnic = nesvnic;
237 if (first_nesvnic->
linkup) {
240 netif_start_queue(netdev);
250 spin_unlock_irqrestore(&nesdev->
nesadapter->phy_lock, flags);
255 if (nesvnic->
linkup == 1) {
266 napi_enable(&nesvnic->
napi);
276 static int nes_netdev_stop(
struct net_device *netdev)
278 struct nes_vnic *nesvnic = netdev_priv(netdev);
287 nesvnic, nesdev, netdev, netdev->
name);
296 napi_disable(&nesvnic->
napi);
297 netif_stop_queue(netdev);
300 if ((first_nesvnic->
netdev_open == 1) && (first_nesvnic != nesvnic))
304 if ((first_nesvnic->
netdev_open == 1) && (first_nesvnic != nesvnic) &&
309 nes_write_indexed(first_nesvnic->
nesdev,
311 (0x200*first_nesvnic->
nesdev->mac_index),
322 nic_active &= nic_active_mask;
325 nic_active &= nic_active_mask;
328 nic_active &= nic_active_mask;
331 nic_active &= nic_active_mask;
334 nic_active &= nic_active_mask;
361 struct nes_vnic *nesvnic = netdev_priv(netdev);
366 __le16 *wqe_fragment_length;
368 u16 wqe_fragment_index = 1;
369 u16 skb_fragment_index;
385 wqe_fragment_length++;
390 if (skb_is_gso(skb)) {
397 (((
u32)(((
unsigned char *)tcph) - skb->
data)) << 4));
407 wqe_fragment_length[0] =
cpu_to_le16(
min(((
unsigned int)NES_FIRST_FRAG_SIZE),
409 wqe_fragment_length[1] = 0;
410 if (skb_headlen(skb) > NES_FIRST_FRAG_SIZE) {
411 if ((skb_shinfo(skb)->nr_frags + 1) > 4) {
413 netdev->
name, skb_shinfo(skb)->nr_frags + 2, skb_headlen(skb));
419 bus_address = pci_map_single(nesdev->
pcidev, skb->
data + NES_FIRST_FRAG_SIZE,
421 wqe_fragment_length[wqe_fragment_index++] =
422 cpu_to_le16(skb_headlen(skb) - NES_FIRST_FRAG_SIZE);
423 wqe_fragment_length[wqe_fragment_index] = 0;
425 ((
u64)(bus_address)));
429 if (skb_headlen(skb) == skb->
len) {
430 if (skb_headlen(skb) <= NES_FIRST_FRAG_SIZE) {
437 for (skb_fragment_index = 0; skb_fragment_index < skb_shinfo(skb)->nr_frags;
438 skb_fragment_index++) {
440 &skb_shinfo(skb)->frags[skb_fragment_index];
441 bus_address = skb_frag_dma_map(&nesdev->
pcidev->dev,
442 frag, 0, skb_frag_size(frag),
444 wqe_fragment_length[wqe_fragment_index] =
445 cpu_to_le16(skb_frag_size(&skb_shinfo(skb)->frags[skb_fragment_index]));
448 wqe_fragment_index++;
449 if (wqe_fragment_index < 5)
450 wqe_fragment_length[wqe_fragment_index] = 0;
467 struct nes_vnic *nesvnic = netdev_priv(netdev);
473 #define NES_MAX_TSO_FRAGS MAX_SKB_FRAGS
484 __le16 *wqe_fragment_length;
486 u32 original_first_length;
489 u16 wqe_fragment_index=1;
503 if (!netif_carrier_ok(netdev))
506 if (netif_queue_stopped(netdev))
511 if (!netif_queue_stopped(netdev)) {
512 netif_stop_queue(netdev);
515 netif_start_queue(netdev);
516 goto sq_no_longer_full;
524 nr_frags = skb_shinfo(skb)->nr_frags;
525 if (skb_headlen(skb) > NES_FIRST_FRAG_SIZE) {
530 if (skb_is_gso(skb)) {
534 wqes_needed = nr_frags >> 2;
535 wqes_needed += (nr_frags&3)?1:0;
539 if (
unlikely(wqes_needed > wqes_available)) {
540 if (!netif_queue_stopped(netdev)) {
541 netif_stop_queue(netdev);
545 if (wqes_needed <= wqes_available) {
546 netif_start_queue(netdev);
547 goto tso_sq_no_longer_full;
555 tso_sq_no_longer_full:
557 for (tso_frag_count=0; tso_frag_count < skb_shinfo(skb)->nr_frags;
560 &skb_shinfo(skb)->frags[tso_frag_count];
561 tso_bus_address[tso_frag_count] =
562 skb_frag_dma_map(&nesdev->
pcidev->dev,
563 frag, 0, skb_frag_size(frag),
568 curr_tcp_seq =
ntohl(tcp_hdr(skb)->seq);
569 hoffset = skb_transport_header(skb) - skb->
data;
570 nhoffset = skb_network_header(skb) - skb->
data;
571 original_first_length = hoffset + ((((
struct tcphdr *)skb_transport_header(skb))->doff)<<2);
573 for (wqe_count=0; wqe_count<((
u32)wqes_needed); wqe_count++) {
576 wqe_fragment_length =
588 wqe_fragment_length++;
591 if (original_first_length > NES_FIRST_FRAG_SIZE) {
593 original_first_length, NES_FIRST_FRAG_SIZE);
595 " (%u frags), is_gso = %u tso_size=%u\n",
597 skb->
len, skb_headlen(skb),
598 skb_shinfo(skb)->nr_frags, skb_is_gso(skb), skb_shinfo(skb)->gso_size);
601 skb->
data,
min(((
unsigned int)NES_FIRST_FRAG_SIZE),
602 original_first_length));
603 iph = (
struct iphdr *)
607 if ((wqe_count+1)!=(
u32)wqes_needed) {
617 wqe_fragment_length[0] =
cpu_to_le16(
min(((
unsigned int)NES_FIRST_FRAG_SIZE),
618 original_first_length));
620 wqe_fragment_index = 1;
621 if ((wqe_count==0) && (skb_headlen(skb) > original_first_length)) {
623 bus_address = pci_map_single(nesdev->
pcidev, skb->
data + original_first_length,
625 wqe_fragment_length[wqe_fragment_index++] =
626 cpu_to_le16(skb_headlen(skb) - original_first_length);
627 wqe_fragment_length[wqe_fragment_index] = 0;
630 tso_wqe_length += skb_headlen(skb) -
631 original_first_length;
633 while (wqe_fragment_index < 5) {
634 wqe_fragment_length[wqe_fragment_index] =
635 cpu_to_le16(skb_frag_size(&skb_shinfo(skb)->frags[tso_frag_index]));
637 (
u64)tso_bus_address[tso_frag_index]);
638 wqe_fragment_index++;
639 tso_wqe_length += skb_frag_size(&skb_shinfo(skb)->frags[tso_frag_index++]);
640 if (wqe_fragment_index < 5)
641 wqe_fragment_length[wqe_fragment_index] = 0;
642 if (tso_frag_index == tso_frag_count)
645 if ((wqe_count+1) == (
u32)wqes_needed) {
651 if ((tso_wqe_length + original_first_length) > skb_shinfo(skb)->gso_size) {
654 iph->
tot_len =
htons(tso_wqe_length + original_first_length - nhoffset);
660 ((
u32)tcph->doff) | (((
u32)hoffset) << 4));
663 tso_wqe_length + original_first_length);
664 curr_tcp_seq += tso_wqe_length;
670 hoffset = skb_transport_header(skb) - skb->
data;
671 nhoffset = skb_network_header(skb) - skb->
data;
673 skb_set_transport_header(skb, hoffset);
674 skb_set_network_header(skb, nhoffset);
675 send_rc = nes_nic_send(skb, netdev);
680 send_rc = nes_nic_send(skb, netdev);
689 (wqe_count << 24) | (1 << 23) | nesvnic->
nic.qp_id);
702 struct nes_vnic *nesvnic = netdev_priv(netdev);
707 u32temp = nes_read_indexed(nesdev,
709 nesvnic->
netstats.rx_dropped += u32temp;
712 u64temp = (
u64)nes_read_indexed(nesdev,
714 u64temp += ((
u64)nes_read_indexed(nesdev,
718 nesvnic->
netstats.rx_bytes += u64temp;
720 u64temp = (
u64)nes_read_indexed(nesdev,
722 u64temp += ((
u64)nes_read_indexed(nesdev,
726 nesvnic->
netstats.rx_packets += u64temp;
728 u64temp = (
u64)nes_read_indexed(nesdev,
730 u64temp += ((
u64)nes_read_indexed(nesdev,
734 nesvnic->
netstats.tx_bytes += u64temp;
736 u64temp = (
u64)nes_read_indexed(nesdev,
738 u64temp += ((
u64)nes_read_indexed(nesdev,
742 nesvnic->
netstats.tx_packets += u64temp;
744 u32temp = nes_read_indexed(nesdev,
746 nesvnic->
netstats.rx_dropped += u32temp;
747 nesvnic->
nesdev->mac_rx_errors += u32temp;
748 nesvnic->
nesdev->mac_rx_short_frames += u32temp;
750 u32temp = nes_read_indexed(nesdev,
752 nesvnic->
netstats.rx_dropped += u32temp;
753 nesvnic->
nesdev->mac_rx_errors += u32temp;
754 nesvnic->
nesdev->mac_rx_oversized_frames += u32temp;
756 u32temp = nes_read_indexed(nesdev,
758 nesvnic->
netstats.rx_dropped += u32temp;
759 nesvnic->
nesdev->mac_rx_errors += u32temp;
760 nesvnic->
nesdev->mac_rx_jabber_frames += u32temp;
762 u32temp = nes_read_indexed(nesdev,
764 nesvnic->
netstats.rx_dropped += u32temp;
765 nesvnic->
nesdev->mac_rx_errors += u32temp;
766 nesvnic->
nesdev->mac_rx_symbol_err_frames += u32temp;
768 u32temp = nes_read_indexed(nesdev,
770 nesvnic->
netstats.rx_length_errors += u32temp;
771 nesvnic->
nesdev->mac_rx_errors += u32temp;
773 u32temp = nes_read_indexed(nesdev,
775 nesvnic->
nesdev->mac_rx_errors += u32temp;
776 nesvnic->
nesdev->mac_rx_crc_errors += u32temp;
777 nesvnic->
netstats.rx_crc_errors += u32temp;
779 u32temp = nes_read_indexed(nesdev,
781 nesvnic->
nesdev->mac_tx_errors += u32temp;
782 nesvnic->
netstats.tx_errors += u32temp;
791 static void nes_netdev_tx_timeout(
struct net_device *netdev)
793 struct nes_vnic *nesvnic = netdev_priv(netdev);
803 static int nes_netdev_set_mac_address(
struct net_device *netdev,
void *
p)
805 struct nes_vnic *nesvnic = netdev_priv(netdev);
812 if (!is_valid_ether_addr(mac_addr->
sa_data))
816 printk(
PFX "%s: Address length = %d, Address = %pM\n",
829 nes_write_indexed(nesdev,
832 nes_write_indexed(nesdev,
841 static void set_allmulti(
struct nes_device *nesdev,
u32 nic_active_bit)
846 nic_active |= nic_active_bit;
849 nic_active &= ~nic_active_bit;
853 #define get_addr(addrs, index) ((addrs) + (index) * ETH_ALEN)
858 static void nes_netdev_set_multicast_list(
struct net_device *netdev)
860 struct nes_vnic *nesvnic = netdev_priv(netdev);
865 u32 perfect_filter_register_address;
870 int mc_nic_index = -1;
872 nics_per_function, 4);
873 u8 max_pft_entries_avaiable =
NES_PFT_SIZE - pft_entries_preallocated;
878 nic_active_bit = 1 << nesvnic->
nic_index;
882 nic_active |= nic_active_bit;
885 nic_active |= nic_active_bit;
890 set_allmulti(nesdev, nic_active_bit);
894 nic_active &= ~nic_active_bit;
897 nic_active &= ~nic_active_bit;
911 set_allmulti(nesdev, nic_active_bit);
919 pft_entries_preallocated * 0x8;
920 for (i = 0, mc_index = 0; mc_index < max_pft_entries_avaiable;
922 while (i < mc_count && nesvnic->mcrq_mcast_filter &&
925 if (mc_nic_index < 0)
930 mc_index < max_pft_entries_avaiable) {
932 "mc_index=%d skipping nic_index=%d, "
933 "used for=%d \n", mc_index,
938 if (mc_index >= max_pft_entries_avaiable)
945 perfect_filter_register_address+(mc_index * 8),
947 macaddr_high = ((
u16) addr[0]) << 8;
948 macaddr_high += (
u16) addr[1];
949 macaddr_low = ((
u32) addr[2]) << 24;
950 macaddr_low += ((
u32) addr[3]) << 16;
951 macaddr_low += ((
u32) addr[4]) << 8;
952 macaddr_low += (
u32) addr[5];
953 nes_write_indexed(nesdev,
954 perfect_filter_register_address+(mc_index * 8),
956 nes_write_indexed(nesdev,
957 perfect_filter_register_address+4+(mc_index * 8),
959 ((((
u32)(1<<mc_nic_index)) << 16)));
964 perfect_filter_register_address+(mc_index * 8));
965 nes_write_indexed(nesdev,
966 perfect_filter_register_address+4+(mc_index * 8),
974 set_allmulti(nesdev, nic_active_bit);
985 static int nes_netdev_change_mtu(
struct net_device *netdev,
int new_mtu)
987 struct nes_vnic *nesvnic = netdev_priv(netdev);
999 netdev->
mtu = new_mtu;
1002 if (netdev->
mtu > 1500) {
1007 if (netif_running(netdev)) {
1008 nic_active_bit = 1 << nesvnic->
nic_index;
1009 mc_all_active = nes_read_indexed(nesdev,
1011 uc_all_active = nes_read_indexed(nesdev,
1014 nes_netdev_stop(netdev);
1015 nes_netdev_open(netdev);
1017 nic_active = nes_read_indexed(nesdev,
1019 nic_active |= mc_all_active;
1024 nic_active |= uc_all_active;
1033 "Link Change Interrupts",
1036 "Pause Frames Sent",
1037 "Pause Frames Received",
1038 "Internal Routing Errors",
1039 "SQ SW Dropped SKBs",
1041 "Segmented TSO Requests",
1044 "Rx Oversized Frames",
1049 "Endnode Rx Discards",
1050 "Endnode Rx Octets",
1051 "Endnode Rx Frames",
1052 "Endnode Tx Octets",
1053 "Endnode Tx Frames",
1057 "Retransmission Count",
1064 "ModifyQP Timeouts",
1070 "CM Packets Bounced",
1071 "CM Packets Created",
1073 "CM Packets Dropped",
1074 "CM Packets Retrans",
1075 "CM Listens Created",
1076 "CM Listens Destroyed",
1080 "CM Nodes Destroyed",
1082 "CM Resets Received",
1092 #define NES_ETHTOOL_STAT_COUNT ARRAY_SIZE(nes_ethtool_stringset)
1098 static int nes_netdev_get_sset_count(
struct net_device *netdev,
int stringset)
1110 static void nes_netdev_get_strings(
struct net_device *netdev,
u32 stringset,
1111 u8 *ethtool_strings)
1115 &nes_ethtool_stringset,
1116 sizeof(nes_ethtool_stringset));
1124 static void nes_netdev_get_ethtool_stats(
struct net_device *netdev,
1128 struct nes_vnic *nesvnic = netdev_priv(netdev);
1136 target_stat_values[
index] = nesvnic->
nesdev->link_status_interrupts;
1140 u32temp = nes_read_indexed(nesdev,
1142 nesvnic->
nesdev->mac_pause_frames_sent += u32temp;
1143 target_stat_values[++
index] = nesvnic->
nesdev->mac_pause_frames_sent;
1145 u32temp = nes_read_indexed(nesdev,
1147 nesvnic->
nesdev->mac_pause_frames_received += u32temp;
1149 u32temp = nes_read_indexed(nesdev,
1151 nesvnic->
nesdev->port_rx_discards += u32temp;
1152 nesvnic->
netstats.rx_dropped += u32temp;
1154 u32temp = nes_read_indexed(nesdev,
1156 nesvnic->
nesdev->port_tx_discards += u32temp;
1157 nesvnic->
netstats.tx_dropped += u32temp;
1159 u32temp = nes_read_indexed(nesdev,
1161 nesvnic->
netstats.rx_dropped += u32temp;
1162 nesvnic->
nesdev->mac_rx_errors += u32temp;
1163 nesvnic->
nesdev->mac_rx_short_frames += u32temp;
1165 u32temp = nes_read_indexed(nesdev,
1167 nesvnic->
netstats.rx_dropped += u32temp;
1168 nesvnic->
nesdev->mac_rx_errors += u32temp;
1169 nesvnic->
nesdev->mac_rx_oversized_frames += u32temp;
1171 u32temp = nes_read_indexed(nesdev,
1173 nesvnic->
netstats.rx_dropped += u32temp;
1174 nesvnic->
nesdev->mac_rx_errors += u32temp;
1175 nesvnic->
nesdev->mac_rx_jabber_frames += u32temp;
1177 u32temp = nes_read_indexed(nesdev,
1179 nesvnic->
netstats.rx_dropped += u32temp;
1180 nesvnic->
nesdev->mac_rx_errors += u32temp;
1181 nesvnic->
nesdev->mac_rx_symbol_err_frames += u32temp;
1183 u32temp = nes_read_indexed(nesdev,
1185 nesvnic->
netstats.rx_length_errors += u32temp;
1186 nesvnic->
nesdev->mac_rx_errors += u32temp;
1188 u32temp = nes_read_indexed(nesdev,
1190 nesvnic->
nesdev->mac_rx_errors += u32temp;
1191 nesvnic->
nesdev->mac_rx_crc_errors += u32temp;
1192 nesvnic->
netstats.rx_crc_errors += u32temp;
1194 u32temp = nes_read_indexed(nesdev,
1196 nesvnic->
nesdev->mac_tx_errors += u32temp;
1197 nesvnic->
netstats.tx_errors += u32temp;
1203 u32temp = nes_read_indexed(nesdev,
1206 nesvnic->
netstats.rx_dropped += u32temp;
1209 u64temp = (
u64)nes_read_indexed(nesdev,
1212 u64temp += ((
u64)nes_read_indexed(nesdev,
1217 nesvnic->
netstats.rx_bytes += u64temp;
1219 u64temp = (
u64)nes_read_indexed(nesdev,
1222 u64temp += ((
u64)nes_read_indexed(nesdev,
1227 nesvnic->
netstats.rx_packets += u64temp;
1229 u64temp = (
u64)nes_read_indexed(nesdev,
1232 u64temp += ((
u64)nes_read_indexed(nesdev,
1237 nesvnic->
netstats.tx_bytes += u64temp;
1239 u64temp = (
u64)nes_read_indexed(nesdev,
1242 u64temp += ((
u64)nes_read_indexed(nesdev,
1247 nesvnic->
netstats.tx_packets += u64temp;
1249 u32temp = nes_read_indexed(nesdev,
1254 target_stat_values[++
index] = nesvnic->
nesdev->mac_pause_frames_received;
1255 target_stat_values[++
index] = nesdev->
nesadapter->nic_rx_eth_route_err;
1259 target_stat_values[++
index] = nesvnic->
nesdev->mac_rx_symbol_err_frames;
1260 target_stat_values[++
index] = nesvnic->
nesdev->mac_rx_jabber_frames;
1261 target_stat_values[++
index] = nesvnic->
nesdev->mac_rx_oversized_frames;
1262 target_stat_values[++
index] = nesvnic->
nesdev->mac_rx_short_frames;
1263 target_stat_values[++
index] = nesvnic->
netstats.rx_length_errors;
1264 target_stat_values[++
index] = nesvnic->
nesdev->mac_rx_crc_errors;
1265 target_stat_values[++
index] = nesvnic->
nesdev->port_rx_discards;
1271 target_stat_values[++
index] = nesvnic->
nesdev->mac_tx_errors;
1303 target_stat_values[++
index] = nesvnic->
lro_mgr.stats.aggregated;
1304 target_stat_values[++
index] = nesvnic->
lro_mgr.stats.flushed;
1305 target_stat_values[++
index] = nesvnic->
lro_mgr.stats.no_desc;
1313 static void nes_netdev_get_drvinfo(
struct net_device *netdev,
1316 struct nes_vnic *nesvnic = netdev_priv(netdev);
1333 static int nes_netdev_set_coalesce(
struct net_device *netdev,
1336 struct nes_vnic *nesvnic = netdev_priv(netdev);
1340 unsigned long flags;
1384 static int nes_netdev_get_coalesce(
struct net_device *netdev,
1387 struct nes_vnic *nesvnic = netdev_priv(netdev);
1392 unsigned long flags;
1394 memset(&temp_et_coalesce, 0,
sizeof(temp_et_coalesce));
1400 temp_et_coalesce.rx_max_coalesced_frames_low = shared_timer->
threshold_low;
1401 temp_et_coalesce.rx_max_coalesced_frames_irq = shared_timer->
threshold_target;
1402 temp_et_coalesce.rx_max_coalesced_frames_high = shared_timer->
threshold_high;
1406 temp_et_coalesce.rx_coalesce_usecs_irq = shared_timer->
timer_in_use;
1409 memcpy(et_coalesce, &temp_et_coalesce,
sizeof(*et_coalesce));
1417 static void nes_netdev_get_pauseparam(
struct net_device *netdev,
1420 struct nes_vnic *nesvnic = netdev_priv(netdev);
1423 et_pauseparam->
rx_pause = (nesvnic->
nesdev->disable_rx_flow_control == 0) ? 1:0;
1424 et_pauseparam->
tx_pause = (nesvnic->
nesdev->disable_tx_flow_control == 0) ? 1:0;
1431 static int nes_netdev_set_pauseparam(
struct net_device *netdev,
1434 struct nes_vnic *nesvnic = netdev_priv(netdev);
1443 u32temp = nes_read_indexed(nesdev,
1446 nes_write_indexed(nesdev,
1450 u32temp = nes_read_indexed(nesdev,
1453 nes_write_indexed(nesdev,
1458 u32temp = nes_read_indexed(nesdev,
1461 nes_write_indexed(nesdev,
1465 u32temp = nes_read_indexed(nesdev,
1468 nes_write_indexed(nesdev,
1482 struct nes_vnic *nesvnic = netdev_priv(netdev);
1504 unsigned long flags;
1511 spin_unlock_irqrestore(&nesadapter->
phy_lock, flags);
1512 if (phy_data & 0x1000)
1546 struct nes_vnic *nesvnic = netdev_priv(netdev);
1552 unsigned long flags;
1563 phy_data &= ~0x1000;
1566 spin_unlock_irqrestore(&nesadapter->
phy_lock, flags);
1573 static const struct ethtool_ops nes_ethtool_ops = {
1575 .get_settings = nes_netdev_get_settings,
1576 .set_settings = nes_netdev_set_settings,
1577 .get_strings = nes_netdev_get_strings,
1578 .get_sset_count = nes_netdev_get_sset_count,
1579 .get_ethtool_stats = nes_netdev_get_ethtool_stats,
1580 .get_drvinfo = nes_netdev_get_drvinfo,
1581 .get_coalesce = nes_netdev_get_coalesce,
1582 .set_coalesce = nes_netdev_set_coalesce,
1583 .get_pauseparam = nes_netdev_get_pauseparam,
1584 .set_pauseparam = nes_netdev_set_pauseparam,
1591 unsigned long flags;
1600 u32temp &= 0xfdffffff;
1602 u32temp |= 0x02000000;
1605 spin_unlock_irqrestore(&nesadapter->
phy_lock, flags);
1624 struct nes_vnic *nesvnic = netdev_priv(netdev);
1629 nes_vlan_mode(netdev, nesdev, features);
1635 .ndo_open = nes_netdev_open,
1636 .ndo_stop = nes_netdev_stop,
1637 .ndo_start_xmit = nes_netdev_start_xmit,
1638 .ndo_get_stats = nes_netdev_get_stats,
1639 .ndo_tx_timeout = nes_netdev_tx_timeout,
1640 .ndo_set_mac_address = nes_netdev_set_mac_address,
1641 .ndo_set_rx_mode = nes_netdev_set_multicast_list,
1642 .ndo_change_mtu = nes_netdev_change_mtu,
1644 .ndo_fix_features = nes_fix_features,
1645 .ndo_set_features = nes_set_features,
1660 netdev = alloc_etherdev(
sizeof(
struct nes_vnic));
1665 nesvnic = netdev_priv(netdev);
1683 nesvnic->
netdev = netdev;
1684 nesvnic->
nesdev = nesdev;
1690 curr_qp_map = nic_qp_mapping_per_function[
PCI_FUNC(nesdev->
pcidev->devfn)];
1715 " nic_index = %d, logical_port = %d, mac_index = %d.\n",
1716 nesvnic, (
unsigned long)netdev->
features, nesvnic->
nic.qp_id,
1719 if (nesvnic->
nesdev->nesadapter->port_count == 1 &&
1720 nesvnic->
nesdev->nesadapter->adapter_fcn_count == 1) {
1732 if (nesvnic->
nesdev->nesadapter->port_count == 2 ||
1733 (nesvnic->
nesdev->nesadapter->port_count == 1 &&
1734 nesvnic->
nesdev->nesadapter->adapter_fcn_count == 2)) {
1754 nesvnic->
nic_cq.cq_number = nesvnic->
nic.qp_id;
1775 unsigned long flags;
1780 u32temp |= 0x00200000;
1782 (0x200 * (nesdev->
mac_index & 1)), u32temp);
1790 link_mask = 0x01010000;
1791 link_val = 0x01010000;
1793 link_mask = 0x02020000;
1794 link_val = 0x02020000;
1811 spin_unlock_irqrestore(&nesdev->
nesadapter->phy_lock, flags);
1812 phy_data = (!temp_phy_data && (phy_data == 0x8000)) ? 0x4 : 0x0;
1815 link_mask = 0x0f1f0000;
1816 link_val = 0x0f0f0000;
1820 u32temp = nes_read_indexed(nesdev,
1825 if (phy_data & 0x0004)
1828 if ((u32temp & link_mask) == link_val)
1840 nes_vlan_mode(netdev, nesdev, netdev->
features);
1851 struct nes_vnic *nesvnic = netdev_priv(netdev);