ethdev: increase port id range
[dpdk.git] / drivers / net / nfp / nfp_net.c
index 5d35ce1..4ef9d2b 100644 (file)
@@ -488,10 +488,6 @@ nfp_net_configure(struct rte_eth_dev *dev)
                return -EINVAL;
        }
 
-       /* Supporting VLAN insertion by default */
-       if (hw->cap & NFP_NET_CFG_CTRL_TXVLAN)
-               new_ctrl |= NFP_NET_CFG_CTRL_TXVLAN;
-
        if (rxmode->jumbo_frame)
                /* this is handled in rte_eth_dev_configure */
 
@@ -505,6 +501,32 @@ nfp_net_configure(struct rte_eth_dev *dev)
                return -EINVAL;
        }
 
+       /* If next capabilities are supported, configure them by default */
+
+       /* VLAN insertion */
+       if (hw->cap & NFP_NET_CFG_CTRL_TXVLAN)
+               new_ctrl |= NFP_NET_CFG_CTRL_TXVLAN;
+
+       /* L2 broadcast */
+       if (hw->cap & NFP_NET_CFG_CTRL_L2BC)
+               new_ctrl |= NFP_NET_CFG_CTRL_L2BC;
+
+       /* L2 multicast */
+       if (hw->cap & NFP_NET_CFG_CTRL_L2MC)
+               new_ctrl |= NFP_NET_CFG_CTRL_L2MC;
+
+       /* TX checksum offload */
+       if (hw->cap & NFP_NET_CFG_CTRL_TXCSUM)
+               new_ctrl |= NFP_NET_CFG_CTRL_TXCSUM;
+
+       /* LSO offload */
+       if (hw->cap & NFP_NET_CFG_CTRL_LSO)
+               new_ctrl |= NFP_NET_CFG_CTRL_LSO;
+
+       /* RX gather */
+       if (hw->cap & NFP_NET_CFG_CTRL_GATHER)
+               new_ctrl |= NFP_NET_CFG_CTRL_GATHER;
+
        if (!new_ctrl)
                return 0;
 
@@ -988,17 +1010,10 @@ nfp_net_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
        nn_link_status = (nn_link_status >> NFP_NET_CFG_STS_LINK_RATE_SHIFT) &
                         NFP_NET_CFG_STS_LINK_RATE_MASK;
 
-       if ((NFD_CFG_MAJOR_VERSION_of(hw->ver) < 4) ||
-           ((NFD_CFG_MINOR_VERSION_of(hw->ver) == 4) &&
-           (NFD_CFG_MINOR_VERSION_of(hw->ver) == 0)))
-               /* We really do not know the speed wil old firmware */
+       if (nn_link_status >= RTE_DIM(ls_to_ethtool))
                link.link_speed = ETH_SPEED_NUM_NONE;
-       else {
-               if (nn_link_status >= RTE_DIM(ls_to_ethtool))
-                       link.link_speed = ETH_SPEED_NUM_NONE;
-               else
-                       link.link_speed = ls_to_ethtool[nn_link_status];
-       }
+       else
+               link.link_speed = ls_to_ethtool[nn_link_status];
 
        if (old.link_status != link.link_status) {
                nfp_net_dev_atomic_write_link_status(dev, &link);
@@ -1218,6 +1233,11 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
                             ETH_TXQ_FLAGS_NOOFFLOADS,
        };
 
+       dev_info->flow_type_rss_offloads = ETH_RSS_NONFRAG_IPV4_TCP |
+                                          ETH_RSS_NONFRAG_IPV4_UDP |
+                                          ETH_RSS_NONFRAG_IPV6_TCP |
+                                          ETH_RSS_NONFRAG_IPV6_UDP;
+
        dev_info->reta_size = NFP_NET_CFG_RSS_ITBL_SZ;
        dev_info->hash_key_size = NFP_NET_CFG_RSS_KEY_SZ;
 
@@ -1333,12 +1353,12 @@ nfp_net_dev_link_status_print(struct rte_eth_dev *dev)
        nfp_net_dev_atomic_read_link_status(dev, &link);
        if (link.link_status)
                RTE_LOG(INFO, PMD, "Port %d: Link Up - speed %u Mbps - %s\n",
-                       (int)(dev->data->port_id), (unsigned)link.link_speed,
+                       dev->data->port_id, link.link_speed,
                        link.link_duplex == ETH_LINK_FULL_DUPLEX
                        ? "full-duplex" : "half-duplex");
        else
                RTE_LOG(INFO, PMD, " Port %d: Link Down\n",
-                       (int)(dev->data->port_id));
+                       dev->data->port_id);
 
        RTE_LOG(INFO, PMD, "PCI Address: %04d:%02d:%02d:%d\n",
                pci_dev->addr.domain, pci_dev->addr.bus,
@@ -1642,7 +1662,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
                        "tx_free_thresh must be less than the number of TX "
                        "descriptors. (tx_free_thresh=%u port=%d "
                        "queue=%d)\n", (unsigned int)tx_free_thresh,
-                       (int)dev->data->port_id, (int)queue_idx);
+                       dev->data->port_id, (int)queue_idx);
                return -(EINVAL);
        }
 
@@ -1981,9 +2001,9 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                 */
                new_mb = rte_pktmbuf_alloc(rxq->mem_pool);
                if (unlikely(new_mb == NULL)) {
-                       RTE_LOG_DP(DEBUG, PMD, "RX mbuf alloc failed port_id=%u "
-                               "queue_id=%u\n", (unsigned)rxq->port_id,
-                               (unsigned)rxq->qidx);
+                       RTE_LOG_DP(DEBUG, PMD,
+                       "RX mbuf alloc failed port_id=%u queue_id=%u\n",
+                               rxq->port_id, (unsigned int)rxq->qidx);
                        nfp_net_mbuf_alloc_failed(rxq);
                        break;
                }
@@ -2067,7 +2087,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                return nb_hold;
 
        PMD_RX_LOG(DEBUG, "RX  port_id=%u queue_id=%u, %d packets received\n",
-                  (unsigned)rxq->port_id, (unsigned)rxq->qidx, nb_hold);
+                  rxq->port_id, (unsigned int)rxq->qidx, nb_hold);
 
        nb_hold += rxq->nb_rx_hold;
 
@@ -2078,7 +2098,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
        rte_wmb();
        if (nb_hold > rxq->rx_free_thresh) {
                PMD_RX_LOG(DEBUG, "port=%u queue=%u nb_hold=%u avail=%u\n",
-                          (unsigned)rxq->port_id, (unsigned)rxq->qidx,
+                          rxq->port_id, (unsigned int)rxq->qidx,
                           (unsigned)nb_hold, (unsigned)avail);
                nfp_qcp_ptr_add(rxq->qcp_fl, NFP_QCP_WRITE_PTR, nb_hold);
                nb_hold = 0;
@@ -2759,8 +2779,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
 
        PMD_INIT_LOG(INFO, "VER: %#x, Maximum supported MTU: %d",
                     hw->ver, hw->max_mtu);
-       PMD_INIT_LOG(INFO, "CAP: %#x, %s%s%s%s%s%s%s%s%s", hw->cap,
+       PMD_INIT_LOG(INFO, "CAP: %#x, %s%s%s%s%s%s%s%s%s%s%s", hw->cap,
                     hw->cap & NFP_NET_CFG_CTRL_PROMISC ? "PROMISC " : "",
+                    hw->cap & NFP_NET_CFG_CTRL_L2BC    ? "L2BCFILT " : "",
+                    hw->cap & NFP_NET_CFG_CTRL_L2MC    ? "L2MCFILT " : "",
                     hw->cap & NFP_NET_CFG_CTRL_RXCSUM  ? "RXCSUM "  : "",
                     hw->cap & NFP_NET_CFG_CTRL_TXCSUM  ? "TXCSUM "  : "",
                     hw->cap & NFP_NET_CFG_CTRL_RXVLAN  ? "RXVLAN "  : "",
@@ -2788,10 +2810,12 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
                return -ENOMEM;
        }
 
-       if (hw->is_pf)
+       if (hw->is_pf) {
                nfp_net_pf_read_mac(hwport0, port);
-       else
+               nfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr);
+       } else {
                nfp_net_vf_read_mac(hw);
+       }
 
        if (!is_valid_assigned_ether_addr((struct ether_addr *)&hw->mac_addr)) {
                /* Using random mac addresses for VFs */