From: Haiyue Wang <haiyue.wang@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH v1 3/5] ice: support to get the VSI mapping
Date: Fri, 19 Jun 2020 12:57:09 +0800 [thread overview]
Message-ID: <20200619045711.16055-4-haiyue.wang@intel.com> (raw)
In-Reply-To: <20200619045711.16055-1-haiyue.wang@intel.com>
The DCF needs the mapping information of the VF ID to logical hardware
VSI ID, so that it can create the switch flow rules for other VFs.
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
.../net/ethernet/intel/ice/ice_virtchnl_pf.c | 61 +++++++++++++++++++
include/linux/avf/virtchnl.h | 21 +++++++
2 files changed, 82 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index 622b16efae0b..2584c3f199e3 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -3848,6 +3848,64 @@ static int ice_vc_dis_dcf_cap(struct ice_vf *vf)
v_ret, NULL, 0);
}
+/**
+ * ice_vc_dcf_get_vsi_map - get VSI mapping table
+ * @vf: pointer to the VF info
+ */
+static int ice_vc_dcf_get_vsi_map(struct ice_vf *vf)
+{
+ enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;
+ struct virtchnl_dcf_vsi_map *vsi_map = NULL;
+ struct ice_pf *pf = vf->pf;
+ struct ice_vsi *pf_vsi;
+ u16 len = 0;
+ int vf_id;
+ int ret;
+
+ if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) {
+ v_ret = VIRTCHNL_STATUS_ERR_PARAM;
+ goto err;
+ }
+
+ if (!ice_is_vf_dcf(vf) || ice_dcf_get_state(pf) != ICE_DCF_STATE_ON) {
+ v_ret = VIRTCHNL_STATUS_ERR_PARAM;
+ goto err;
+ }
+
+ len = struct_size(vsi_map, vf_vsi, pf->num_alloc_vfs - 1);
+ vsi_map = kzalloc(len, GFP_KERNEL);
+ if (!vsi_map) {
+ v_ret = VIRTCHNL_STATUS_ERR_NO_MEMORY;
+ len = 0;
+ goto err;
+ }
+
+ pf_vsi = ice_get_main_vsi(pf);
+ if (!pf_vsi) {
+ v_ret = VIRTCHNL_STATUS_ERR_PARAM;
+ len = 0;
+ goto err;
+ }
+
+ vsi_map->pf_vsi = pf_vsi->vsi_num;
+ vsi_map->num_vfs = pf->num_alloc_vfs;
+
+ ice_for_each_vf(pf, vf_id) {
+ struct ice_vf *tmp_vf = &pf->vf[vf_id];
+
+ if (!ice_is_vf_disabled(tmp_vf) &&
+ test_bit(ICE_VF_STATE_INIT, tmp_vf->vf_states))
+ vsi_map->vf_vsi[vf_id] = tmp_vf->lan_vsi_num |
+ VIRTCHNL_DCF_VF_VSI_VALID;
+ }
+
+err:
+ ret = ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_DCF_GET_VSI_MAP, v_ret,
+ (u8 *)vsi_map, len);
+ kfree(vsi_map);
+ return ret;
+}
+
/**
* ice_vc_process_vf_msg - Process request from VF
* @pf: pointer to the PF structure
@@ -3967,6 +4025,9 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event)
case VIRTCHNL_OP_DCF_DISABLE:
err = ice_vc_dis_dcf_cap(vf);
break;
+ case VIRTCHNL_OP_DCF_GET_VSI_MAP:
+ err = ice_vc_dcf_get_vsi_map(vf);
+ break;
case VIRTCHNL_OP_UNKNOWN:
default:
dev_err(dev, "Unsupported opcode %d from VF %d\n", v_opcode,
diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h
index e219cafabccd..ef07cff40662 100644
--- a/include/linux/avf/virtchnl.h
+++ b/include/linux/avf/virtchnl.h
@@ -140,6 +140,7 @@ enum virtchnl_ops {
VIRTCHNL_OP_DCF_CMD_DESC = 39,
VIRTCHNL_OP_DCF_CMD_BUFF = 40,
VIRTCHNL_OP_DCF_DISABLE = 41,
+ VIRTCHNL_OP_DCF_GET_VSI_MAP = 42,
/* New major set of opcodes introduced and so leaving room for
* old misc opcodes to be added in future. Also these opcodes may only
* be used if both the PF and VF have successfully negotiated the
@@ -627,6 +628,25 @@ struct virtchnl_filter {
VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
+/* VIRTCHNL_OP_DCF_GET_VSI_MAP
+ * VF sends this message to get VSI mapping table.
+ * PF responds with an indirect message containing VF's
+ * HW VSI IDs.
+ * The index of vf_vsi array is the logical VF ID, the
+ * value of vf_vsi array is the VF's HW VSI ID with its
+ * valid configuration.
+ */
+struct virtchnl_dcf_vsi_map {
+ u16 pf_vsi; /* PF's HW VSI ID */
+ u16 num_vfs; /* The actual number of VFs allocated */
+#define VIRTCHNL_DCF_VF_VSI_ID_S 0
+#define VIRTCHNL_DCF_VF_VSI_ID_M (0xFFF << VIRTCHNL_DCF_VF_VSI_ID_S)
+#define VIRTCHNL_DCF_VF_VSI_VALID BIT(15)
+ u16 vf_vsi[1];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_dcf_vsi_map);
+
/* VIRTCHNL_OP_EVENT
* PF sends this message to inform the VF driver of events that may affect it.
* No direct response is expected from the VF, though it may generate other
@@ -1280,6 +1300,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
valid_len = msglen;
break;
case VIRTCHNL_OP_DCF_DISABLE:
+ case VIRTCHNL_OP_DCF_GET_VSI_MAP:
break;
case VIRTCHNL_OP_GET_CAPS:
valid_len = sizeof(struct virtchnl_get_capabilities);
--
2.27.0
next prev parent reply other threads:[~2020-06-19 4:57 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 4:57 [Intel-wired-lan] [PATCH v1 0/5] ice: add Intel DCF mode support Haiyue Wang
2020-06-19 4:57 ` [Intel-wired-lan] [PATCH v1 1/5] ice: add the virtchnl handler for AdminQ command Haiyue Wang
2020-06-19 4:57 ` [Intel-wired-lan] [PATCH v1 2/5] ice: add DCF cap negotiation and state machine Haiyue Wang
2020-06-19 4:57 ` Haiyue Wang [this message]
2020-06-19 4:57 ` [Intel-wired-lan] [PATCH v1 4/5] ice: enable DDP package info querying Haiyue Wang
2020-06-19 4:57 ` [Intel-wired-lan] [PATCH v1 5/5] ice: add switch rule management for DCF Haiyue Wang
2020-06-19 17:10 ` [Intel-wired-lan] [PATCH v2 0/5] ice: add Intel DCF mode support Haiyue Wang
2020-06-19 17:10 ` [Intel-wired-lan] [PATCH v2 1/5] ice: add the virtchnl handler for AdminQ command Haiyue Wang
2020-06-22 20:05 ` Bowers, AndrewX
2020-06-19 17:10 ` [Intel-wired-lan] [PATCH v2 2/5] ice: add DCF cap negotiation and state machine Haiyue Wang
2020-06-22 20:11 ` Bowers, AndrewX
2020-06-19 17:10 ` [Intel-wired-lan] [PATCH v2 3/5] ice: support to get the VSI mapping Haiyue Wang
2020-06-22 20:12 ` Bowers, AndrewX
2020-06-19 17:10 ` [Intel-wired-lan] [PATCH v2 4/5] ice: enable DDP package info querying Haiyue Wang
2020-06-22 20:12 ` Bowers, AndrewX
2020-06-19 17:10 ` [Intel-wired-lan] [PATCH v2 5/5] ice: add switch rule management for DCF Haiyue Wang
2020-06-22 20:13 ` Bowers, AndrewX
2020-06-24 2:07 ` [Intel-wired-lan] [PATCH v3 0/5] ice: add Intel DCF mode support Haiyue Wang
2020-06-24 2:07 ` [Intel-wired-lan] [PATCH v3 1/5] ice: add the virtchnl handler for AdminQ command Haiyue Wang
2020-06-24 5:40 ` Lu, Nannan
2020-06-24 7:29 ` Lu, Nannan
2020-06-24 2:07 ` [Intel-wired-lan] [PATCH v3 2/5] ice: add DCF cap negotiation and state machine Haiyue Wang
2020-06-24 2:07 ` [Intel-wired-lan] [PATCH v3 3/5] ice: support to get the VSI mapping Haiyue Wang
2020-06-24 2:08 ` [Intel-wired-lan] [PATCH v3 4/5] ice: enable DDP package info querying Haiyue Wang
2020-06-24 7:30 ` Lu, Nannan
2020-06-24 7:30 ` Lu, Nannan
2020-06-24 2:08 ` [Intel-wired-lan] [PATCH v3 5/5] ice: add switch rule management for DCF Haiyue Wang
2020-06-24 5:18 ` [Intel-wired-lan] [PATCH v3 0/5] ice: add Intel DCF mode support Lu, Nannan
2020-06-24 7:29 ` [Intel-wired-lan] [PATCH v4 " Haiyue Wang
2020-06-24 7:29 ` [Intel-wired-lan] [PATCH v4 1/5] ice: add the virtchnl handler for AdminQ command Haiyue Wang
2020-06-24 7:45 ` Lu, Nannan
2020-06-24 7:29 ` [Intel-wired-lan] [PATCH v4 2/5] ice: add DCF cap negotiation and state machine Haiyue Wang
2020-06-24 7:46 ` Lu, Nannan
2020-06-24 7:29 ` [Intel-wired-lan] [PATCH v4 3/5] ice: support to get the VSI mapping Haiyue Wang
2020-06-24 7:47 ` Lu, Nannan
2020-06-24 7:29 ` [Intel-wired-lan] [PATCH v4 4/5] ice: enable DDP package info querying Haiyue Wang
2020-06-24 7:47 ` Lu, Nannan
2020-06-24 7:29 ` [Intel-wired-lan] [PATCH v4 5/5] ice: add switch rule management for DCF Haiyue Wang
2020-06-24 7:47 ` Lu, Nannan
2020-06-26 8:16 ` [Intel-wired-lan] [net-next, v5 0/5] ice: add Intel DCF mode support Haiyue Wang
2020-06-26 8:16 ` [Intel-wired-lan] [net-next, v5 1/5] ice: add the virtchnl handler for AdminQ command Haiyue Wang
2020-06-26 8:16 ` [Intel-wired-lan] [net-next, v5 2/5] ice: add DCF cap negotiation and state machine Haiyue Wang
2020-06-26 8:16 ` [Intel-wired-lan] [net-next, v5 3/5] ice: support to get the VSI mapping Haiyue Wang
2020-06-26 8:16 ` [Intel-wired-lan] [net-next, v5 4/5] ice: enable DDP package info querying Haiyue Wang
2020-06-26 8:16 ` [Intel-wired-lan] [net-next, v5 5/5] ice: add switch rule management for DCF Haiyue Wang
2020-06-30 1:59 ` [Intel-wired-lan] [net-next, v6 0/5] ice: add Intel DCF mode support Haiyue Wang
2020-06-30 1:59 ` [Intel-wired-lan] [net-next, v6 1/5] ice: add the virtchnl handler for AdminQ command Haiyue Wang
2020-06-30 1:59 ` [Intel-wired-lan] [net-next, v6 2/5] ice: add DCF cap negotiation and state machine Haiyue Wang
2020-06-30 1:59 ` [Intel-wired-lan] [net-next, v6 3/5] ice: support to get the VSI mapping Haiyue Wang
2020-06-30 1:59 ` [Intel-wired-lan] [net-next, v6 4/5] ice: enable DDP package info querying Haiyue Wang
2020-06-30 1:59 ` [Intel-wired-lan] [net-next, v6 5/5] ice: add switch rule management for DCF Haiyue Wang
2020-07-01 1:25 ` [Intel-wired-lan] [net-next, v7 0/5] ice: add Intel DCF mode support Haiyue Wang
2020-07-01 1:25 ` [Intel-wired-lan] [net-next, v7 1/5] ice: add the virtchnl handler for AdminQ command Haiyue Wang
2020-07-01 16:46 ` Bowers, AndrewX
2020-07-01 1:25 ` [Intel-wired-lan] [net-next, v7 2/5] ice: add DCF cap negotiation and state machine Haiyue Wang
2020-07-01 16:46 ` Bowers, AndrewX
2020-07-01 1:25 ` [Intel-wired-lan] [net-next, v7 3/5] ice: support to get the VSI mapping Haiyue Wang
2020-07-01 16:47 ` Bowers, AndrewX
2020-07-01 1:25 ` [Intel-wired-lan] [net-next, v7 4/5] ice: enable DDP package info querying Haiyue Wang
2020-07-01 16:48 ` Bowers, AndrewX
2020-07-01 1:25 ` [Intel-wired-lan] [net-next, v7 5/5] ice: add switch rule management for DCF Haiyue Wang
2020-07-01 16:48 ` Bowers, AndrewX
2020-07-08 22:55 ` Nguyen, Anthony L
2020-07-08 23:48 ` Jakub Kicinski
2020-07-10 1:54 ` [Intel-wired-lan] [net-next, v8 0/5] ice: add Intel DCF mode support Haiyue Wang
2020-07-10 1:54 ` [Intel-wired-lan] [net-next, v8 1/5] ice: add the virtchnl handler for AdminQ command Haiyue Wang
2020-07-10 3:16 ` Lu, Nannan
2020-07-10 19:22 ` Bowers, AndrewX
2020-07-10 1:54 ` [Intel-wired-lan] [net-next, v8 2/5] ice: add DCF cap negotiation and state machine Haiyue Wang
2020-07-10 3:17 ` Lu, Nannan
2020-07-10 19:22 ` Bowers, AndrewX
2020-07-10 1:54 ` [Intel-wired-lan] [net-next, v8 3/5] ice: support to get the VSI mapping Haiyue Wang
2020-07-10 3:17 ` Lu, Nannan
2020-07-10 19:22 ` Bowers, AndrewX
2020-07-10 1:54 ` [Intel-wired-lan] [net-next, v8 4/5] ice: enable DDP package info querying Haiyue Wang
2020-07-10 3:18 ` Lu, Nannan
2020-07-10 19:23 ` Bowers, AndrewX
2020-07-10 1:54 ` [Intel-wired-lan] [net-next, v8 5/5] ice: add switch rule management for DCF Haiyue Wang
2020-07-10 3:19 ` Lu, Nannan
2020-07-10 19:23 ` Bowers, AndrewX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200619045711.16055-4-haiyue.wang@intel.com \
--to=haiyue.wang@intel.com \
--cc=intel-wired-lan@osuosl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox