@@ -2042,29 +2042,20 @@ qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map)
20422042 */
20432043int
20442044qla2x00_get_link_status (scsi_qla_host_t * ha , uint16_t loop_id ,
2045- link_stat_t * ret_buf , uint16_t * status )
2045+ struct link_statistics * stats , dma_addr_t stats_dma )
20462046{
20472047 int rval ;
20482048 mbx_cmd_t mc ;
20492049 mbx_cmd_t * mcp = & mc ;
2050- link_stat_t * stat_buf ;
2051- dma_addr_t stat_buf_dma ;
2050+ uint32_t * siter , * diter , dwords ;
20522051
20532052 DEBUG11 (printk ("%s(%ld): entered.\n" , __func__ , ha -> host_no ));
20542053
2055- stat_buf = dma_pool_alloc (ha -> s_dma_pool , GFP_ATOMIC , & stat_buf_dma );
2056- if (stat_buf == NULL ) {
2057- DEBUG2_3_11 (printk ("%s(%ld): Failed to allocate memory.\n" ,
2058- __func__ , ha -> host_no ));
2059- return BIT_0 ;
2060- }
2061- memset (stat_buf , 0 , sizeof (link_stat_t ));
2062-
20632054 mcp -> mb [0 ] = MBC_GET_LINK_STATUS ;
2064- mcp -> mb [2 ] = MSW (stat_buf_dma );
2065- mcp -> mb [3 ] = LSW (stat_buf_dma );
2066- mcp -> mb [6 ] = MSW (MSD (stat_buf_dma ));
2067- mcp -> mb [7 ] = LSW (MSD (stat_buf_dma ));
2055+ mcp -> mb [2 ] = MSW (stats_dma );
2056+ mcp -> mb [3 ] = LSW (stats_dma );
2057+ mcp -> mb [6 ] = MSW (MSD (stats_dma ));
2058+ mcp -> mb [7 ] = LSW (MSD (stats_dma ));
20682059 mcp -> out_mb = MBX_7 |MBX_6 |MBX_3 |MBX_2 |MBX_0 ;
20692060 mcp -> in_mb = MBX_0 ;
20702061 if (IS_FWI2_CAPABLE (ha )) {
@@ -2089,78 +2080,43 @@ qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id,
20892080 if (mcp -> mb [0 ] != MBS_COMMAND_COMPLETE ) {
20902081 DEBUG2_3_11 (printk ("%s(%ld): cmd failed. mbx0=%x.\n" ,
20912082 __func__ , ha -> host_no , mcp -> mb [0 ]));
2092- status [0 ] = mcp -> mb [0 ];
2093- rval = BIT_1 ;
2083+ rval = QLA_FUNCTION_FAILED ;
20942084 } else {
2095- /* copy over data -- firmware data is LE. */
2096- ret_buf -> link_fail_cnt =
2097- le32_to_cpu (stat_buf -> link_fail_cnt );
2098- ret_buf -> loss_sync_cnt =
2099- le32_to_cpu (stat_buf -> loss_sync_cnt );
2100- ret_buf -> loss_sig_cnt =
2101- le32_to_cpu (stat_buf -> loss_sig_cnt );
2102- ret_buf -> prim_seq_err_cnt =
2103- le32_to_cpu (stat_buf -> prim_seq_err_cnt );
2104- ret_buf -> inval_xmit_word_cnt =
2105- le32_to_cpu (stat_buf -> inval_xmit_word_cnt );
2106- ret_buf -> inval_crc_cnt =
2107- le32_to_cpu (stat_buf -> inval_crc_cnt );
2108-
2109- DEBUG11 (printk ("%s(%ld): stat dump: fail_cnt=%d "
2110- "loss_sync=%d loss_sig=%d seq_err=%d "
2111- "inval_xmt_word=%d inval_crc=%d.\n" , __func__ ,
2112- ha -> host_no , stat_buf -> link_fail_cnt ,
2113- stat_buf -> loss_sync_cnt , stat_buf -> loss_sig_cnt ,
2114- stat_buf -> prim_seq_err_cnt ,
2115- stat_buf -> inval_xmit_word_cnt ,
2116- stat_buf -> inval_crc_cnt ));
2085+ /* Copy over data -- firmware data is LE. */
2086+ dwords = offsetof(struct link_statistics , unused1 ) / 4 ;
2087+ siter = diter = & stats -> link_fail_cnt ;
2088+ while (dwords -- )
2089+ * diter ++ = le32_to_cpu (* siter ++ );
21172090 }
21182091 } else {
21192092 /* Failed. */
21202093 DEBUG2_3_11 (printk ("%s(%ld): failed=%x.\n" , __func__ ,
21212094 ha -> host_no , rval ));
2122- rval = BIT_1 ;
21232095 }
21242096
2125- dma_pool_free (ha -> s_dma_pool , stat_buf , stat_buf_dma );
2126-
21272097 return rval ;
21282098}
21292099
21302100int
2131- qla24xx_get_isp_stats (scsi_qla_host_t * ha , uint32_t * dwbuf , uint32_t dwords ,
2132- uint16_t * status )
2101+ qla24xx_get_isp_stats (scsi_qla_host_t * ha , struct link_statistics * stats ,
2102+ dma_addr_t stats_dma )
21332103{
21342104 int rval ;
21352105 mbx_cmd_t mc ;
21362106 mbx_cmd_t * mcp = & mc ;
2137- uint32_t * sbuf , * siter ;
2138- dma_addr_t sbuf_dma ;
2107+ uint32_t * siter , * diter , dwords ;
21392108
21402109 DEBUG11 (printk ("%s(%ld): entered.\n" , __func__ , ha -> host_no ));
21412110
2142- if (dwords > (DMA_POOL_SIZE / 4 )) {
2143- DEBUG2_3_11 (printk ("%s(%ld): Unabled to retrieve %d DWORDs "
2144- "(max %d).\n" , __func__ , ha -> host_no , dwords ,
2145- DMA_POOL_SIZE / 4 ));
2146- return BIT_0 ;
2147- }
2148- sbuf = dma_pool_alloc (ha -> s_dma_pool , GFP_ATOMIC , & sbuf_dma );
2149- if (sbuf == NULL ) {
2150- DEBUG2_3_11 (printk ("%s(%ld): Failed to allocate memory.\n" ,
2151- __func__ , ha -> host_no ));
2152- return BIT_0 ;
2153- }
2154- memset (sbuf , 0 , DMA_POOL_SIZE );
2155-
21562111 mcp -> mb [0 ] = MBC_GET_LINK_PRIV_STATS ;
2157- mcp -> mb [2 ] = MSW (sbuf_dma );
2158- mcp -> mb [3 ] = LSW (sbuf_dma );
2159- mcp -> mb [6 ] = MSW (MSD (sbuf_dma ));
2160- mcp -> mb [7 ] = LSW (MSD (sbuf_dma ));
2161- mcp -> mb [8 ] = dwords ;
2112+ mcp -> mb [2 ] = MSW (stats_dma );
2113+ mcp -> mb [3 ] = LSW (stats_dma );
2114+ mcp -> mb [6 ] = MSW (MSD (stats_dma ));
2115+ mcp -> mb [7 ] = LSW (MSD (stats_dma ));
2116+ mcp -> mb [8 ] = sizeof (struct link_statistics ) / 4 ;
2117+ mcp -> mb [9 ] = ha -> vp_idx ;
21622118 mcp -> mb [10 ] = 0 ;
2163- mcp -> out_mb = MBX_10 |MBX_8 |MBX_7 |MBX_6 |MBX_3 |MBX_2 |MBX_0 ;
2119+ mcp -> out_mb = MBX_10 |MBX_9 | MBX_8 |MBX_7 |MBX_6 |MBX_3 |MBX_2 |MBX_0 ;
21642120 mcp -> in_mb = MBX_2 |MBX_1 |MBX_0 ;
21652121 mcp -> tov = 30 ;
21662122 mcp -> flags = IOCTL_CMD ;
@@ -2170,23 +2126,20 @@ qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords,
21702126 if (mcp -> mb [0 ] != MBS_COMMAND_COMPLETE ) {
21712127 DEBUG2_3_11 (printk ("%s(%ld): cmd failed. mbx0=%x.\n" ,
21722128 __func__ , ha -> host_no , mcp -> mb [0 ]));
2173- status [0 ] = mcp -> mb [0 ];
2174- rval = BIT_1 ;
2129+ rval = QLA_FUNCTION_FAILED ;
21752130 } else {
21762131 /* Copy over data -- firmware data is LE. */
2177- siter = sbuf ;
2132+ dwords = sizeof (struct link_statistics ) / 4 ;
2133+ siter = diter = & stats -> link_fail_cnt ;
21782134 while (dwords -- )
2179- * dwbuf ++ = le32_to_cpu (* siter ++ );
2135+ * diter ++ = le32_to_cpu (* siter ++ );
21802136 }
21812137 } else {
21822138 /* Failed. */
21832139 DEBUG2_3_11 (printk ("%s(%ld): failed=%x.\n" , __func__ ,
21842140 ha -> host_no , rval ));
2185- rval = BIT_1 ;
21862141 }
21872142
2188- dma_pool_free (ha -> s_dma_pool , sbuf , sbuf_dma );
2189-
21902143 return rval ;
21912144}
21922145
0 commit comments