History

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.

Michal Jaron committed 4 years ago

Commit e753df81 parent 3a1cc236 files · +111 −2Browse files

Unified · Split

6 files
  1. drivers/net/ethernet/intel/ice/ice.h +2 −0
  2. drivers/net/ethernet/intel/ice/ice_hw_autogen.h +3 −0
  3. drivers/net/ethernet/intel/ice/ice_virtchnl.c +86 −0
  4. drivers/net/ethernet/intel/ice/ice_virtchnl.h +2 −0
  5. drivers/net/ethernet/intel/ice/ice_virtchnl_allowlist.c +6 −0
  6. include/linux/avf/virtchnl.h +12 −2
drivers/net/ethernet/intel/ice/ice.h+2−0
@@ -609,6 +609,8 @@ struct ice_pf { · 608 unmodified lines
609 u16 num_dmac_chnl_fltrs;609 u16 num_dmac_chnl_fltrs;
610 struct hlist_head tc_flower_fltr_list;610 struct hlist_head tc_flower_fltr_list;
611 611
612 u64 supported_rxdids;
613
612 __le64 nvm_phy_type_lo; /* NVM PHY type low */614 __le64 nvm_phy_type_lo; /* NVM PHY type low */
613 __le64 nvm_phy_type_hi; /* NVM PHY type high */615 __le64 nvm_phy_type_hi; /* NVM PHY type high */
614 struct ice_link_default_override_tlv link_dflt_override;616 struct ice_link_default_override_tlv link_dflt_override;
drivers/net/ethernet/intel/ice/ice_hw_autogen.h+3−0
@@ -110,6 +110,9 @@ · 109 unmodified lines
110#define PRTDCB_TUP2TC 0x001D26C0110#define PRTDCB_TUP2TC 0x001D26C0
111#define GL_PREEXT_L2_PMASK0(_i) (0x0020F0FC + ((_i) * 4))111#define GL_PREEXT_L2_PMASK0(_i) (0x0020F0FC + ((_i) * 4))
112#define GL_PREEXT_L2_PMASK1(_i) (0x0020F108 + ((_i) * 4))112#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)
113#define GLFLXP_RXDID_FLX_WRD_0(_i) (0x0045c800 + ((_i) * 4))116#define GLFLXP_RXDID_FLX_WRD_0(_i) (0x0045c800 + ((_i) * 4))
114#define GLFLXP_RXDID_FLX_WRD_0_PROT_MDID_S 0117#define GLFLXP_RXDID_FLX_WRD_0_PROT_MDID_S 0
115#define GLFLXP_RXDID_FLX_WRD_0_PROT_MDID_M ICE_M(0xFF, 0)118#define GLFLXP_RXDID_FLX_WRD_0_PROT_MDID_M ICE_M(0xFF, 0)
drivers/net/ethernet/intel/ice/ice_virtchnl.c+86−0
@@ -462,6 +462,9 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg) · 461 unmodified lines
462 vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_RSS_REG;462 vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_RSS_REG;
463 }463 }
464 464
465 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
466 vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC;
467
465 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_FDIR_PF)468 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_FDIR_PF)
466 vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_FDIR_PF;469 vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_FDIR_PF;
467 470
@@ -1618,6 +1621,9 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) · 1150 unmodified lines
1618 }1621 }
1619 1622
1620 for (i = 0; i < qci->num_queue_pairs; i++) {1623 for (i = 0; i < qci->num_queue_pairs; i++) {
1624 struct ice_hw *hw;
1625 u32 rxdid;
1626 u16 pf_q;
1621 qpi = &qci->qpair[i];1627 qpi = &qci->qpair[i];
1622 if (qpi->txq.vsi_id != qci->vsi_id ||1628 if (qpi->txq.vsi_id != qci->vsi_id ||
1623 qpi->rxq.vsi_id != qci->vsi_id ||1629 qpi->rxq.vsi_id != qci->vsi_id ||
@@ -1686,6 +1692,25 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) · 62 unmodified lines
1686 goto error_param;1692 goto error_param;
1687 }1693 }
1688 }1694 }
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);
1689 }1714 }
1690 1715
1691 /* send the response to the VF */1716 /* send the response to the VF */
@@ -2456,6 +2481,62 @@ error_param: · 764 unmodified lines
2456 v_ret, NULL, 0);2481 v_ret, NULL, 0);
2457}2482}
2458 2483
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 */
2491static 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
2533err:
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
2459/**2540/**
2460 * ice_vf_init_vlan_stripping - enable/disable VLAN stripping on initialization2541 * ice_vf_init_vlan_stripping - enable/disable VLAN stripping on initialization
2461 * @vf: VF to enable/disable VLAN stripping for on initialization2542 * @vf: VF to enable/disable VLAN stripping for on initialization
@@ -3490,6 +3571,7 @@ static const struct ice_virtchnl_ops ice_virtchnl_dflt_ops = { · 1028 unmodified lines
3490 .cfg_promiscuous_mode_msg = ice_vc_cfg_promiscuous_mode_msg,3571 .cfg_promiscuous_mode_msg = ice_vc_cfg_promiscuous_mode_msg,
3491 .add_vlan_msg = ice_vc_add_vlan_msg,3572 .add_vlan_msg = ice_vc_add_vlan_msg,
3492 .remove_vlan_msg = ice_vc_remove_vlan_msg,3573 .remove_vlan_msg = ice_vc_remove_vlan_msg,
3574 .query_rxdid = ice_vc_query_rxdid,
3493 .ena_vlan_stripping = ice_vc_ena_vlan_stripping,3575 .ena_vlan_stripping = ice_vc_ena_vlan_stripping,
3494 .dis_vlan_stripping = ice_vc_dis_vlan_stripping,3576 .dis_vlan_stripping = ice_vc_dis_vlan_stripping,
3495 .handle_rss_cfg_msg = ice_vc_handle_rss_cfg,3577 .handle_rss_cfg_msg = ice_vc_handle_rss_cfg,
@@ -3624,6 +3706,7 @@ static const struct ice_virtchnl_ops ice_virtchnl_repr_ops = { · 128 unmodified lines
3624 .cfg_promiscuous_mode_msg = ice_vc_repr_cfg_promiscuous_mode,3706 .cfg_promiscuous_mode_msg = ice_vc_repr_cfg_promiscuous_mode,
3625 .add_vlan_msg = ice_vc_add_vlan_msg,3707 .add_vlan_msg = ice_vc_add_vlan_msg,
3626 .remove_vlan_msg = ice_vc_remove_vlan_msg,3708 .remove_vlan_msg = ice_vc_remove_vlan_msg,
3709 .query_rxdid = ice_vc_query_rxdid,
3627 .ena_vlan_stripping = ice_vc_ena_vlan_stripping,3710 .ena_vlan_stripping = ice_vc_ena_vlan_stripping,
3628 .dis_vlan_stripping = ice_vc_dis_vlan_stripping,3711 .dis_vlan_stripping = ice_vc_dis_vlan_stripping,
3629 .handle_rss_cfg_msg = ice_vc_handle_rss_cfg,3712 .handle_rss_cfg_msg = ice_vc_handle_rss_cfg,
@@ -3764,6 +3847,9 @@ error_handler: · 134 unmodified lines
3764 case VIRTCHNL_OP_DEL_VLAN:3847 case VIRTCHNL_OP_DEL_VLAN:
3765 err = ops->remove_vlan_msg(vf, msg);3848 err = ops->remove_vlan_msg(vf, msg);
3766 break;3849 break;
3850 case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
3851 err = ops->query_rxdid(vf);
3852 break;
3767 case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:3853 case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
3768 err = ops->ena_vlan_stripping(vf);3854 err = ops->ena_vlan_stripping(vf);
3769 break;3855 break;
drivers/net/ethernet/intel/ice/ice_virtchnl.h+2−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
17 * broadcast, and 16 for additional unicast/multicast filters17 * broadcast, and 16 for additional unicast/multicast filters
18 */18 */
19#define ICE_MAX_MACADDR_PER_VF 1819#define ICE_MAX_MACADDR_PER_VF 18
20#define ICE_FLEX_DESC_RXDID_MAX_NUM 64
20 21
21struct ice_virtchnl_ops {22struct ice_virtchnl_ops {
22 int (*get_ver_msg)(struct ice_vf *vf, u8 *msg);23 int (*get_ver_msg)(struct ice_vf *vf, u8 *msg);
@@ -35,6 +36,7 @@ struct ice_virtchnl_ops { · 12 unmodified lines
35 int (*cfg_promiscuous_mode_msg)(struct ice_vf *vf, u8 *msg);36 int (*cfg_promiscuous_mode_msg)(struct ice_vf *vf, u8 *msg);
36 int (*add_vlan_msg)(struct ice_vf *vf, u8 *msg);37 int (*add_vlan_msg)(struct ice_vf *vf, u8 *msg);
37 int (*remove_vlan_msg)(struct ice_vf *vf, u8 *msg);38 int (*remove_vlan_msg)(struct ice_vf *vf, u8 *msg);
39 int (*query_rxdid)(struct ice_vf *vf);
38 int (*ena_vlan_stripping)(struct ice_vf *vf);40 int (*ena_vlan_stripping)(struct ice_vf *vf);
39 int (*dis_vlan_stripping)(struct ice_vf *vf);41 int (*dis_vlan_stripping)(struct ice_vf *vf);
40 int (*handle_rss_cfg_msg)(struct ice_vf *vf, u8 *msg, bool add);42 int (*handle_rss_cfg_msg)(struct ice_vf *vf, u8 *msg, bool add);
drivers/net/ethernet/intel/ice/ice_virtchnl_allowlist.c+6−0
@@ -70,6 +70,11 @@ static const u32 rss_pf_allowlist_opcodes[] = { · 69 unmodified lines
70 VIRTCHNL_OP_GET_RSS_HENA_CAPS, VIRTCHNL_OP_SET_RSS_HENA,70 VIRTCHNL_OP_GET_RSS_HENA_CAPS, VIRTCHNL_OP_SET_RSS_HENA,
71};71};
72 72
73/* VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC */
74static const u32 rx_flex_desc_allowlist_opcodes[] = {
75 VIRTCHNL_OP_GET_SUPPORTED_RXDIDS,
76};
77
73/* VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF */78/* VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF */
74static const u32 adv_rss_pf_allowlist_opcodes[] = {79static const u32 adv_rss_pf_allowlist_opcodes[] = {
75 VIRTCHNL_OP_ADD_RSS_CFG, VIRTCHNL_OP_DEL_RSS_CFG,80 VIRTCHNL_OP_ADD_RSS_CFG, VIRTCHNL_OP_DEL_RSS_CFG,
@@ -96,6 +101,7 @@ static const struct allowlist_opcode_info allowlist_opcodes[] = { · 20 unmodified lines
96 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_REQ_QUEUES, req_queues_allowlist_opcodes),101 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_REQ_QUEUES, req_queues_allowlist_opcodes),
97 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_VLAN, vlan_allowlist_opcodes),102 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_VLAN, vlan_allowlist_opcodes),
98 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_RSS_PF, rss_pf_allowlist_opcodes),103 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),
99 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF, adv_rss_pf_allowlist_opcodes),105 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF, adv_rss_pf_allowlist_opcodes),
100 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_FDIR_PF, fdir_pf_allowlist_opcodes),106 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_FDIR_PF, fdir_pf_allowlist_opcodes),
101 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_VLAN_V2, vlan_v2_allowlist_opcodes),107 ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_VLAN_V2, vlan_v2_allowlist_opcodes),
include/linux/avf/virtchnl.h+12−2
@@ -136,7 +136,8 @@ enum virtchnl_ops { · 135 unmodified lines
136 VIRTCHNL_OP_DISABLE_CHANNELS = 31,136 VIRTCHNL_OP_DISABLE_CHANNELS = 31,
137 VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,137 VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
138 VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,138 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,
140 VIRTCHNL_OP_ADD_RSS_CFG = 45,141 VIRTCHNL_OP_ADD_RSS_CFG = 45,
141 VIRTCHNL_OP_DEL_RSS_CFG = 46,142 VIRTCHNL_OP_DEL_RSS_CFG = 46,
142 VIRTCHNL_OP_ADD_FDIR_FILTER = 47,143 VIRTCHNL_OP_ADD_FDIR_FILTER = 47,
@@ -263,6 +264,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource); · 120 unmodified lines
263#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM BIT(22)264#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM BIT(22)
264#define VIRTCHNL_VF_OFFLOAD_ADQ BIT(23)265#define VIRTCHNL_VF_OFFLOAD_ADQ BIT(23)
265#define VIRTCHNL_VF_OFFLOAD_USO BIT(25)266#define VIRTCHNL_VF_OFFLOAD_USO BIT(25)
267#define VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC BIT(26)
266#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF BIT(27)268#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF BIT(27)
267#define VIRTCHNL_VF_OFFLOAD_FDIR_PF BIT(28)269#define VIRTCHNL_VF_OFFLOAD_FDIR_PF BIT(28)
268 270
@@ -318,7 +320,9 @@ struct virtchnl_rxq_info { · 49 unmodified lines
318 u16 splithdr_enabled; /* deprecated with AVF 1.0 */320 u16 splithdr_enabled; /* deprecated with AVF 1.0 */
319 u32 databuffer_size;321 u32 databuffer_size;
320 u32 max_pkt_size;322 u32 max_pkt_size;
321 u32 pad1;323 u8 pad0;
324 u8 rxdid;
325 u8 pad1[2];
322 u64 dma_ring_addr;326 u64 dma_ring_addr;
323 enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */327 enum virtchnl_rx_hsplit rx_split_pos; /* deprecated with AVF 1.0 */
324 u32 pad2;328 u32 pad2;
@@ -970,6 +974,10 @@ struct virtchnl_filter { · 645 unmodified lines
970 974
971VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);975VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
972 976
977struct virtchnl_supported_rxdids {
978 u64 supported_rxdids;
979};
980
973/* VIRTCHNL_OP_EVENT981/* VIRTCHNL_OP_EVENT
974 * PF sends this message to inform the VF driver of events that may affect it.982 * PF sends this message to inform the VF driver of events that may affect it.
975 * No direct response is expected from the VF, though it may generate other983 * 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, · 523 unmodified lines
1499 case VIRTCHNL_OP_DEL_CLOUD_FILTER:1507 case VIRTCHNL_OP_DEL_CLOUD_FILTER:
1500 valid_len = sizeof(struct virtchnl_filter);1508 valid_len = sizeof(struct virtchnl_filter);
1501 break;1509 break;
1510 case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
1511 break;
1502 case VIRTCHNL_OP_ADD_RSS_CFG:1512 case VIRTCHNL_OP_ADD_RSS_CFG:
1503 case VIRTCHNL_OP_DEL_RSS_CFG:1513 case VIRTCHNL_OP_DEL_RSS_CFG:
1504 valid_len = sizeof(struct virtchnl_rss_cfg);1514 valid_len = sizeof(struct virtchnl_rss_cfg);