net/qede/base: improve set field macro
[dpdk.git] / drivers / net / qede / base / ecore_sriov.c
index eb3a1e2..c2fbee8 100644 (file)
@@ -317,10 +317,9 @@ static enum _ecore_status_t ecore_iov_pci_cfg_info(struct ecore_dev *p_dev)
 
        OSAL_PCI_READ_CONFIG_BYTE(p_dev, pos + PCI_SRIOV_FUNC_LINK, &iov->link);
 
-       DP_VERBOSE(p_dev, ECORE_MSG_IOV, "IOV info[%d]: nres %d, cap 0x%x,"
+       DP_VERBOSE(p_dev, ECORE_MSG_IOV, "IOV info: nres %d, cap 0x%x,"
                   "ctrl 0x%x, total %d, initial %d, num vfs %d, offset %d,"
-                  " stride %d, page size 0x%x\n", 0,
-                  /* @@@TBD MichalK - function id */
+                  " stride %d, page size 0x%x\n",
                   iov->nres, iov->cap, iov->ctrl,
                   iov->total_vfs, iov->initial_vfs, iov->nr_virtfn,
                   iov->offset, iov->stride, iov->pgsz);
@@ -1460,6 +1459,18 @@ static void ecore_iov_vf_mbx_acquire(struct ecore_hwfn       *p_hwfn,
        pfdev_info->major_fp_hsi = ETH_HSI_VER_MAJOR;
        pfdev_info->minor_fp_hsi = ETH_HSI_VER_MINOR;
 
+       /* TODO - not doing anything is bad since we'll assert, but this isn't
+        * necessarily the right behavior - perhaps we should have allowed some
+        * versatility here.
+        */
+       if (vf->state != VF_FREE &&
+           vf->state != VF_STOPPED) {
+               DP_VERBOSE(p_hwfn, ECORE_MSG_IOV,
+                          "VF[%d] sent ACQUIRE but is already in state %d - fail request\n",
+                          vf->abs_vf_id, vf->state);
+               goto out;
+       }
+
        /* Validate FW compatibility */
        if (req->vfdev_info.eth_fp_hsi_major != ETH_HSI_VER_MAJOR) {
                if (req->vfdev_info.capabilities &
@@ -1575,12 +1586,12 @@ static void ecore_iov_vf_mbx_acquire(struct ecore_hwfn       *p_hwfn,
                   "VF[%d] ACQUIRE_RESPONSE: pfdev_info- chip_num=0x%x,"
                   " db_size=%d, idx_per_sb=%d, pf_cap=0x%lx\n"
                   "resources- n_rxq-%d, n_txq-%d, n_sbs-%d, n_macs-%d,"
-                  " n_vlans-%d, n_mcs-%d\n",
+                  " n_vlans-%d\n",
                   vf->abs_vf_id, resp->pfdev_info.chip_num,
                   resp->pfdev_info.db_size, resp->pfdev_info.indices_per_sb,
                   (unsigned long)resp->pfdev_info.capabilities, resc->num_rxqs,
                   resc->num_txqs, resc->num_sbs, resc->num_mac_filters,
-                  resc->num_vlan_filters, resc->num_mc_filters);
+                  resc->num_vlan_filters);
 
        vf->state = VF_ACQUIRED;
 
@@ -1961,6 +1972,7 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn,
                                       struct ecore_ptt *p_ptt,
                                       struct ecore_vf_info *vf)
 {
+       struct ecore_queue_start_common_params p_params;
        struct ecore_iov_vf_mbx *mbx = &vf->vf_mbx;
        u8 status = PFVF_STATUS_NO_RESOURCE;
        struct vfpf_start_rxq_tlv *req;
@@ -1973,6 +1985,14 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn,
            !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb))
                goto out;
 
+       OSAL_MEMSET(&p_params, 0, sizeof(p_params));
+       p_params.queue_id = (u8)vf->vf_queues[req->rx_qid].fw_rx_qid;
+       p_params.vf_qid = req->rx_qid;
+       p_params.vport_id = vf->vport_id;
+       p_params.stats_id = vf->abs_vf_id + 0x10,
+       p_params.sb = req->hw_sb;
+       p_params.sb_idx = req->sb_index;
+
        /* Legacy VFs have their Producers in a different location, which they
         * calculate on their own and clean the producer prior to this.
         */
@@ -1987,12 +2007,7 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn,
 
        rc = ecore_sp_eth_rxq_start_ramrod(p_hwfn, vf->opaque_fid,
                                           vf->vf_queues[req->rx_qid].fw_cid,
-                                          vf->vf_queues[req->rx_qid].fw_rx_qid,
-                                          (u8)req->rx_qid,
-                                          vf->vport_id,
-                                          vf->abs_vf_id + 0x10,
-                                          req->hw_sb,
-                                          req->sb_index,
+                                          &p_params,
                                           req->bd_max_bytes,
                                           req->rxq_addr,
                                           req->cqe_pbl_addr,
@@ -2057,6 +2072,7 @@ static void ecore_iov_vf_mbx_start_txq(struct ecore_hwfn *p_hwfn,
                                       struct ecore_ptt *p_ptt,
                                       struct ecore_vf_info *vf)
 {
+       struct ecore_queue_start_common_params p_params;
        struct ecore_iov_vf_mbx *mbx = &vf->vf_mbx;
        u8 status = PFVF_STATUS_NO_RESOURCE;
        union ecore_qm_pq_params pq_params;
@@ -2069,6 +2085,12 @@ static void ecore_iov_vf_mbx_start_txq(struct ecore_hwfn *p_hwfn,
        pq_params.eth.vf_id = vf->relative_vf_id;
 
        req = &mbx->req_virt->start_txq;
+       OSAL_MEMSET(&p_params, 0, sizeof(p_params));
+       p_params.queue_id = (u8)vf->vf_queues[req->tx_qid].fw_tx_qid;
+       p_params.vport_id = vf->vport_id;
+       p_params.stats_id = vf->abs_vf_id + 0x10,
+       p_params.sb = req->hw_sb;
+       p_params.sb_idx = req->sb_index;
 
        if (!ecore_iov_validate_txq(p_hwfn, vf, req->tx_qid) ||
            !ecore_iov_validate_sb(p_hwfn, vf, req->hw_sb))
@@ -2077,12 +2099,8 @@ static void ecore_iov_vf_mbx_start_txq(struct ecore_hwfn *p_hwfn,
        rc = ecore_sp_eth_txq_start_ramrod(
                p_hwfn,
                vf->opaque_fid,
-               vf->vf_queues[req->tx_qid].fw_tx_qid,
                vf->vf_queues[req->tx_qid].fw_cid,
-               vf->vport_id,
-               vf->abs_vf_id + 0x10,
-               req->hw_sb,
-               req->sb_index,
+               &p_params,
                req->pbl_addr,
                req->pbl_size,
                &pq_params);