Skip to content

Commit e753df8

Browse files
michalx-jaronPaolo Abeni
authored andcommitted
ice: Add support Flex RXD
Add new VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC flag, opcode VIRTCHNL_OP_GET_SUPPORTED_RXDIDS and add member rxdid in struct virtchnl_rxq_info to support AVF Flex RXD extension. Add support to allow VF to query flexible descriptor RXDIDs supported by DDP package and configure Rx queues with selected RXDID for IAVF. Add code to allow VIRTCHNL_OP_GET_SUPPORTED_RXDIDS message to be processed. Add necessary macros for registers. Signed-off-by: Leyi Rong <[email protected]> Signed-off-by: Xu Ting <[email protected]> Signed-off-by: Michal Jaron <[email protected]> Signed-off-by: Mateusz Palczewski <[email protected]> Tested-by: Maxime Coquelin <[email protected]> Tested-by: Konrad Jankowski <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 3a1cc23 commit e753df8

File tree

6 files changed

+111
-2
lines changed

6 files changed

+111
-2
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,8 @@ struct ice_pf {
609609
u16 num_dmac_chnl_fltrs;
610610
struct hlist_head tc_flower_fltr_list;
611611

612+
u64 supported_rxdids;
613+
612614
__le64 nvm_phy_type_lo; /* NVM PHY type low */
613615
__le64 nvm_phy_type_hi; /* NVM PHY type high */
614616
struct ice_link_default_override_tlv link_dflt_override;

drivers/net/ethernet/intel/ice/ice_hw_autogen.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@
110110
#define PRTDCB_TUP2TC 0x001D26C0
111111
#define GL_PREEXT_L2_PMASK0(_i) (0x0020F0FC + ((_i) * 4))
112112
#define GL_PREEXT_L2_PMASK1(_i) (0x0020F108 + ((_i) * 4))
113+
#define GLFLXP_RXDID_FLAGS(_i, _j) (0x0045D000 + ((_i) * 4 + (_j) * 256))
114+
#define GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_S 0
115+
#define GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_M ICE_M(0x3F, 0)
113116
#define GLFLXP_RXDID_FLX_WRD_0(_i) (0x0045c800 + ((_i) * 4))
114117
#define GLFLXP_RXDID_FLX_WRD_0_PROT_MDID_S 0
115118
#define GLFLXP_RXDID_FLX_WRD_0_PROT_MDID_M ICE_M(0xFF, 0)

drivers/net/ethernet/intel/ice/ice_virtchnl.c

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)
462462
vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_RSS_REG;
463463
}
464464

465+
if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
466+
vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC;
467+
465468
if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_FDIR_PF)
466469
vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_FDIR_PF;
467470

@@ -1618,6 +1621,9 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16181621
}
16191622

16201623
for (i = 0; i < qci->num_queue_pairs; i++) {
1624+
struct ice_hw *hw;
1625+
u32 rxdid;
1626+
u16 pf_q;
16211627
qpi = &qci->qpair[i];
16221628
if (qpi->txq.vsi_id != qci->vsi_id ||
16231629
qpi->rxq.vsi_id != qci->vsi_id ||
@@ -1686,6 +1692,25 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16861692
goto error_param;
16871693
}
16881694
}
1695+
1696+
/* VF Rx queue RXDID configuration */
1697+
pf_q = vsi->rxq_map[qpi->rxq.queue_id];
1698+
rxdid = qpi->rxq.rxdid;
1699+
hw = &vsi->back->hw;
1700+
1701+
/* If Rx flex desc is supported, select RXDID for Rx queues.
1702+
* Otherwise, use legacy 32byte descriptor format.
1703+
* Legacy 16byte descriptor is not supported. If this RXDID
1704+
* is selected, return error.
1705+
*/
1706+
if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) {
1707+
if (!(BIT(rxdid) & pf->supported_rxdids))
1708+
goto error_param;
1709+
} else {
1710+
rxdid = ICE_RXDID_LEGACY_1;
1711+
}
1712+
1713+
ice_write_qrxflxp_cntxt(hw, pf_q, rxdid, 0x03, false);
16891714
}
16901715

16911716
/* send the response to the VF */
@@ -2456,6 +2481,62 @@ static int ice_vc_dis_vlan_stripping(struct ice_vf *vf)
24562481
v_ret, NULL, 0);
24572482
}
24582483

2484+
/**
2485+
* ice_vc_query_rxdid - query RXDID supported by DDP package
2486+
* @vf: pointer to VF info
2487+
*
2488+
* Called from VF to query a bitmap of supported flexible
2489+
* descriptor RXDIDs of a DDP package.
2490+
*/
2491+
static int ice_vc_query_rxdid(struct ice_vf *vf)
2492+
{
2493+
enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;
2494+
struct virtchnl_supported_rxdids *rxdid = NULL;
2495+
struct ice_hw *hw = &vf->pf->hw;
2496+
struct ice_pf *pf = vf->pf;
2497+
int len = 0;
2498+
int ret, i;
2499+
u32 regval;
2500+
2501+
if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) {
2502+
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
2503+
goto err;
2504+
}
2505+
2506+
if (!(vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)) {
2507+
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
2508+
goto err;
2509+
}
2510+
2511+
len = sizeof(struct virtchnl_supported_rxdids);
2512+
rxdid = kzalloc(len, GFP_KERNEL);
2513+
if (!rxdid) {
2514+
v_ret = VIRTCHNL_STATUS_ERR_NO_MEMORY;
2515+
len = 0;
2516+
goto err;
2517+
}
2518+
2519+
/* Read flexiflag registers to determine whether the
2520+
* corresponding RXDID is configured and supported or not.
2521+
* Since Legacy 16byte descriptor format is not supported,
2522+
* start from Legacy 32byte descriptor.
2523+
*/
2524+
for (i = ICE_RXDID_LEGACY_1; i < ICE_FLEX_DESC_RXDID_MAX_NUM; i++) {
2525+
regval = rd32(hw, GLFLXP_RXDID_FLAGS(i, 0));
2526+
if ((regval >> GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_S)
2527+
& GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_M)
2528+
rxdid->supported_rxdids |= BIT(i);
2529+
}
2530+
2531+
pf->supported_rxdids = rxdid->supported_rxdids;
2532+
2533+
err:
2534+
ret = ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
2535+
v_ret, (u8 *)rxdid, len);
2536+
kfree(rxdid);
2537+
return ret;
2538+
}
2539+
24592540
/**
24602541
* ice_vf_init_vlan_stripping - enable/disable VLAN stripping on initialization
24612542
* @vf: VF to enable/disable VLAN stripping for on initialization
@@ -3490,6 +3571,7 @@ static const struct ice_virtchnl_ops ice_virtchnl_dflt_ops = {
34903571
.cfg_promiscuous_mode_msg = ice_vc_cfg_promiscuous_mode_msg,
34913572
.add_vlan_msg = ice_vc_add_vlan_msg,
34923573
.remove_vlan_msg = ice_vc_remove_vlan_msg,
3574+
.query_rxdid = ice_vc_query_rxdid,
34933575
.ena_vlan_stripping = ice_vc_ena_vlan_stripping,
34943576
.dis_vlan_stripping = ice_vc_dis_vlan_stripping,
34953577
.handle_rss_cfg_msg = ice_vc_handle_rss_cfg,
@@ -3624,6 +3706,7 @@ static const struct ice_virtchnl_ops ice_virtchnl_repr_ops = {
36243706
.cfg_promiscuous_mode_msg = ice_vc_repr_cfg_promiscuous_mode,
36253707
.add_vlan_msg = ice_vc_add_vlan_msg,
36263708
.remove_vlan_msg = ice_vc_remove_vlan_msg,
3709+
.query_rxdid = ice_vc_query_rxdid,
36273710
.ena_vlan_stripping = ice_vc_ena_vlan_stripping,
36283711
.dis_vlan_stripping = ice_vc_dis_vlan_stripping,
36293712
.handle_rss_cfg_msg = ice_vc_handle_rss_cfg,
@@ -3764,6 +3847,9 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event)
37643847
case VIRTCHNL_OP_DEL_VLAN:
37653848
err = ops->remove_vlan_msg(vf, msg);
37663849
break;
3850+
case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
3851+
err = ops->query_rxdid(vf);
3852+
break;
37673853
case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
37683854
err = ops->ena_vlan_stripping(vf);
37693855
break;

drivers/net/ethernet/intel/ice/ice_virtchnl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* broadcast, and 16 for additional unicast/multicast filters
1818
*/
1919
#define ICE_MAX_MACADDR_PER_VF 18
20+
#define ICE_FLEX_DESC_RXDID_MAX_NUM 64
2021

2122
struct ice_virtchnl_ops {
2223
int (*get_ver_msg)(struct ice_vf *vf, u8 *msg);
@@ -35,6 +36,7 @@ struct ice_virtchnl_ops {
3536
int (*cfg_promiscuous_mode_msg)(struct ice_vf *vf, u8 *msg);
3637
int (*add_vlan_msg)(struct ice_vf *vf, u8 *msg);
3738
int (*remove_vlan_msg)(struct ice_vf *vf, u8 *msg);
39+
int (*query_rxdid)(struct ice_vf *vf);
3840
int (*ena_vlan_stripping)(struct ice_vf *vf);
3941
int (*dis_vlan_stripping)(struct ice_vf *vf);
4042
int (*handle_rss_cfg_msg)(struct ice_vf *vf, u8 *msg, bool add);

drivers/net/ethernet/intel/ice/ice_virtchnl_allowlist.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ static const u32 rss_pf_allowlist_opcodes[] = {
7070
VIRTCHNL_OP_GET_RSS_HENA_CAPS, VIRTCHNL_OP_SET_RSS_HENA,
7171
};
7272

73+
/* VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC */
74+
static const u32 rx_flex_desc_allowlist_opcodes[] = {
75+
VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
76+
};
77+
7378
/* VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF */
7479
static const u32 adv_rss_pf_allowlist_opcodes[] = {
7580
VIRTCHNL_OP_ADD_RSS_CFG, VIRTCHNL_OP_DEL_RSS_CFG,
@@ -96,6 +101,7 @@ static const struct allowlist_opcode_info allowlist_opcodes[] = {
96101
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_REQ_QUEUES, req_queues_allowlist_opcodes),
97102
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_VLAN, vlan_allowlist_opcodes),
98103
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_RSS_PF, rss_pf_allowlist_opcodes),
104+
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC, rx_flex_desc_allowlist_opcodes),
99105
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF, adv_rss_pf_allowlist_opcodes),
100106
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_FDIR_PF, fdir_pf_allowlist_opcodes),
101107
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_VLAN_V2, vlan_v2_allowlist_opcodes),

include/linux/avf/virtchnl.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ enum virtchnl_ops {
136136
VIRTCHNL_OP_DISABLE_CHANNELS = 31,
137137
VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
138138
VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
139-
/* opcode 34 - 44 are reserved */
139+
/* opcode 34 - 43 are reserved */
140+
VIRTCHNL_OP_GET_SUPPORTED_RXDIDS = 44,
140141
VIRTCHNL_OP_ADD_RSS_CFG = 45,
141142
VIRTCHNL_OP_DEL_RSS_CFG = 46,
142143
VIRTCHNL_OP_ADD_FDIR_FILTER = 47,
@@ -263,6 +264,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
263264
#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM BIT(22)
264265
#define VIRTCHNL_VF_OFFLOAD_ADQ BIT(23)
265266
#define VIRTCHNL_VF_OFFLOAD_USO BIT(25)
267+
#define VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC BIT(26)
266268
#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF BIT(27)
267269
#define VIRTCHNL_VF_OFFLOAD_FDIR_PF BIT(28)
268270

@@ -318,7 +320,9 @@ struct virtchnl_rxq_info {
318320
u16 splithdr_enabled; /* deprecated with AVF 1.0 */
319321
u32 databuffer_size;
320322
u32 max_pkt_size;
321-
u32 pad1;
323+
u8 pad0;
324+
u8 rxdid;
325+
u8 pad1[2];
322326
u64 dma_ring_addr;
323327
enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
324328
u32 pad2;
@@ -970,6 +974,10 @@ struct virtchnl_filter {
970974

971975
VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
972976

977+
struct virtchnl_supported_rxdids {
978+
u64 supported_rxdids;
979+
};
980+
973981
/* VIRTCHNL_OP_EVENT
974982
* PF sends this message to inform the VF driver of events that may affect it.
975983
* No direct response is expected from the VF, though it may generate other
@@ -1499,6 +1507,8 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
14991507
case VIRTCHNL_OP_DEL_CLOUD_FILTER:
15001508
valid_len = sizeof(struct virtchnl_filter);
15011509
break;
1510+
case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
1511+
break;
15021512
case VIRTCHNL_OP_ADD_RSS_CFG:
15031513
case VIRTCHNL_OP_DEL_RSS_CFG:
15041514
valid_len = sizeof(struct virtchnl_rss_cfg);

0 commit comments

Comments
 (0)