git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/dpaa2: allocate SGT from first segment
[dpdk.git]
/
drivers
/
net
/
e1000
/
em_ethdev.c
diff --git
a/drivers/net/e1000/em_ethdev.c
b/drivers/net/e1000/em_ethdev.c
index
188cda3
..
9b8c4a7
100644
(file)
--- a/
drivers/net/e1000/em_ethdev.c
+++ b/
drivers/net/e1000/em_ethdev.c
@@
-15,8
+15,8
@@
#include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ether.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ether.h>
-#include <
rte_
ethdev_driver.h>
-#include <
rte_
ethdev_pci.h>
+#include <ethdev_driver.h>
+#include <ethdev_pci.h>
#include <rte_memory.h>
#include <rte_eal.h>
#include <rte_malloc.h>
#include <rte_memory.h>
#include <rte_eal.h>
#include <rte_malloc.h>
@@
-33,8
+33,8
@@
static int eth_em_configure(struct rte_eth_dev *dev);
static int eth_em_start(struct rte_eth_dev *dev);
static int eth_em_configure(struct rte_eth_dev *dev);
static int eth_em_start(struct rte_eth_dev *dev);
-static
void
eth_em_stop(struct rte_eth_dev *dev);
-static
void
eth_em_close(struct rte_eth_dev *dev);
+static
int
eth_em_stop(struct rte_eth_dev *dev);
+static
int
eth_em_close(struct rte_eth_dev *dev);
static int eth_em_promiscuous_enable(struct rte_eth_dev *dev);
static int eth_em_promiscuous_disable(struct rte_eth_dev *dev);
static int eth_em_allmulticast_enable(struct rte_eth_dev *dev);
static int eth_em_promiscuous_enable(struct rte_eth_dev *dev);
static int eth_em_promiscuous_disable(struct rte_eth_dev *dev);
static int eth_em_allmulticast_enable(struct rte_eth_dev *dev);
@@
-176,10
+176,6
@@
static const struct eth_dev_ops eth_em_ops = {
.vlan_offload_set = eth_em_vlan_offload_set,
.rx_queue_setup = eth_em_rx_queue_setup,
.rx_queue_release = eth_em_rx_queue_release,
.vlan_offload_set = eth_em_vlan_offload_set,
.rx_queue_setup = eth_em_rx_queue_setup,
.rx_queue_release = eth_em_rx_queue_release,
- .rx_queue_count = eth_em_rx_queue_count,
- .rx_descriptor_done = eth_em_rx_descriptor_done,
- .rx_descriptor_status = eth_em_rx_descriptor_status,
- .tx_descriptor_status = eth_em_tx_descriptor_status,
.tx_queue_setup = eth_em_tx_queue_setup,
.tx_queue_release = eth_em_tx_queue_release,
.rx_queue_intr_enable = eth_em_rx_queue_intr_enable,
.tx_queue_setup = eth_em_tx_queue_setup,
.tx_queue_release = eth_em_tx_queue_release,
.rx_queue_intr_enable = eth_em_rx_queue_intr_enable,
@@
-250,6
+246,10
@@
eth_em_dev_init(struct rte_eth_dev *eth_dev)
E1000_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private);
eth_dev->dev_ops = ð_em_ops;
E1000_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private);
eth_dev->dev_ops = ð_em_ops;
+ eth_dev->rx_queue_count = eth_em_rx_queue_count;
+ eth_dev->rx_descriptor_done = eth_em_rx_descriptor_done;
+ eth_dev->rx_descriptor_status = eth_em_rx_descriptor_status;
+ eth_dev->tx_descriptor_status = eth_em_tx_descriptor_status;
eth_dev->rx_pkt_burst = (eth_rx_burst_t)ð_em_recv_pkts;
eth_dev->tx_pkt_burst = (eth_tx_burst_t)ð_em_xmit_pkts;
eth_dev->tx_pkt_prepare = (eth_tx_prep_t)ð_em_prep_pkts;
eth_dev->rx_pkt_burst = (eth_rx_burst_t)ð_em_recv_pkts;
eth_dev->tx_pkt_burst = (eth_tx_burst_t)ð_em_xmit_pkts;
eth_dev->tx_pkt_prepare = (eth_tx_prep_t)ð_em_prep_pkts;
@@
-265,6
+265,7
@@
eth_em_dev_init(struct rte_eth_dev *eth_dev)
}
rte_eth_copy_pci_info(eth_dev, pci_dev);
}
rte_eth_copy_pci_info(eth_dev, pci_dev);
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
hw->device_id = pci_dev->id.device_id;
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
hw->device_id = pci_dev->id.device_id;
@@
-297,11
+298,6
@@
eth_em_dev_init(struct rte_eth_dev *eth_dev)
rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,
eth_dev->data->mac_addrs);
rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,
eth_dev->data->mac_addrs);
- /* Pass the information to the rte_eth_dev_close() that it should also
- * release the private port resources.
- */
- eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
-
/* initialize the vfta */
memset(shadow_vfta, 0, sizeof(*shadow_vfta));
/* initialize the vfta */
memset(shadow_vfta, 0, sizeof(*shadow_vfta));
@@
-321,7
+317,7
@@
eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
PMD_INIT_FUNC_TRACE();
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
- return
-EPERM
;
+ return
0
;
eth_em_close(eth_dev);
eth_em_close(eth_dev);
@@
-538,7
+534,9
@@
eth_em_start(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
PMD_INIT_FUNC_TRACE();
- eth_em_stop(dev);
+ ret = eth_em_stop(dev);
+ if (ret != 0)
+ return ret;
e1000_power_up_phy(hw);
e1000_power_up_phy(hw);
@@
-714,7
+712,7
@@
error_invalid_config:
* global reset on the MAC.
*
**********************************************************************/
* global reset on the MAC.
*
**********************************************************************/
-static
void
+static
int
eth_em_stop(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
eth_em_stop(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
@@
-722,6
+720,8
@@
eth_em_stop(struct rte_eth_dev *dev)
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+ dev->data->dev_started = 0;
+
eth_em_rxtx_control(dev, false);
em_rxq_intr_disable(hw);
em_lsc_intr_disable(hw);
eth_em_rxtx_control(dev, false);
em_rxq_intr_disable(hw);
em_lsc_intr_disable(hw);
@@
-756,9
+756,11
@@
eth_em_stop(struct rte_eth_dev *dev)
rte_free(intr_handle->intr_vec);
intr_handle->intr_vec = NULL;
}
rte_free(intr_handle->intr_vec);
intr_handle->intr_vec = NULL;
}
+
+ return 0;
}
}
-static
void
+static
int
eth_em_close(struct rte_eth_dev *dev)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
eth_em_close(struct rte_eth_dev *dev)
{
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@
-766,22
+768,24
@@
eth_em_close(struct rte_eth_dev *dev)
E1000_DEV_PRIVATE(dev->data->dev_private);
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
E1000_DEV_PRIVATE(dev->data->dev_private);
struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+ int ret;
- eth_em_stop(dev);
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ ret = eth_em_stop(dev);
adapter->stopped = 1;
em_dev_free_queues(dev);
e1000_phy_hw_reset(hw);
em_release_manageability(hw);
em_hw_control_release(hw);
adapter->stopped = 1;
em_dev_free_queues(dev);
e1000_phy_hw_reset(hw);
em_release_manageability(hw);
em_hw_control_release(hw);
- dev->dev_ops = NULL;
- dev->rx_pkt_burst = NULL;
- dev->tx_pkt_burst = NULL;
-
/* disable uio intr before callback unregister */
rte_intr_disable(intr_handle);
rte_intr_callback_unregister(intr_handle,
eth_em_interrupt_handler, dev);
/* disable uio intr before callback unregister */
rte_intr_disable(intr_handle);
rte_intr_callback_unregister(intr_handle,
eth_em_interrupt_handler, dev);
+
+ return ret;
}
static int
}
static int
@@
-1630,7
+1634,7
@@
eth_em_interrupt_handler(void *param)
eth_em_interrupt_get_status(dev);
eth_em_interrupt_action(dev, dev->intr_handle);
eth_em_interrupt_get_status(dev);
eth_em_interrupt_action(dev, dev->intr_handle);
-
_
rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
+ rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
}
static int
}
static int
@@
-1795,8
+1799,7
@@
eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
if (ret != 0)
return ret;
if (ret != 0)
return ret;
- frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
- VLAN_TAG_SIZE;
+ frame_size = mtu + E1000_ETH_OVERHEAD;
/* check that mtu is within the allowed range */
if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen)
/* check that mtu is within the allowed range */
if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen)
@@
-1812,7
+1815,7
@@
eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
rctl = E1000_READ_REG(hw, E1000_RCTL);
/* switch to jumbo mode if needed */
rctl = E1000_READ_REG(hw, E1000_RCTL);
/* switch to jumbo mode if needed */
- if (frame_size >
RTE_ETHER
_MAX_LEN) {
+ if (frame_size >
E1000_ETH
_MAX_LEN) {
dev->data->dev_conf.rxmode.offloads |=
DEV_RX_OFFLOAD_JUMBO_FRAME;
rctl |= E1000_RCTL_LPE;
dev->data->dev_conf.rxmode.offloads |=
DEV_RX_OFFLOAD_JUMBO_FRAME;
rctl |= E1000_RCTL_LPE;