net/ixgbe: allow setting 2.5G and 5G speeds on X550
[dpdk.git] / drivers / net / ixgbe / ixgbe_ethdev.c
index 3a531e1..cd5894f 100644 (file)
@@ -2298,6 +2298,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
                (struct ixgbe_adapter *)dev->data->dev_private;
        struct rte_eth_dev_info dev_info;
        uint64_t rx_offloads;
+       uint64_t tx_offloads;
        int ret;
 
        PMD_INIT_FUNC_TRACE();
@@ -2317,6 +2318,13 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
                            rx_offloads, dev_info.rx_offload_capa);
                return -ENOTSUP;
        }
+       tx_offloads = dev->data->dev_conf.txmode.offloads;
+       if ((tx_offloads & dev_info.tx_offload_capa) != tx_offloads) {
+               PMD_DRV_LOG(ERR, "Some Tx offloads are not supported "
+                           "requested 0x%" PRIx64 " supported 0x%" PRIx64,
+                           tx_offloads, dev_info.tx_offload_capa);
+               return -ENOTSUP;
+       }
 
        /* set flag to update link status after init */
        intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
@@ -2440,6 +2448,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
        uint32_t intr_vector = 0;
        int err, link_up = 0, negotiate = 0;
        uint32_t speed = 0;
+       uint32_t allowed_speeds = 0;
        int mask = 0;
        int status;
        uint16_t vf, idx;
@@ -2588,9 +2597,21 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
        if (err)
                goto error;
 
+       switch (hw->mac.type) {
+       case ixgbe_mac_X550:
+       case ixgbe_mac_X550EM_x:
+       case ixgbe_mac_X550EM_a:
+               allowed_speeds = ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G |
+                       ETH_LINK_SPEED_2_5G |  ETH_LINK_SPEED_5G |
+                       ETH_LINK_SPEED_10G;
+               break;
+       default:
+               allowed_speeds = ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G |
+                       ETH_LINK_SPEED_10G;
+       }
+
        link_speeds = &dev->data->dev_conf.link_speeds;
-       if (*link_speeds & ~(ETH_LINK_SPEED_100M | ETH_LINK_SPEED_1G |
-                       ETH_LINK_SPEED_10G)) {
+       if (*link_speeds & ~allowed_speeds) {
                PMD_INIT_LOG(ERR, "Invalid link setting");
                goto error;
        }
@@ -2616,6 +2637,10 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
        } else {
                if (*link_speeds & ETH_LINK_SPEED_10G)
                        speed |= IXGBE_LINK_SPEED_10GB_FULL;
+               if (*link_speeds & ETH_LINK_SPEED_5G)
+                       speed |= IXGBE_LINK_SPEED_5GB_FULL;
+               if (*link_speeds & ETH_LINK_SPEED_2_5G)
+                       speed |= IXGBE_LINK_SPEED_2_5GB_FULL;
                if (*link_speeds & ETH_LINK_SPEED_1G)
                        speed |= IXGBE_LINK_SPEED_1GB_FULL;
                if (*link_speeds & ETH_LINK_SPEED_100M)
@@ -2626,6 +2651,8 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
        if (err)
                goto error;
 
+       ixgbe_dev_link_update(dev, 0);
+
 skip_link_setup:
 
        if (rte_intr_allow_others(intr_handle)) {
@@ -3585,7 +3612,6 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 
-       dev_info->pci_dev = pci_dev;
        dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
        dev_info->max_tx_queues = (uint16_t)hw->mac.max_tx_queues;
        if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
@@ -3610,28 +3636,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev);
        dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) |
                                     dev_info->rx_queue_offload_capa);
-
-       dev_info->tx_offload_capa =
-               DEV_TX_OFFLOAD_VLAN_INSERT |
-               DEV_TX_OFFLOAD_IPV4_CKSUM  |
-               DEV_TX_OFFLOAD_UDP_CKSUM   |
-               DEV_TX_OFFLOAD_TCP_CKSUM   |
-               DEV_TX_OFFLOAD_SCTP_CKSUM  |
-               DEV_TX_OFFLOAD_TCP_TSO;
-
-       if (hw->mac.type == ixgbe_mac_82599EB ||
-           hw->mac.type == ixgbe_mac_X540)
-               dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_MACSEC_INSERT;
-
-       if (hw->mac.type == ixgbe_mac_X550 ||
-           hw->mac.type == ixgbe_mac_X550EM_x ||
-           hw->mac.type == ixgbe_mac_X550EM_a)
-               dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM;
-
-#ifdef RTE_LIBRTE_SECURITY
-       if (dev->security_ctx)
-               dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY;
-#endif
+       dev_info->tx_queue_offload_capa = ixgbe_get_tx_queue_offloads(dev);
+       dev_info->tx_offload_capa = ixgbe_get_tx_port_offloads(dev);
 
        dev_info->default_rxconf = (struct rte_eth_rxconf) {
                .rx_thresh = {
@@ -3653,7 +3659,9 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
                .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH,
                .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH,
                .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-                               ETH_TXQ_FLAGS_NOOFFLOADS,
+                            ETH_TXQ_FLAGS_NOOFFLOADS |
+                            ETH_TXQ_FLAGS_IGNORE,
+               .offloads = 0,
        };
 
        dev_info->rx_desc_lim = rx_desc_lim;
@@ -3722,7 +3730,6 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-       dev_info->pci_dev = pci_dev;
        dev_info->max_rx_queues = (uint16_t)hw->mac.max_rx_queues;
        dev_info->max_tx_queues = (uint16_t)hw->mac.max_tx_queues;
        dev_info->min_rx_bufsize = 1024; /* cf BSIZEPACKET in SRRCTL reg */
@@ -3737,12 +3744,8 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
        dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev);
        dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) |
                                     dev_info->rx_queue_offload_capa);
-       dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |
-                               DEV_TX_OFFLOAD_IPV4_CKSUM  |
-                               DEV_TX_OFFLOAD_UDP_CKSUM   |
-                               DEV_TX_OFFLOAD_TCP_CKSUM   |
-                               DEV_TX_OFFLOAD_SCTP_CKSUM  |
-                               DEV_TX_OFFLOAD_TCP_TSO;
+       dev_info->tx_queue_offload_capa = ixgbe_get_tx_queue_offloads(dev);
+       dev_info->tx_offload_capa = ixgbe_get_tx_port_offloads(dev);
 
        dev_info->default_rxconf = (struct rte_eth_rxconf) {
                .rx_thresh = {
@@ -3764,7 +3767,9 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev,
                .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH,
                .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH,
                .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-                               ETH_TXQ_FLAGS_NOOFFLOADS,
+                            ETH_TXQ_FLAGS_NOOFFLOADS |
+                            ETH_TXQ_FLAGS_IGNORE,
+               .offloads = 0,
        };
 
        dev_info->rx_desc_lim = rx_desc_lim;
@@ -3800,7 +3805,7 @@ ixgbevf_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
        /* for SFP+ modules and DA cables on 82599 it can take up to 500usecs
         * before the link status is correct
         */
-       if (mac->type == ixgbe_mac_82599_vf) {
+       if (mac->type == ixgbe_mac_82599_vf && wait_to_complete) {
                int i;
 
                for (i = 0; i < 5; i++) {
@@ -4892,6 +4897,7 @@ ixgbevf_dev_configure(struct rte_eth_dev *dev)
                        (struct ixgbe_adapter *)dev->data->dev_private;
        struct rte_eth_dev_info dev_info;
        uint64_t rx_offloads;
+       uint64_t tx_offloads;
 
        PMD_INIT_LOG(DEBUG, "Configured Virtual Function port id: %d",
                     dev->data->port_id);
@@ -4904,6 +4910,13 @@ ixgbevf_dev_configure(struct rte_eth_dev *dev)
                            rx_offloads, dev_info.rx_offload_capa);
                return -ENOTSUP;
        }
+       tx_offloads = dev->data->dev_conf.txmode.offloads;
+       if ((tx_offloads & dev_info.tx_offload_capa) != tx_offloads) {
+               PMD_DRV_LOG(ERR, "Some Tx offloads are not supported "
+                           "requested 0x%" PRIx64 " supported 0x%" PRIx64,
+                           tx_offloads, dev_info.tx_offload_capa);
+               return -ENOTSUP;
+       }
 
        /*
         * VF has no ability to enable/disable HW CRC
@@ -4979,6 +4992,8 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
 
        ixgbevf_dev_rxtx_start(dev);
 
+       ixgbevf_dev_link_update(dev, 0);
+
        /* check and configure queue intr-vector mapping */
        if (rte_intr_cap_multiple(intr_handle) &&
            dev->data->dev_conf.intr_conf.rxq) {