X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fvmxnet3%2Fvmxnet3_ethdev.c;h=c6e11ad2d37cf56c5d3ef9c2a444b72d379ee029;hb=e0e1496be5fcabd31807ef9981c421963a9f8578;hp=9cd5eb65be14136faa9f7ad1ff32d57f1a03e1bc;hpb=86536da001c03d2bcbdb38ccdcd023e6d744f5b8;p=dpdk.git diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 9cd5eb65be..c6e11ad2d3 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -56,7 +56,8 @@ 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); @@ -65,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, @@ -76,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); @@ -123,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, @@ -407,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"); @@ -767,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) { @@ -1125,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; @@ -1147,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; @@ -1159,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; @@ -1186,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 * @@ -1202,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) { @@ -1260,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; @@ -1271,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; @@ -1288,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 */