소스 검색

sfc: Fix Siena mac statistics on big endian platforms

[bwh: Use __force in the one place it's needed]
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Steve Hodgson 14 년 전
부모
커밋
a659b2a94d
1개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 7 7
      drivers/net/sfc/siena.c

+ 7 - 7
drivers/net/sfc/siena.c

@@ -420,14 +420,13 @@ static void siena_remove_nic(struct efx_nic *efx)
 	efx->nic_data = NULL;
 	efx->nic_data = NULL;
 }
 }
 
 
-#define STATS_GENERATION_INVALID ((u64)(-1))
+#define STATS_GENERATION_INVALID ((__force __le64)(-1))
 
 
 static int siena_try_update_nic_stats(struct efx_nic *efx)
 static int siena_try_update_nic_stats(struct efx_nic *efx)
 {
 {
-	u64 *dma_stats;
+	__le64 *dma_stats;
 	struct efx_mac_stats *mac_stats;
 	struct efx_mac_stats *mac_stats;
-	u64 generation_start;
-	u64 generation_end;
+	__le64 generation_start, generation_end;
 
 
 	mac_stats = &efx->mac_stats;
 	mac_stats = &efx->mac_stats;
 	dma_stats = efx->stats_buffer.addr;
 	dma_stats = efx->stats_buffer.addr;
@@ -438,7 +437,7 @@ static int siena_try_update_nic_stats(struct efx_nic *efx)
 	rmb();
 	rmb();
 
 
 #define MAC_STAT(M, D) \
 #define MAC_STAT(M, D) \
-	mac_stats->M = dma_stats[MC_CMD_MAC_ ## D]
+	mac_stats->M = le64_to_cpu(dma_stats[MC_CMD_MAC_ ## D])
 
 
 	MAC_STAT(tx_bytes, TX_BYTES);
 	MAC_STAT(tx_bytes, TX_BYTES);
 	MAC_STAT(tx_bad_bytes, TX_BAD_BYTES);
 	MAC_STAT(tx_bad_bytes, TX_BAD_BYTES);
@@ -508,7 +507,8 @@ static int siena_try_update_nic_stats(struct efx_nic *efx)
 	MAC_STAT(rx_internal_error, RX_INTERNAL_ERROR_PKTS);
 	MAC_STAT(rx_internal_error, RX_INTERNAL_ERROR_PKTS);
 	mac_stats->rx_good_lt64 = 0;
 	mac_stats->rx_good_lt64 = 0;
 
 
-	efx->n_rx_nodesc_drop_cnt = dma_stats[MC_CMD_MAC_RX_NODESC_DROPS];
+	efx->n_rx_nodesc_drop_cnt =
+		le64_to_cpu(dma_stats[MC_CMD_MAC_RX_NODESC_DROPS]);
 
 
 #undef MAC_STAT
 #undef MAC_STAT
 
 
@@ -537,7 +537,7 @@ static void siena_update_nic_stats(struct efx_nic *efx)
 
 
 static void siena_start_nic_stats(struct efx_nic *efx)
 static void siena_start_nic_stats(struct efx_nic *efx)
 {
 {
-	u64 *dma_stats = (u64 *)efx->stats_buffer.addr;
+	__le64 *dma_stats = efx->stats_buffer.addr;
 
 
 	dma_stats[MC_CMD_MAC_GENERATION_END] = STATS_GENERATION_INVALID;
 	dma_stats[MC_CMD_MAC_GENERATION_END] = STATS_GENERATION_INVALID;