net/ixgbe/base: update device IDs
[dpdk.git] / drivers / net / vmxnet3 / vmxnet3_ethdev.c
index 2edf2e9..29b469c 100644 (file)
@@ -86,9 +86,13 @@ static void vmxnet3_dev_stats_get(struct rte_eth_dev *dev,
                                struct rte_eth_stats *stats);
 static void 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_vlan_filter_set(struct rte_eth_dev *dev,
                                       uint16_t vid, int on);
 static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
+                                struct ether_addr *mac_addr);
 
 #if PROCESS_SYS_EVENTS == 1
 static void vmxnet3_process_events(struct vmxnet3_hw *);
@@ -115,7 +119,9 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = {
        .allmulticast_disable = vmxnet3_dev_allmulticast_disable,
        .link_update          = vmxnet3_dev_link_update,
        .stats_get            = vmxnet3_dev_stats_get,
+       .mac_addr_set         = vmxnet3_mac_addr_set,
        .dev_infos_get        = vmxnet3_dev_info_get,
+       .dev_supported_ptypes_get = vmxnet3_dev_supported_ptypes_get,
        .vlan_filter_set      = vmxnet3_dev_vlan_filter_set,
        .vlan_offload_set     = vmxnet3_dev_vlan_offload_set,
        .rx_queue_setup       = vmxnet3_dev_rx_queue_setup,
@@ -421,6 +427,23 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev)
        return 0;
 }
 
+static void
+vmxnet3_write_mac(struct vmxnet3_hw *hw, const uint8_t *addr)
+{
+       uint32_t val;
+
+       PMD_INIT_LOG(DEBUG,
+                    "Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x",
+                    addr[0], addr[1], addr[2],
+                    addr[3], addr[4], addr[5]);
+
+       val = *(const uint32_t *)addr;
+       VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, val);
+
+       val = (addr[5] << 8) | addr[4];
+       VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, val);
+}
+
 static int
 vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
 {
@@ -429,8 +452,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
        uint32_t mtu = dev->data->mtu;
        Vmxnet3_DriverShared *shared = hw->shared;
        Vmxnet3_DSDevRead *devRead = &shared->devRead;
-       uint32_t *mac_ptr;
-       uint32_t val, i;
+       uint32_t i;
        int ret;
 
        shared->magic = VMXNET3_REV1_MAGIC;
@@ -516,18 +538,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev)
        vmxnet3_dev_vlan_offload_set(dev,
                             ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK);
 
-       PMD_INIT_LOG(DEBUG,
-                    "Writing MAC Address : %02x:%02x:%02x:%02x:%02x:%02x",
-                    hw->perm_addr[0], hw->perm_addr[1], hw->perm_addr[2],
-                    hw->perm_addr[3], hw->perm_addr[4], hw->perm_addr[5]);
-
-       /* Write MAC Address back to device */
-       mac_ptr = (uint32_t *)hw->perm_addr;
-       val = *mac_ptr;
-       VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, val);
-
-       val = (hw->perm_addr[5] << 8) | hw->perm_addr[4];
-       VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, val);
+       vmxnet3_write_mac(hw, hw->perm_addr);
 
        return VMXNET3_SUCCESS;
 }
@@ -683,7 +694,6 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 
                stats->q_errors[i] = rxStats->pktsRxError;
                stats->ierrors += rxStats->pktsRxError;
-               stats->imcasts += rxStats->mcastPktsRxOK;
                stats->rx_nombuf += rxStats->pktsRxOutOfBuf;
        }
 }
@@ -698,8 +708,7 @@ vmxnet3_dev_info_get(__attribute__((unused))struct rte_eth_dev *dev,
        dev_info->max_rx_pktlen = 16384; /* includes CRC, cf MAXFRS register */
        dev_info->max_mac_addrs = VMXNET3_MAX_MAC_ADDRS;
 
-       dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-                                               ETH_TXQ_FLAGS_NOOFFLOADS;
+       dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOXSUMSCTP;
        dev_info->flow_type_rss_offloads = VMXNET3_RSS_OFFLOAD_ALL;
 
        dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
@@ -726,6 +735,28 @@ vmxnet3_dev_info_get(__attribute__((unused))struct rte_eth_dev *dev,
                DEV_TX_OFFLOAD_TCP_TSO;
 }
 
+static const uint32_t *
+vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev)
+{
+       static const uint32_t ptypes[] = {
+               RTE_PTYPE_L3_IPV4_EXT,
+               RTE_PTYPE_L3_IPV4,
+               RTE_PTYPE_UNKNOWN
+       };
+
+       if (dev->rx_pkt_burst == vmxnet3_recv_pkts)
+               return ptypes;
+       return NULL;
+}
+
+static void
+vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
+{
+       struct vmxnet3_hw *hw = dev->data->dev_private;
+
+       vmxnet3_write_mac(hw, mac_addr->addr_bytes);
+}
+
 /* return 0 means link status changed, -1 means not changed */
 static int
 vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int wait_to_complete)
@@ -744,9 +775,10 @@ vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int wai
        ret = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
 
        if (ret & 0x1) {
-               link.link_status = 1;
+               link.link_status = ETH_LINK_UP;
                link.link_duplex = ETH_LINK_FULL_DUPLEX;
-               link.link_speed = ETH_LINK_SPEED_10000;
+               link.link_speed = ETH_SPEED_NUM_10G;
+               link.link_autoneg = ETH_LINK_SPEED_FIXED;
        }
 
        vmxnet3_dev_atomic_write_link_status(dev, &link);