X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fvmxnet3%2Fvmxnet3_ethdev.c;h=c6e11ad2d37cf56c5d3ef9c2a444b72d379ee029;hb=e0e1496be5fcabd31807ef9981c421963a9f8578;hp=2b1e9151105b7ea160b6a632b6c94e28eaa50f77;hpb=de80fbfddb44b1bf883f84b9e2edbde22a569758;p=dpdk.git diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 2b1e915110..c6e11ad2d3 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -44,7 +44,6 @@ #define VMXNET3_TX_OFFLOAD_CAP \ (DEV_TX_OFFLOAD_VLAN_INSERT | \ - DEV_TX_OFFLOAD_IPV4_CKSUM | \ DEV_TX_OFFLOAD_TCP_CKSUM | \ DEV_TX_OFFLOAD_UDP_CKSUM | \ DEV_TX_OFFLOAD_TCP_TSO | \ @@ -54,11 +53,11 @@ (DEV_RX_OFFLOAD_VLAN_STRIP | \ DEV_RX_OFFLOAD_VLAN_FILTER | \ DEV_RX_OFFLOAD_SCATTER | \ - DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \ DEV_RX_OFFLOAD_TCP_CKSUM | \ DEV_RX_OFFLOAD_TCP_LRO | \ - DEV_RX_OFFLOAD_JUMBO_FRAME) + DEV_RX_OFFLOAD_JUMBO_FRAME | \ + DEV_RX_OFFLOAD_RSS_HASH) static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev); static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev); @@ -67,10 +66,10 @@ static int vmxnet3_dev_start(struct rte_eth_dev *dev); static void vmxnet3_dev_stop(struct rte_eth_dev *dev); static void vmxnet3_dev_close(struct rte_eth_dev *dev); static void vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set); -static void vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev); -static void vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev); -static void vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev); -static void vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev); +static int vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev); +static int vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev); +static int vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev); +static int vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev); static int __vmxnet3_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); static int vmxnet3_dev_link_update(struct rte_eth_dev *dev, @@ -78,16 +77,17 @@ static int vmxnet3_dev_link_update(struct rte_eth_dev *dev, static void vmxnet3_hw_stats_save(struct vmxnet3_hw *hw); static int vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); -static void vmxnet3_dev_stats_reset(struct rte_eth_dev *dev); +static int vmxnet3_dev_stats_reset(struct rte_eth_dev *dev); static int vmxnet3_dev_xstats_get_names(struct rte_eth_dev *dev, struct rte_eth_xstat_name *xstats, unsigned int n); static int vmxnet3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, unsigned int n); -static void vmxnet3_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int vmxnet3_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static const uint32_t * vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev); +static int vmxnet3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on); static int vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); @@ -125,6 +125,7 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = { .mac_addr_set = vmxnet3_mac_addr_set, .dev_infos_get = vmxnet3_dev_info_get, .dev_supported_ptypes_get = vmxnet3_dev_supported_ptypes_get, + .mtu_set = vmxnet3_dev_mtu_set, .vlan_filter_set = vmxnet3_dev_vlan_filter_set, .vlan_offload_set = vmxnet3_dev_vlan_offload_set, .rx_queue_setup = vmxnet3_dev_rx_queue_setup, @@ -409,6 +410,9 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); + if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG) + dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH; + if (dev->data->nb_tx_queues > VMXNET3_MAX_TX_QUEUES || dev->data->nb_rx_queues > VMXNET3_MAX_RX_QUEUES) { PMD_INIT_LOG(ERR, "ERROR: Number of queues not supported"); @@ -769,7 +773,8 @@ vmxnet3_dev_start(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "Failed to setup memory region\n"); } - if (VMXNET3_VERSION_GE_4(hw)) { + if (VMXNET3_VERSION_GE_4(hw) && + dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_RSS) { /* Check for additional RSS */ ret = vmxnet3_v4_rss_configure(dev); if (ret != VMXNET3_SUCCESS) { @@ -1127,7 +1132,7 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) return 0; } -static void +static int vmxnet3_dev_stats_reset(struct rte_eth_dev *dev) { unsigned int i; @@ -1149,10 +1154,12 @@ vmxnet3_dev_stats_reset(struct rte_eth_dev *dev) memcpy(&hw->snapshot_rx_stats[i], &rxStats, sizeof(hw->snapshot_rx_stats[0])); } + + return 0; } -static void -vmxnet3_dev_info_get(struct rte_eth_dev *dev __rte_unused, +static int +vmxnet3_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct vmxnet3_hw *hw = dev->data->dev_private; @@ -1161,6 +1168,8 @@ vmxnet3_dev_info_get(struct rte_eth_dev *dev __rte_unused, dev_info->max_tx_queues = VMXNET3_MAX_TX_QUEUES; dev_info->min_rx_bufsize = 1518 + RTE_PKTMBUF_HEADROOM; dev_info->max_rx_pktlen = 16384; /* includes CRC, cf MAXFRS register */ + dev_info->min_mtu = VMXNET3_MIN_MTU; + dev_info->max_mtu = VMXNET3_MAX_MTU; dev_info->speed_capa = ETH_LINK_SPEED_10G; dev_info->max_mac_addrs = VMXNET3_MAX_MAC_ADDRS; @@ -1188,6 +1197,8 @@ vmxnet3_dev_info_get(struct rte_eth_dev *dev __rte_unused, dev_info->rx_queue_offload_capa = 0; dev_info->tx_offload_capa = VMXNET3_TX_OFFLOAD_CAP; dev_info->tx_queue_offload_capa = 0; + + return 0; } static const uint32_t * @@ -1204,6 +1215,18 @@ vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev) return NULL; } +static int +vmxnet3_dev_mtu_set(struct rte_eth_dev *dev, __rte_unused uint16_t mtu) +{ + if (dev->data->dev_started) { + PMD_DRV_LOG(ERR, "Port %d must be stopped to configure MTU", + dev->data->port_id); + return -EBUSY; + } + + return 0; +} + static int vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { @@ -1262,7 +1285,7 @@ vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set) } /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in adapter */ -static void +static int vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev) { struct vmxnet3_hw *hw = dev->data->dev_private; @@ -1273,10 +1296,12 @@ vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev) VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_UPDATE_VLAN_FILTERS); + + return 0; } /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in adapter */ -static void +static int vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev) { struct vmxnet3_hw *hw = dev->data->dev_private; @@ -1290,24 +1315,30 @@ vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev) vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0); VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_UPDATE_VLAN_FILTERS); + + return 0; } /* Allmulticast supported only if Vmxnet3_DriverShared is initialized in adapter */ -static void +static int vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev) { struct vmxnet3_hw *hw = dev->data->dev_private; vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 1); + + return 0; } /* Allmulticast supported only if Vmxnet3_DriverShared is initialized in adapter */ -static void +static int vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev) { struct vmxnet3_hw *hw = dev->data->dev_private; vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_ALL_MULTI, 0); + + return 0; } /* Enable/disable filter on vlan */ @@ -1426,7 +1457,7 @@ vmxnet3_interrupt_handler(void *param) vmxnet3_process_events(dev); - if (rte_intr_enable(&pci_dev->intr_handle) < 0) + if (rte_intr_ack(&pci_dev->intr_handle) < 0) PMD_DRV_LOG(ERR, "interrupt enable failed"); }