qed: Introduce VFs
[linux-2.6-microblaze.git] / drivers / net / ethernet / qlogic / qed / qed_sp_commands.c
index 7ccd96e..ed90947 100644 (file)
@@ -20,6 +20,7 @@
 #include "qed_int.h"
 #include "qed_reg_addr.h"
 #include "qed_sp.h"
+#include "qed_sriov.h"
 
 int qed_sp_init_request(struct qed_hwfn *p_hwfn,
                        struct qed_spq_entry **pp_ent,
@@ -357,12 +358,27 @@ int qed_sp_pf_start(struct qed_hwfn *p_hwfn,
                                     &p_ramrod->tunnel_config);
        p_hwfn->hw_info.personality = PERSONALITY_ETH;
 
+       if (p_hwfn->cdev->p_iov_info) {
+               struct qed_hw_sriov_info *p_iov = p_hwfn->cdev->p_iov_info;
+
+               p_ramrod->base_vf_id = (u8) p_iov->first_vf_in_pf;
+               p_ramrod->num_vfs = (u8) p_iov->total_vfs;
+       }
+
        DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
                   "Setting event_ring_sb [id %04x index %02x], outer_tag [%d]\n",
                   sb, sb_index,
                   p_ramrod->outer_tag);
 
-       return qed_spq_post(p_hwfn, p_ent, NULL);
+       rc = qed_spq_post(p_hwfn, p_ent, NULL);
+
+       if (p_tunn) {
+               qed_set_hw_tunn_mode(p_hwfn, p_hwfn->p_main_ptt,
+                                    p_tunn->tunn_mode);
+               p_hwfn->cdev->tunn_mode = p_tunn->tunn_mode;
+       }
+
+       return rc;
 }
 
 /* Set pf update ramrod command params */
@@ -428,3 +444,24 @@ int qed_sp_pf_stop(struct qed_hwfn *p_hwfn)
 
        return qed_spq_post(p_hwfn, p_ent, NULL);
 }
+
+int qed_sp_heartbeat_ramrod(struct qed_hwfn *p_hwfn)
+{
+       struct qed_spq_entry *p_ent = NULL;
+       struct qed_sp_init_data init_data;
+       int rc;
+
+       /* Get SPQ entry */
+       memset(&init_data, 0, sizeof(init_data));
+       init_data.cid = qed_spq_get_cid(p_hwfn);
+       init_data.opaque_fid = p_hwfn->hw_info.opaque_fid;
+       init_data.comp_mode = QED_SPQ_MODE_EBLOCK;
+
+       rc = qed_sp_init_request(p_hwfn, &p_ent,
+                                COMMON_RAMROD_EMPTY, PROTOCOLID_COMMON,
+                                &init_data);
+       if (rc)
+               return rc;
+
+       return qed_spq_post(p_hwfn, p_ent, NULL);
+}