ena: fix build with icc
authorDaniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Tue, 29 Mar 2016 12:43:53 +0000 (14:43 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 30 Mar 2016 17:22:17 +0000 (19:22 +0200)
Fix for multiple compilation errors for ICC:
        error #188: enumerated type mixed with another type
        error #592: variable "flags" is used before its value is set

Fixes: 99ecfbf845b3 ("ena: import communication layer")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
drivers/net/ena/base/ena_com.c
drivers/net/ena/base/ena_com.h
drivers/net/ena/base/ena_eth_com.c

index c7355eb..f886760 100644 (file)
@@ -303,7 +303,7 @@ ena_com_submit_admin_cmd(struct ena_com_admin_queue *admin_queue,
                         struct ena_admin_acq_entry *comp,
                         size_t comp_size_in_bytes)
 {
-       unsigned long flags;
+       unsigned long flags = 0;
        struct ena_comp_ctx *comp_ctx;
 
        ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
@@ -526,7 +526,7 @@ ena_com_wait_and_process_admin_cq_interrupts(
                struct ena_comp_ctx *comp_ctx,
                struct ena_com_admin_queue *admin_queue)
 {
-       unsigned long flags;
+       unsigned long flags = 0;
        int ret = 0;
 
        ENA_WAIT_EVENT_WAIT(comp_ctx->wait_event,
@@ -571,7 +571,7 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
        volatile struct ena_admin_ena_mmio_req_read_less_resp *read_resp =
                mmio_read->read_resp;
        u32 mmio_read_reg, ret;
-       unsigned long flags;
+       unsigned long flags = 0;
        int i;
 
        ENA_MIGHT_SLEEP();
@@ -1248,7 +1248,7 @@ void ena_com_abort_admin_commands(struct ena_com_dev *ena_dev)
 void ena_com_wait_for_abort_completion(struct ena_com_dev *ena_dev)
 {
        struct ena_com_admin_queue *admin_queue = &ena_dev->admin_queue;
-       unsigned long flags;
+       unsigned long flags = 0;
 
        ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
        while (ATOMIC32_READ(&admin_queue->outstanding_cmds) != 0) {
@@ -1293,7 +1293,7 @@ bool ena_com_get_admin_running_state(struct ena_com_dev *ena_dev)
 void ena_com_set_admin_running_state(struct ena_com_dev *ena_dev, bool state)
 {
        struct ena_com_admin_queue *admin_queue = &ena_dev->admin_queue;
-       unsigned long flags;
+       unsigned long flags = 0;
 
        ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);
        ena_dev->admin_queue.running_state = state;
@@ -2190,7 +2190,7 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev,
        if (unlikely(rc))
                return rc;
 
-       rss->hash_func = get_resp.u.flow_hash_func.selected_func;
+       rss->hash_func = (enum ena_admin_hash_functions)get_resp.u.flow_hash_func.selected_func;
        if (func)
                *func = rss->hash_func;
 
@@ -2276,7 +2276,7 @@ int ena_com_set_default_hash_ctrl(struct ena_com_dev *ena_dev)
        int rc, i;
 
        /* Get the supported hash input */
-       rc = ena_com_get_hash_ctrl(ena_dev, 0, NULL);
+       rc = ena_com_get_hash_ctrl(ena_dev, (enum ena_admin_flow_hash_proto)0, NULL);
        if (unlikely(rc))
                return rc;
 
@@ -2323,7 +2323,7 @@ int ena_com_set_default_hash_ctrl(struct ena_com_dev *ena_dev)
 
        /* In case of failure, restore the old hash ctrl */
        if (unlikely(rc))
-               ena_com_get_hash_ctrl(ena_dev, 0, NULL);
+               ena_com_get_hash_ctrl(ena_dev, (enum ena_admin_flow_hash_proto)0, NULL);
 
        return rc;
 }
@@ -2360,7 +2360,7 @@ int ena_com_fill_hash_ctrl(struct ena_com_dev *ena_dev,
 
        /* In case of failure, restore the old hash ctrl */
        if (unlikely(rc))
-               ena_com_get_hash_ctrl(ena_dev, 0, NULL);
+               ena_com_get_hash_ctrl(ena_dev, (enum ena_admin_flow_hash_proto)0, NULL);
 
        return 0;
 }
index a257a68..19e53ff 100644 (file)
@@ -979,7 +979,7 @@ ena_com_calculate_interrupt_delay(struct ena_com_dev *ena_dev,
                 */
                return;
 
-       curr_moder_idx = *moder_tbl_idx;
+       curr_moder_idx = (enum ena_intr_moder_level)*moder_tbl_idx;
        if (unlikely(curr_moder_idx >=  ENA_INTR_MAX_NUM_OF_LEVELS)) {
                ena_trc_err("Wrong moderation index %u\n", curr_moder_idx);
                return;
@@ -991,17 +991,17 @@ ena_com_calculate_interrupt_delay(struct ena_com_dev *ena_dev,
        if (curr_moder_idx == ENA_INTR_MODER_LOWEST) {
                if ((pkts > curr_moder_entry->pkts_per_interval) ||
                    (bytes > curr_moder_entry->bytes_per_interval))
-                       new_moder_idx = curr_moder_idx + 1;
+                       new_moder_idx = (enum ena_intr_moder_level)(curr_moder_idx + 1);
        } else {
                pred_moder_entry = &intr_moder_tbl[curr_moder_idx - 1];
 
                if ((pkts <= pred_moder_entry->pkts_per_interval) ||
                    (bytes <= pred_moder_entry->bytes_per_interval))
-                       new_moder_idx = curr_moder_idx - 1;
+                       new_moder_idx = (enum ena_intr_moder_level)(curr_moder_idx - 1);
                else if ((pkts > curr_moder_entry->pkts_per_interval) ||
                         (bytes > curr_moder_entry->bytes_per_interval)) {
                        if (curr_moder_idx != ENA_INTR_MODER_HIGHEST)
-                               new_moder_idx = curr_moder_idx + 1;
+                               new_moder_idx = (enum ena_intr_moder_level)(curr_moder_idx + 1);
                }
        }
        new_moder_entry = &intr_moder_tbl[new_moder_idx];
index c5a6dfe..459e0bb 100644 (file)
@@ -236,11 +236,11 @@ static inline void ena_com_create_and_store_tx_meta_desc(
 static inline void ena_com_rx_set_flags(struct ena_com_rx_ctx *ena_rx_ctx,
                                        struct ena_eth_io_rx_cdesc_base *cdesc)
 {
-       ena_rx_ctx->l3_proto = cdesc->status &
-               ENA_ETH_IO_RX_CDESC_BASE_L3_PROTO_IDX_MASK;
-       ena_rx_ctx->l4_proto =
-               (cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_L4_PROTO_IDX_MASK) >>
-               ENA_ETH_IO_RX_CDESC_BASE_L4_PROTO_IDX_SHIFT;
+       ena_rx_ctx->l3_proto = (enum ena_eth_io_l3_proto_index)(cdesc->status &
+               ENA_ETH_IO_RX_CDESC_BASE_L3_PROTO_IDX_MASK);
+       ena_rx_ctx->l4_proto = (enum ena_eth_io_l4_proto_index)
+               ((cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_L4_PROTO_IDX_MASK) >>
+               ENA_ETH_IO_RX_CDESC_BASE_L4_PROTO_IDX_SHIFT);
        ena_rx_ctx->l3_csum_err =
                (cdesc->status & ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM_ERR_MASK) >>
                ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM_ERR_SHIFT;