lib: fix various compilation warnings
[dpdk.git] / lib / librte_pmd_e1000 / igb_ethdev.c
index 1732c79..f0071bf 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  * 
- *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
  *   All rights reserved.
  * 
  *   Redistribution and use in source and binary forms, with or without 
@@ -57,8 +57,7 @@
 #include "e1000/e1000_api.h"
 #include "e1000_ethdev.h"
 
-static int  eth_igb_configure(struct rte_eth_dev *dev, uint16_t nb_rx_q,
-               uint16_t nb_tx_q);
+static int  eth_igb_configure(struct rte_eth_dev *dev);
 static int  eth_igb_start(struct rte_eth_dev *dev);
 static void eth_igb_stop(struct rte_eth_dev *dev);
 static void eth_igb_close(struct rte_eth_dev *dev);
@@ -177,7 +176,9 @@ static struct eth_dev_ops eth_igb_ops = {
        .vlan_tpid_set        = eth_igb_vlan_tpid_set,
        .vlan_offload_set     = eth_igb_vlan_offload_set,
        .rx_queue_setup       = eth_igb_rx_queue_setup,
+       .rx_queue_release     = eth_igb_rx_queue_release,
        .tx_queue_setup       = eth_igb_tx_queue_setup,
+       .tx_queue_release     = eth_igb_tx_queue_release,
        .dev_led_on           = eth_igb_led_on,
        .dev_led_off          = eth_igb_led_off,
        .flow_ctrl_set        = eth_igb_flow_ctrl_set,
@@ -282,7 +283,7 @@ eth_igb_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
        struct e1000_hw *hw =
                E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
        struct e1000_vfta * shadow_vfta =
-               E1000_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private);
+                       E1000_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private);
 
        pci_dev = eth_dev->pci_dev;
        eth_dev->dev_ops = &eth_igb_ops;
@@ -500,35 +501,15 @@ rte_igbvf_pmd_init(void)
 }
 
 static int
-eth_igb_configure(struct rte_eth_dev *dev, uint16_t nb_rx_q, uint16_t nb_tx_q)
+eth_igb_configure(struct rte_eth_dev *dev)
 {
        struct e1000_interrupt *intr =
                E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
-       int diag;
 
        PMD_INIT_LOG(DEBUG, ">>");
 
        intr->flags |= E1000_FLAG_NEED_LINK_UPDATE;
 
-       /* Allocate the array of pointers to RX structures */
-       diag = igb_dev_rx_queue_alloc(dev, nb_rx_q);
-       if (diag != 0) {
-               PMD_INIT_LOG(ERR, "ethdev port_id=%u allocation of array of %u"
-                                       " pointers to RX queues failed",
-                                       dev->data->port_id, nb_rx_q);
-               return diag;
-       }
-
-       /* Allocate the array of pointers to TX structures */
-       diag = igb_dev_tx_queue_alloc(dev, nb_tx_q);
-       if (diag != 0) {
-               PMD_INIT_LOG(ERR, "ethdev port_id=%u allocation of array of %u"
-                                       " pointers to TX queues failed",
-                                       dev->data->port_id, nb_tx_q);
-
-               return diag;
-       }
-
        PMD_INIT_LOG(DEBUG, "<<");
 
        return (0);
@@ -539,7 +520,7 @@ eth_igb_start(struct rte_eth_dev *dev)
 {
        struct e1000_hw *hw =
                E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-       int ret, i;
+       int ret, i, mask;
 
        PMD_INIT_LOG(DEBUG, ">>");
 
@@ -566,7 +547,7 @@ eth_igb_start(struct rte_eth_dev *dev)
        /* Initialize the hardware */
        if (igb_hardware_init(hw)) {
                PMD_INIT_LOG(ERR, "Unable to initialize the hardware");
-               return (-1);
+               return (-EIO);
        }
 
        E1000_WRITE_REG(hw, E1000_VET, ETHER_TYPE_VLAN);
@@ -580,6 +561,7 @@ eth_igb_start(struct rte_eth_dev *dev)
        ret = eth_igb_rx_init(dev);
        if (ret) {
                PMD_INIT_LOG(ERR, "Unable to initialize RX hardware");
+               igb_dev_clear_queues(dev);
                return ret;
        }
 
@@ -685,7 +667,8 @@ error_invalid_config:
        PMD_INIT_LOG(ERR, "Invalid link_speed/link_duplex (%u/%u) for port %u\n",
                        dev->data->dev_conf.link_speed,
                        dev->data->dev_conf.link_duplex, dev->data->port_id);
-       return -1;
+       igb_dev_clear_queues(dev);
+       return (-EINVAL);
 }
 
 /*********************************************************************
@@ -1567,7 +1550,8 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev)
  *  void
  */
 static void
-eth_igb_interrupt_handler(struct rte_intr_handle *handle, void *param)
+eth_igb_interrupt_handler(__rte_unused struct rte_intr_handle *handle,
+                                                       void *param)
 {
        struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
@@ -1846,7 +1830,8 @@ static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)
                        mask = 1;
                        for (j = 0; j < 32; j++){
                                if(vfta & mask)
-                                       igbvf_set_vfta(hw, (i<<5)+j, on);
+                                       igbvf_set_vfta(hw,
+                                               (uint16_t)((i<<5)+j), on);
                                mask<<=1;
                        }
                }