Skip to content

Commit f4ca1a2

Browse files
mawilli1Jeff Kirsher
authored andcommitted
i40e: support virtual channel API 1.1
Store off the VF API version for use when figuring out the VF driver capabilities. Add support for the VF driver handing its capabilities to the PF driver and then use this information when sending VF resource information back to the VF driver. Change-ID: Ic00d0eeeb5b8118085e12f068ef857089a8f7c2d Signed-off-by: Mitch Williams <[email protected]> Tested-by: Jim Young <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 17a65a7 commit f4ca1a2

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,12 +1121,13 @@ static int i40e_vc_send_resp_to_vf(struct i40e_vf *vf,
11211121
*
11221122
* called from the VF to request the API version used by the PF
11231123
**/
1124-
static int i40e_vc_get_version_msg(struct i40e_vf *vf)
1124+
static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg)
11251125
{
11261126
struct i40e_virtchnl_version_info info = {
11271127
I40E_VIRTCHNL_VERSION_MAJOR, I40E_VIRTCHNL_VERSION_MINOR
11281128
};
11291129

1130+
vf->vf_ver = *(struct i40e_virtchnl_version_info *)msg;
11301131
return i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
11311132
I40E_SUCCESS, (u8 *)&info,
11321133
sizeof(struct
@@ -1141,7 +1142,7 @@ static int i40e_vc_get_version_msg(struct i40e_vf *vf)
11411142
*
11421143
* called from the VF to request its resources
11431144
**/
1144-
static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf)
1145+
static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
11451146
{
11461147
struct i40e_virtchnl_vf_resource *vfres = NULL;
11471148
struct i40e_pf *pf = vf->pf;
@@ -1165,11 +1166,18 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf)
11651166
len = 0;
11661167
goto err;
11671168
}
1169+
if (VF_IS_V11(vf))
1170+
vf->driver_caps = *(u32 *)msg;
1171+
else
1172+
vf->driver_caps = I40E_VIRTCHNL_VF_OFFLOAD_L2 |
1173+
I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG |
1174+
I40E_VIRTCHNL_VF_OFFLOAD_VLAN;
11681175

11691176
vfres->vf_offload_flags = I40E_VIRTCHNL_VF_OFFLOAD_L2;
11701177
vsi = pf->vsi[vf->lan_vsi_idx];
11711178
if (!vsi->info.pvid)
1172-
vfres->vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_VLAN;
1179+
vfres->vf_offload_flags |= I40E_VIRTCHNL_VF_OFFLOAD_VLAN |
1180+
I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG;
11731181

11741182
vfres->num_vsis = num_vsis;
11751183
vfres->num_queue_pairs = vf->num_queue_pairs;
@@ -1771,9 +1779,14 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,
17711779
valid_len = sizeof(struct i40e_virtchnl_version_info);
17721780
break;
17731781
case I40E_VIRTCHNL_OP_RESET_VF:
1774-
case I40E_VIRTCHNL_OP_GET_VF_RESOURCES:
17751782
valid_len = 0;
17761783
break;
1784+
case I40E_VIRTCHNL_OP_GET_VF_RESOURCES:
1785+
if (VF_IS_V11(vf))
1786+
valid_len = sizeof(u32);
1787+
else
1788+
valid_len = 0;
1789+
break;
17771790
case I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE:
17781791
valid_len = sizeof(struct i40e_virtchnl_txq_info);
17791792
break;
@@ -1886,10 +1899,10 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, u16 vf_id, u32 v_opcode,
18861899

18871900
switch (v_opcode) {
18881901
case I40E_VIRTCHNL_OP_VERSION:
1889-
ret = i40e_vc_get_version_msg(vf);
1902+
ret = i40e_vc_get_version_msg(vf, msg);
18901903
break;
18911904
case I40E_VIRTCHNL_OP_GET_VF_RESOURCES:
1892-
ret = i40e_vc_get_vf_resources_msg(vf);
1905+
ret = i40e_vc_get_vf_resources_msg(vf, msg);
18931906
break;
18941907
case I40E_VIRTCHNL_OP_RESET_VF:
18951908
i40e_vc_reset_vf_msg(vf);

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ struct i40e_vf {
7878
u16 vf_id;
7979
/* all VF vsis connect to the same parent */
8080
enum i40e_switch_element_types parent_type;
81+
struct i40e_virtchnl_version_info vf_ver;
82+
u32 driver_caps; /* reported by VF driver */
8183

8284
/* VF Port Extender (PE) stag if used */
8385
u16 stag;

0 commit comments

Comments
 (0)