@@ -1569,35 +1569,27 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)
15691569 */
15701570static int ice_vc_cfg_qs_msg (struct ice_vf * vf , u8 * msg )
15711571{
1572- enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS ;
15731572 struct virtchnl_vsi_queue_config_info * qci =
15741573 (struct virtchnl_vsi_queue_config_info * )msg ;
15751574 struct virtchnl_queue_pair_info * qpi ;
15761575 struct ice_pf * pf = vf -> pf ;
15771576 struct ice_vsi * vsi ;
1578- int i , q_idx ;
1577+ int i = -1 , q_idx ;
15791578
1580- if (!test_bit (ICE_VF_STATE_ACTIVE , vf -> vf_states )) {
1581- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
1579+ if (!test_bit (ICE_VF_STATE_ACTIVE , vf -> vf_states ))
15821580 goto error_param ;
1583- }
15841581
1585- if (!ice_vc_isvalid_vsi_id (vf , qci -> vsi_id )) {
1586- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
1582+ if (!ice_vc_isvalid_vsi_id (vf , qci -> vsi_id ))
15871583 goto error_param ;
1588- }
15891584
15901585 vsi = ice_get_vf_vsi (vf );
1591- if (!vsi ) {
1592- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
1586+ if (!vsi )
15931587 goto error_param ;
1594- }
15951588
15961589 if (qci -> num_queue_pairs > ICE_MAX_RSS_QS_PER_VF ||
15971590 qci -> num_queue_pairs > min_t (u16 , vsi -> alloc_txq , vsi -> alloc_rxq )) {
15981591 dev_err (ice_pf_to_dev (pf ), "VF-%d requesting more than supported number of queues: %d\n" ,
15991592 vf -> vf_id , min_t (u16 , vsi -> alloc_txq , vsi -> alloc_rxq ));
1600- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
16011593 goto error_param ;
16021594 }
16031595
@@ -1610,7 +1602,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16101602 !ice_vc_isvalid_ring_len (qpi -> txq .ring_len ) ||
16111603 !ice_vc_isvalid_ring_len (qpi -> rxq .ring_len ) ||
16121604 !ice_vc_isvalid_q_id (vf , qci -> vsi_id , qpi -> txq .queue_id )) {
1613- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
16141605 goto error_param ;
16151606 }
16161607
@@ -1620,7 +1611,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16201611 * for selected "vsi"
16211612 */
16221613 if (q_idx >= vsi -> alloc_txq || q_idx >= vsi -> alloc_rxq ) {
1623- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
16241614 goto error_param ;
16251615 }
16261616
@@ -1630,14 +1620,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16301620 vsi -> tx_rings [i ]-> count = qpi -> txq .ring_len ;
16311621
16321622 /* Disable any existing queue first */
1633- if (ice_vf_vsi_dis_single_txq (vf , vsi , q_idx )) {
1634- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
1623+ if (ice_vf_vsi_dis_single_txq (vf , vsi , q_idx ))
16351624 goto error_param ;
1636- }
16371625
16381626 /* Configure a queue with the requested settings */
16391627 if (ice_vsi_cfg_single_txq (vsi , vsi -> tx_rings , q_idx )) {
1640- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
1628+ dev_warn (ice_pf_to_dev (pf ), "VF-%d failed to configure TX queue %d\n" ,
1629+ vf -> vf_id , i );
16411630 goto error_param ;
16421631 }
16431632 }
@@ -1651,17 +1640,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16511640
16521641 if (qpi -> rxq .databuffer_size != 0 &&
16531642 (qpi -> rxq .databuffer_size > ((16 * 1024 ) - 128 ) ||
1654- qpi -> rxq .databuffer_size < 1024 )) {
1655- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
1643+ qpi -> rxq .databuffer_size < 1024 ))
16561644 goto error_param ;
1657- }
16581645 vsi -> rx_buf_len = qpi -> rxq .databuffer_size ;
16591646 vsi -> rx_rings [i ]-> rx_buf_len = vsi -> rx_buf_len ;
16601647 if (qpi -> rxq .max_pkt_size > max_frame_size ||
1661- qpi -> rxq .max_pkt_size < 64 ) {
1662- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
1648+ qpi -> rxq .max_pkt_size < 64 )
16631649 goto error_param ;
1664- }
16651650
16661651 vsi -> max_frame = qpi -> rxq .max_pkt_size ;
16671652 /* add space for the port VLAN since the VF driver is
@@ -1672,16 +1657,30 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16721657 vsi -> max_frame += VLAN_HLEN ;
16731658
16741659 if (ice_vsi_cfg_single_rxq (vsi , q_idx )) {
1675- v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
1660+ dev_warn (ice_pf_to_dev (pf ), "VF-%d failed to configure RX queue %d\n" ,
1661+ vf -> vf_id , i );
16761662 goto error_param ;
16771663 }
16781664 }
16791665 }
16801666
1667+ /* send the response to the VF */
1668+ return ice_vc_send_msg_to_vf (vf , VIRTCHNL_OP_CONFIG_VSI_QUEUES ,
1669+ VIRTCHNL_STATUS_SUCCESS , NULL , 0 );
16811670error_param :
1671+ /* disable whatever we can */
1672+ for (; i >= 0 ; i -- ) {
1673+ if (ice_vsi_ctrl_one_rx_ring (vsi , false, i , true))
1674+ dev_err (ice_pf_to_dev (pf ), "VF-%d could not disable RX queue %d\n" ,
1675+ vf -> vf_id , i );
1676+ if (ice_vf_vsi_dis_single_txq (vf , vsi , i ))
1677+ dev_err (ice_pf_to_dev (pf ), "VF-%d could not disable TX queue %d\n" ,
1678+ vf -> vf_id , i );
1679+ }
1680+
16821681 /* send the response to the VF */
1683- return ice_vc_send_msg_to_vf (vf , VIRTCHNL_OP_CONFIG_VSI_QUEUES , v_ret ,
1684- NULL , 0 );
1682+ return ice_vc_send_msg_to_vf (vf , VIRTCHNL_OP_CONFIG_VSI_QUEUES ,
1683+ VIRTCHNL_STATUS_ERR_PARAM , NULL , 0 );
16851684}
16861685
16871686/**
0 commit comments