Random fixes
authorRon Minnich <rminnich@gmail.com>
Mon, 12 Jan 2015 23:32:50 +0000 (15:32 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 3 Feb 2015 15:12:27 +0000 (10:12 -0500)
Signed-off-by: Ron Minnich <rminnich@gmail.com>
kern/drivers/net/bxe/bxe.c
kern/drivers/net/bxe/bxe_stats.c
scripts/spatch/htolexx.cocci [new file with mode: 0644]

index bb51712..62bc859 100644 (file)
@@ -2462,7 +2462,7 @@ bxe_sp_post(struct bxe_adapter *sc,
 
     /* CID needs port number to be encoded int it */
     spe->hdr.conn_and_cmd_data =
-        htole32((command << SPE_HDR_CMD_ID_SHIFT) | HW_CID(sc, cid));
+        cpu_to_le32((command << SPE_HDR_CMD_ID_SHIFT) | HW_CID(sc, cid));
 
     type = (cmd_type << SPE_HDR_CONN_TYPE_SHIFT) & SPE_HDR_CONN_TYPE;
 
@@ -2470,10 +2470,10 @@ bxe_sp_post(struct bxe_adapter *sc,
     type |= ((SC_FUNC(sc) << SPE_HDR_FUNCTION_ID_SHIFT) &
              SPE_HDR_FUNCTION_ID);
 
-    spe->hdr.type = htole16(type);
+    spe->hdr.type = cpu_to_le16(type);
 
-    spe->data.update_data_addr.hi = htole32(data_hi);
-    spe->data.update_data_addr.lo = htole32(data_lo);
+    spe->data.update_data_addr.hi = cpu_to_le32(data_hi);
+    spe->data.update_data_addr.lo = cpu_to_le32(data_lo);
 
     /*
      * It's ok if the actual decrement is issued towards the memory
@@ -10347,10 +10347,10 @@ bxe_init_eq_ring(struct bxe_adapter *sc)
     for (i = 1; i <= NUM_EQ_PAGES; i++) {
         elem = &sc->eq[EQ_DESC_CNT_PAGE * i - 1];
 
-        elem->next_page.addr.hi = htole32(U64_HI(sc->eq_dma.paddr +
+        elem->next_page.addr.hi = cpu_to_le32(U64_HI(sc->eq_dma.paddr +
                                                  BCM_PAGE_SIZE *
                                                  (i % NUM_EQ_PAGES)));
-        elem->next_page.addr.lo = htole32(U64_LO(sc->eq_dma.paddr +
+        elem->next_page.addr.lo = cpu_to_le32(U64_LO(sc->eq_dma.paddr +
                                                  BCM_PAGE_SIZE *
                                                  (i % NUM_EQ_PAGES)));
     }
@@ -15218,8 +15218,8 @@ bxe_alloc_hsi_mem(struct bxe_adapter *sc)
             /* point to the next page and wrap from last page */
             busaddr = (fp->tx_dma.paddr +
                        (BCM_PAGE_SIZE * (j % TX_BD_NUM_PAGES)));
-            tx_next_bd->addr_hi = htole32(U64_HI(busaddr));
-            tx_next_bd->addr_lo = htole32(U64_LO(busaddr));
+            tx_next_bd->addr_hi = cpu_to_le32(U64_HI(busaddr));
+            tx_next_bd->addr_lo = cpu_to_le32(U64_LO(busaddr));
         }
 
         /******************/
@@ -15244,8 +15244,8 @@ bxe_alloc_hsi_mem(struct bxe_adapter *sc)
             /* point to the next page and wrap from last page */
             busaddr = (fp->rx_dma.paddr +
                        (BCM_PAGE_SIZE * (j % RX_BD_NUM_PAGES)));
-            rx_bd->addr_hi = htole32(U64_HI(busaddr));
-            rx_bd->addr_lo = htole32(U64_LO(busaddr));
+            rx_bd->addr_hi = cpu_to_le32(U64_HI(busaddr));
+            rx_bd->addr_lo = cpu_to_le32(U64_LO(busaddr));
         }
 
         /*******************/
@@ -15271,8 +15271,8 @@ bxe_alloc_hsi_mem(struct bxe_adapter *sc)
             /* point to the next page and wrap from last page */
             busaddr = (fp->rcq_dma.paddr +
                        (BCM_PAGE_SIZE * (j % RCQ_NUM_PAGES)));
-            rx_cqe_next->addr_hi = htole32(U64_HI(busaddr));
-            rx_cqe_next->addr_lo = htole32(U64_LO(busaddr));
+            rx_cqe_next->addr_hi = cpu_to_le32(U64_HI(busaddr));
+            rx_cqe_next->addr_lo = cpu_to_le32(U64_LO(busaddr));
         }
 
         /*******************/
@@ -15297,8 +15297,8 @@ bxe_alloc_hsi_mem(struct bxe_adapter *sc)
             /* point to the next page and wrap from last page */
             busaddr = (fp->rx_sge_dma.paddr +
                        (BCM_PAGE_SIZE * (j % RX_SGE_NUM_PAGES)));
-            rx_sge->addr_hi = htole32(U64_HI(busaddr));
-            rx_sge->addr_lo = htole32(U64_LO(busaddr));
+            rx_sge->addr_hi = cpu_to_le32(U64_HI(busaddr));
+            rx_sge->addr_lo = cpu_to_le32(U64_LO(busaddr));
         }
 
         /***********************/
index 12de401..4a218c3 100644 (file)
@@ -1531,8 +1531,8 @@ bxe_prep_fw_stats_req(struct bxe_adapter *sc)
     cur_data_offset = (sc->fw_stats_data_mapping +
                        offsetof(struct bxe_fw_stats_data, storm_counters));
 
-    stats_hdr->stats_counters_addrs.hi = htole32(U64_HI(cur_data_offset));
-    stats_hdr->stats_counters_addrs.lo = htole32(U64_LO(cur_data_offset));
+    stats_hdr->stats_counters_addrs.hi = cpu_to_le32(U64_HI(cur_data_offset));
+    stats_hdr->stats_counters_addrs.lo = cpu_to_le32(U64_LO(cur_data_offset));
 
     /*
      * Prepare the first stats ramrod (will be completed with
@@ -1551,9 +1551,9 @@ bxe_prep_fw_stats_req(struct bxe_adapter *sc)
     /* For port query index is a DONT CARE */
     cur_query_entry->index = SC_PORT(sc);
     /* For port query funcID is a DONT CARE */
-    cur_query_entry->funcID = htole16(SC_FUNC(sc));
-    cur_query_entry->address.hi = htole32(U64_HI(cur_data_offset));
-    cur_query_entry->address.lo = htole32(U64_LO(cur_data_offset));
+    cur_query_entry->funcID = cpu_to_le16(SC_FUNC(sc));
+    cur_query_entry->address.hi = cpu_to_le32(U64_HI(cur_data_offset));
+    cur_query_entry->address.lo = cpu_to_le32(U64_LO(cur_data_offset));
 
     /**** PF FW statistics data ****/
     cur_data_offset = (sc->fw_stats_data_mapping +
@@ -1564,9 +1564,9 @@ bxe_prep_fw_stats_req(struct bxe_adapter *sc)
     cur_query_entry->kind = STATS_TYPE_PF;
     /* For PF query index is a DONT CARE */
     cur_query_entry->index = SC_PORT(sc);
-    cur_query_entry->funcID = htole16(SC_FUNC(sc));
-    cur_query_entry->address.hi = htole32(U64_HI(cur_data_offset));
-    cur_query_entry->address.lo = htole32(U64_LO(cur_data_offset));
+    cur_query_entry->funcID = cpu_to_le16(SC_FUNC(sc));
+    cur_query_entry->address.hi = cpu_to_le32(U64_HI(cur_data_offset));
+    cur_query_entry->address.lo = cpu_to_le32(U64_LO(cur_data_offset));
 
 #if 0
     /**** FCoE FW statistics data ****/
@@ -1606,9 +1606,9 @@ bxe_prep_fw_stats_req(struct bxe_adapter *sc)
 
         cur_query_entry->kind = STATS_TYPE_QUEUE;
         cur_query_entry->index = bxe_stats_id(&sc->fp[i]);
-        cur_query_entry->funcID = htole16(SC_FUNC(sc));
-        cur_query_entry->address.hi = htole32(U64_HI(cur_data_offset));
-        cur_query_entry->address.lo = htole32(U64_LO(cur_data_offset));
+        cur_query_entry->funcID = cpu_to_le16(SC_FUNC(sc));
+        cur_query_entry->address.hi = cpu_to_le32(U64_HI(cur_data_offset));
+        cur_query_entry->address.lo = cpu_to_le32(U64_LO(cur_data_offset));
 
         cur_data_offset += sizeof(struct per_queue_stats);
     }
diff --git a/scripts/spatch/htolexx.cocci b/scripts/spatch/htolexx.cocci
new file mode 100644 (file)
index 0000000..8d3a3bc
--- /dev/null
@@ -0,0 +1,11 @@
+@@
+@@
+-htole32(
++cpu_to_le32(
+...)
+
+@@
+@@
+-htole16(
++cpu_to_le16(
+...)