net/ice/base: add helper function to redirect flags
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 495c6cd..097dd10 100644 (file)
@@ -482,6 +482,12 @@ static int bnxt_setup_one_vnic(struct bnxt *bp, uint16_t vnic_id)
                        rxq->vnic->fw_grp_ids[j] = INVALID_HW_RING_ID;
                else
                        vnic->rx_queue_cnt++;
+
+               if (!rxq->rx_deferred_start) {
+                       bp->eth_dev->data->rx_queue_state[j] =
+                               RTE_ETH_QUEUE_STATE_STARTED;
+                       rxq->rx_started = true;
+               }
        }
 
        PMD_DRV_LOG(DEBUG, "vnic->rx_queue_cnt = %d\n", vnic->rx_queue_cnt);
@@ -981,9 +987,13 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
        dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
        if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
                dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP;
+       if (bp->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP)
+               dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_VLAN_STRIP;
        dev_info->tx_queue_offload_capa = DEV_TX_OFFLOAD_MBUF_FAST_FREE;
        dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT |
                                    dev_info->tx_queue_offload_capa;
+       if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT)
+               dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_VLAN_INSERT;
        dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
        dev_info->speed_capa = bnxt_get_speed_capabilities(bp);
@@ -1011,7 +1021,6 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
        };
        eth_dev->data->dev_conf.intr_conf.lsc = 1;
 
-       eth_dev->data->dev_conf.intr_conf.rxq = 1;
        dev_info->rx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
        dev_info->rx_desc_lim.nb_max = BNXT_MAX_RX_RING_DESC;
        dev_info->tx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
@@ -1844,11 +1853,6 @@ out:
        if (new.link_status != eth_dev->data->dev_link.link_status ||
            new.link_speed != eth_dev->data->dev_link.link_speed) {
                rte_eth_linkstatus_set(eth_dev, &new);
-
-               rte_eth_dev_callback_process(eth_dev,
-                                            RTE_ETH_EVENT_INTR_LSC,
-                                            NULL);
-
                bnxt_print_link_info(eth_dev);
        }
 
@@ -3068,6 +3072,9 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
        if (!rc)
                eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_pkt_size;
 
+       if (bnxt_hwrm_config_host_mtu(bp))
+               PMD_DRV_LOG(WARNING, "Failed to configure host MTU\n");
+
        PMD_DRV_LOG(INFO, "New MTU is %d\n", new_mtu);
 
        return rc;
@@ -3127,7 +3134,7 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
        struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
        struct bnxt_cp_ring_info *cpr;
-       uint32_t desc = 0, raw_cons;
+       uint32_t desc = 0, raw_cons, cp_ring_size;
        struct bnxt_rx_queue *rxq;
        struct rx_pkt_cmpl *rxcmp;
        int rc;
@@ -3139,6 +3146,7 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
        rxq = dev->data->rx_queues[rx_queue_id];
        cpr = rxq->cp_ring;
        raw_cons = cpr->cp_raw_cons;
+       cp_ring_size = cpr->cp_ring_struct->ring_size;
 
        while (1) {
                uint32_t agg_cnt, cons, cmpl_type;
@@ -3146,7 +3154,7 @@ bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
                cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
                rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
 
-               if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
+               if (!bnxt_cpr_cmp_valid(rxcmp, raw_cons, cp_ring_size))
                        break;
 
                cmpl_type = CMP_TYPE(rxcmp);
@@ -3190,7 +3198,7 @@ bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
        struct bnxt_rx_queue *rxq = rx_queue;
        struct bnxt_cp_ring_info *cpr;
        struct bnxt_rx_ring_info *rxr;
-       uint32_t desc, raw_cons;
+       uint32_t desc, raw_cons, cp_ring_size;
        struct bnxt *bp = rxq->bp;
        struct rx_pkt_cmpl *rxcmp;
        int rc;
@@ -3204,6 +3212,7 @@ bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
 
        rxr = rxq->rx_ring;
        cpr = rxq->cp_ring;
+       cp_ring_size = cpr->cp_ring_struct->ring_size;
 
        /*
         * For the vector receive case, the completion at the requested
@@ -3220,7 +3229,7 @@ bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
                cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
                rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
 
-               if (CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
+               if (bnxt_cpr_cmp_valid(rxcmp, raw_cons, cp_ring_size))
                        return RTE_ETH_RX_DESC_DONE;
 
                /* Check whether rx desc has an mbuf attached. */
@@ -3246,7 +3255,7 @@ bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
                cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
                rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
 
-               if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
+               if (!bnxt_cpr_cmp_valid(rxcmp, raw_cons, cp_ring_size))
                        break;
 
                cmpl_type = CMP_TYPE(rxcmp);
@@ -3300,7 +3309,6 @@ bnxt_tx_descriptor_status_op(void *tx_queue, uint16_t offset)
        struct bnxt_tx_queue *txq = (struct bnxt_tx_queue *)tx_queue;
        struct bnxt_cp_ring_info *cpr = txq->cp_ring;
        uint32_t ring_mask, raw_cons, nb_tx_pkts = 0;
-       struct bnxt_ring *cp_ring_struct;
        struct cmpl_base *cp_desc_ring;
        int rc;
 
@@ -3317,7 +3325,6 @@ bnxt_tx_descriptor_status_op(void *tx_queue, uint16_t offset)
 
        raw_cons = cpr->cp_raw_cons;
        cp_desc_ring = cpr->cp_desc_ring;
-       cp_ring_struct = cpr->cp_ring_struct;
        ring_mask = cpr->cp_ring_struct->ring_mask;
 
        /* Check to see if hw has posted a completion for the descriptor. */
@@ -3328,7 +3335,7 @@ bnxt_tx_descriptor_status_op(void *tx_queue, uint16_t offset)
                cons = RING_CMPL(ring_mask, raw_cons);
                txcmp = (struct tx_cmpl *)&cp_desc_ring[cons];
 
-               if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct))
+               if (!bnxt_cpr_cmp_valid(txcmp, raw_cons, ring_mask + 1))
                        break;
 
                if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)
@@ -4995,7 +5002,7 @@ static int bnxt_setup_mac_addr(struct rte_eth_dev *eth_dev)
                PMD_DRV_LOG(INFO, "VF MAC address not assigned by Host PF\n");
                bnxt_eth_hw_addr_random(bp->mac_addr);
                PMD_DRV_LOG(INFO,
-                           "Assign random MAC:%02X:%02X:%02X:%02X:%02X:%02X\n",
+                           "Assign random MAC:" RTE_ETHER_ADDR_PRT_FMT "\n",
                            bp->mac_addr[0], bp->mac_addr[1], bp->mac_addr[2],
                            bp->mac_addr[3], bp->mac_addr[4], bp->mac_addr[5]);