aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-09-10 01:27:33 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-10 01:27:33 -0400
commite548833df83c3554229eff0672900bfe958b45fd (patch)
tree85efc4a76dc356593d6d394776aeb845dc580fb6 /drivers/net/benet
parentcbd9da7be869f676afc204e1a664163778c770bd (diff)
parent053d8f6622701f849fda2ca2c9ae596c13599ba9 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: net/mac80211/main.c
Diffstat (limited to 'drivers/net/benet')
-rw-r--r--drivers/net/benet/be.h1
-rw-r--r--drivers/net/benet/be_cmds.c8
-rw-r--r--drivers/net/benet/be_cmds.h2
-rw-r--r--drivers/net/benet/be_ethtool.c1
-rw-r--r--drivers/net/benet/be_hw.h7
-rw-r--r--drivers/net/benet/be_main.c47
6 files changed, 30 insertions, 36 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index d1fb7928ffc5..4faf6961dcec 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -181,6 +181,7 @@ struct be_drvr_stats {
181 u64 be_rx_bytes_prev; 181 u64 be_rx_bytes_prev;
182 u64 be_rx_pkts; 182 u64 be_rx_pkts;
183 u32 be_rx_rate; 183 u32 be_rx_rate;
184 u32 be_rx_mcast_pkt;
184 /* number of non ether type II frames dropped where 185 /* number of non ether type II frames dropped where
185 * frame len > length field of Mac Hdr */ 186 * frame len > length field of Mac Hdr */
186 u32 be_802_3_dropped_frames; 187 u32 be_802_3_dropped_frames;
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 3d305494a606..34abcc9403d6 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -140,10 +140,8 @@ int be_process_mcc(struct be_adapter *adapter, int *status)
140 while ((compl = be_mcc_compl_get(adapter))) { 140 while ((compl = be_mcc_compl_get(adapter))) {
141 if (compl->flags & CQE_FLAGS_ASYNC_MASK) { 141 if (compl->flags & CQE_FLAGS_ASYNC_MASK) {
142 /* Interpret flags as an async trailer */ 142 /* Interpret flags as an async trailer */
143 BUG_ON(!is_link_state_evt(compl->flags)); 143 if (is_link_state_evt(compl->flags))
144 144 be_async_link_state_process(adapter,
145 /* Interpret compl as a async link evt */
146 be_async_link_state_process(adapter,
147 (struct be_async_event_link_state *) compl); 145 (struct be_async_event_link_state *) compl);
148 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { 146 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) {
149 *status = be_mcc_compl_process(adapter, compl); 147 *status = be_mcc_compl_process(adapter, compl);
@@ -207,7 +205,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
207 205
208 if (msecs > 4000) { 206 if (msecs > 4000) {
209 dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); 207 dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
210 be_dump_ue(adapter); 208 be_detect_dump_ue(adapter);
211 return -1; 209 return -1;
212 } 210 }
213 211
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index bdc10a28cfda..ad1e6fac60c5 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -992,5 +992,5 @@ extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
992extern int be_cmd_get_phy_info(struct be_adapter *adapter, 992extern int be_cmd_get_phy_info(struct be_adapter *adapter,
993 struct be_dma_mem *cmd); 993 struct be_dma_mem *cmd);
994extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); 994extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
995extern void be_dump_ue(struct be_adapter *adapter); 995extern void be_detect_dump_ue(struct be_adapter *adapter);
996 996
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 9bedb9ff6e12..d92063420c25 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -60,6 +60,7 @@ static const struct be_ethtool_stat et_stats[] = {
60 {DRVSTAT_INFO(be_rx_events)}, 60 {DRVSTAT_INFO(be_rx_events)},
61 {DRVSTAT_INFO(be_tx_compl)}, 61 {DRVSTAT_INFO(be_tx_compl)},
62 {DRVSTAT_INFO(be_rx_compl)}, 62 {DRVSTAT_INFO(be_rx_compl)},
63 {DRVSTAT_INFO(be_rx_mcast_pkt)},
63 {DRVSTAT_INFO(be_ethrx_post_fail)}, 64 {DRVSTAT_INFO(be_ethrx_post_fail)},
64 {DRVSTAT_INFO(be_802_3_dropped_frames)}, 65 {DRVSTAT_INFO(be_802_3_dropped_frames)},
65 {DRVSTAT_INFO(be_802_3_malformed_frames)}, 66 {DRVSTAT_INFO(be_802_3_malformed_frames)},
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h
index 5d38046402b2..a2ec5df0d733 100644
--- a/drivers/net/benet/be_hw.h
+++ b/drivers/net/benet/be_hw.h
@@ -167,8 +167,11 @@
167#define FLASH_FCoE_BIOS_START_g3 (13631488) 167#define FLASH_FCoE_BIOS_START_g3 (13631488)
168#define FLASH_REDBOOT_START_g3 (262144) 168#define FLASH_REDBOOT_START_g3 (262144)
169 169
170 170/************* Rx Packet Type Encoding **************/
171 171#define BE_UNICAST_PACKET 0
172#define BE_MULTICAST_PACKET 1
173#define BE_BROADCAST_PACKET 2
174#define BE_RSVD_PACKET 3
172 175
173/* 176/*
174 * BE descriptors: host memory data structures whose formats 177 * BE descriptors: host memory data structures whose formats
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index dcee7a20c0b9..43a3a574e2e0 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -247,6 +247,7 @@ void netdev_stats_update(struct be_adapter *adapter)
247 dev_stats->tx_packets = drvr_stats(adapter)->be_tx_pkts; 247 dev_stats->tx_packets = drvr_stats(adapter)->be_tx_pkts;
248 dev_stats->rx_bytes = drvr_stats(adapter)->be_rx_bytes; 248 dev_stats->rx_bytes = drvr_stats(adapter)->be_rx_bytes;
249 dev_stats->tx_bytes = drvr_stats(adapter)->be_tx_bytes; 249 dev_stats->tx_bytes = drvr_stats(adapter)->be_tx_bytes;
250 dev_stats->multicast = drvr_stats(adapter)->be_rx_mcast_pkt;
250 251
251 /* bad pkts received */ 252 /* bad pkts received */
252 dev_stats->rx_errors = port_stats->rx_crc_errors + 253 dev_stats->rx_errors = port_stats->rx_crc_errors +
@@ -294,7 +295,6 @@ void netdev_stats_update(struct be_adapter *adapter)
294 /* no space available in linux */ 295 /* no space available in linux */
295 dev_stats->tx_dropped = 0; 296 dev_stats->tx_dropped = 0;
296 297
297 dev_stats->multicast = port_stats->rx_multicast_frames;
298 dev_stats->collisions = 0; 298 dev_stats->collisions = 0;
299 299
300 /* detailed tx_errors */ 300 /* detailed tx_errors */
@@ -843,7 +843,7 @@ static void be_rx_rate_update(struct be_adapter *adapter)
843} 843}
844 844
845static void be_rx_stats_update(struct be_adapter *adapter, 845static void be_rx_stats_update(struct be_adapter *adapter,
846 u32 pktsize, u16 numfrags) 846 u32 pktsize, u16 numfrags, u8 pkt_type)
847{ 847{
848 struct be_drvr_stats *stats = drvr_stats(adapter); 848 struct be_drvr_stats *stats = drvr_stats(adapter);
849 849
@@ -851,6 +851,9 @@ static void be_rx_stats_update(struct be_adapter *adapter,
851 stats->be_rx_frags += numfrags; 851 stats->be_rx_frags += numfrags;
852 stats->be_rx_bytes += pktsize; 852 stats->be_rx_bytes += pktsize;
853 stats->be_rx_pkts++; 853 stats->be_rx_pkts++;
854
855 if (pkt_type == BE_MULTICAST_PACKET)
856 stats->be_rx_mcast_pkt++;
854} 857}
855 858
856static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso) 859static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso)
@@ -920,9 +923,11 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
920 u16 rxq_idx, i, j; 923 u16 rxq_idx, i, j;
921 u32 pktsize, hdr_len, curr_frag_len, size; 924 u32 pktsize, hdr_len, curr_frag_len, size;
922 u8 *start; 925 u8 *start;
926 u8 pkt_type;
923 927
924 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); 928 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp);
925 pktsize = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp); 929 pktsize = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp);
930 pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp);
926 931
927 page_info = get_rx_page_info(adapter, rxq_idx); 932 page_info = get_rx_page_info(adapter, rxq_idx);
928 933
@@ -988,7 +993,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter,
988 BUG_ON(j > MAX_SKB_FRAGS); 993 BUG_ON(j > MAX_SKB_FRAGS);
989 994
990done: 995done:
991 be_rx_stats_update(adapter, pktsize, num_rcvd); 996 be_rx_stats_update(adapter, pktsize, num_rcvd, pkt_type);
992} 997}
993 998
994/* Process the RX completion indicated by rxcp when GRO is disabled */ 999/* Process the RX completion indicated by rxcp when GRO is disabled */
@@ -1055,6 +1060,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
1055 u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len; 1060 u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len;
1056 u16 i, rxq_idx = 0, vid, j; 1061 u16 i, rxq_idx = 0, vid, j;
1057 u8 vtm; 1062 u8 vtm;
1063 u8 pkt_type;
1058 1064
1059 num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp); 1065 num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp);
1060 /* Is it a flush compl that has no data */ 1066 /* Is it a flush compl that has no data */
@@ -1065,6 +1071,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
1065 vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); 1071 vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp);
1066 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); 1072 rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp);
1067 vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); 1073 vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp);
1074 pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp);
1068 1075
1069 /* vlanf could be wrongly set in some cards. 1076 /* vlanf could be wrongly set in some cards.
1070 * ignore if vtm is not set */ 1077 * ignore if vtm is not set */
@@ -1120,7 +1127,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
1120 vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid); 1127 vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid);
1121 } 1128 }
1122 1129
1123 be_rx_stats_update(adapter, pkt_size, num_rcvd); 1130 be_rx_stats_update(adapter, pkt_size, num_rcvd, pkt_type);
1124} 1131}
1125 1132
1126static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter) 1133static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter)
@@ -1738,26 +1745,7 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
1738 return 1; 1745 return 1;
1739} 1746}
1740 1747
1741static inline bool be_detect_ue(struct be_adapter *adapter) 1748void be_detect_dump_ue(struct be_adapter *adapter)
1742{
1743 u32 online0 = 0, online1 = 0;
1744
1745 pci_read_config_dword(adapter->pdev, PCICFG_ONLINE0, &online0);
1746
1747 pci_read_config_dword(adapter->pdev, PCICFG_ONLINE1, &online1);
1748
1749 if (!online0 || !online1) {
1750 adapter->ue_detected = true;
1751 dev_err(&adapter->pdev->dev,
1752 "UE Detected!! online0=%d online1=%d\n",
1753 online0, online1);
1754 return true;
1755 }
1756
1757 return false;
1758}
1759
1760void be_dump_ue(struct be_adapter *adapter)
1761{ 1749{
1762 u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask; 1750 u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask;
1763 u32 i; 1751 u32 i;
@@ -1774,6 +1762,11 @@ void be_dump_ue(struct be_adapter *adapter)
1774 ue_status_lo = (ue_status_lo & (~ue_status_lo_mask)); 1762 ue_status_lo = (ue_status_lo & (~ue_status_lo_mask));
1775 ue_status_hi = (ue_status_hi & (~ue_status_hi_mask)); 1763 ue_status_hi = (ue_status_hi & (~ue_status_hi_mask));
1776 1764
1765 if (ue_status_lo || ue_status_hi) {
1766 adapter->ue_detected = true;
1767 dev_err(&adapter->pdev->dev, "UE Detected!!\n");
1768 }
1769
1777 if (ue_status_lo) { 1770 if (ue_status_lo) {
1778 for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { 1771 for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) {
1779 if (ue_status_lo & 1) 1772 if (ue_status_lo & 1)
@@ -1809,10 +1802,8 @@ static void be_worker(struct work_struct *work)
1809 adapter->rx_post_starved = false; 1802 adapter->rx_post_starved = false;
1810 be_post_rx_frags(adapter); 1803 be_post_rx_frags(adapter);
1811 } 1804 }
1812 if (!adapter->ue_detected) { 1805 if (!adapter->ue_detected)
1813 if (be_detect_ue(adapter)) 1806 be_detect_dump_ue(adapter);
1814 be_dump_ue(adapter);
1815 }
1816 1807
1817 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); 1808 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000));
1818} 1809}