cap->host_id = dev_cap->host_id;
cap->ep_id = dev_cap->ep_id;
cap->max_cos_id = dev_cap->max_cos_id;
+ cap->valid_cos_bitmap = dev_cap->valid_cos_bitmap;
cap->er_id = dev_cap->er_id;
cap->port_id = dev_cap->port_id;
cap->host_oq_id_mask_val = dev_cap->host_oq_id_mask_val;
PMD_DRV_LOG(INFO, "Get public resource capability:");
- PMD_DRV_LOG(INFO, "host_id: 0x%x, ep_id: 0x%x, intr_type: 0x%x, max_cos_id: 0x%x, er_id: 0x%x, port_id: 0x%x",
+ PMD_DRV_LOG(INFO, "host_id: 0x%x, ep_id: 0x%x, intr_type: 0x%x, "
+ "max_cos_id: 0x%x, cos_bitmap: 0x%x, er_id: 0x%x, port_id: 0x%x",
cap->host_id, cap->ep_id, cap->intr_chip_en,
- cap->max_cos_id, cap->er_id, cap->port_id);
+ cap->max_cos_id, cap->valid_cos_bitmap, cap->er_id,
+ cap->port_id);
PMD_DRV_LOG(INFO, "host_total_function: 0x%x, host_oq_id_mask_val: 0x%x, max_vf: 0x%x",
cap->host_total_function, cap->host_oq_id_mask_val,
cap->max_vf);
up_pgid, up_bw, up_strict);
}
+static int hinic_pf_get_default_cos(struct hinic_hwdev *hwdev, u8 *cos_id)
+{
+ u8 default_cos = 0;
+ u8 valid_cos_bitmap;
+ u8 i;
+
+ valid_cos_bitmap = hwdev->cfg_mgmt->svc_cap.valid_cos_bitmap;
+ if (!valid_cos_bitmap) {
+ PMD_DRV_LOG(ERR, "PF has none cos to support\n");
+ return -EFAULT;
+ }
+
+ for (i = 0; i < NR_MAX_COS; i++) {
+ if (valid_cos_bitmap & BIT(i))
+ default_cos = i; /* Find max cos id as default cos */
+ }
+
+ *cos_id = default_cos;
+
+ return 0;
+}
+
static int hinic_init_default_cos(struct hinic_nic_dev *nic_dev)
{
u8 cos_id = 0;
int err;
if (!HINIC_IS_VF(nic_dev->hwdev)) {
- nic_dev->default_cos =
- (hinic_global_func_id(nic_dev->hwdev) +
- DEFAULT_BASE_COS) % NR_MAX_COS;
+ err = hinic_pf_get_default_cos(nic_dev->hwdev, &cos_id);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Get PF default cos failed, err: %d",
+ err);
+ return HINIC_ERROR;
+ }
} else {
err = hinic_vf_get_default_cos(nic_dev->hwdev, &cos_id);
if (err) {
PMD_DRV_LOG(ERR, "Get VF default cos failed, err: %d",
- err);
+ err);
return HINIC_ERROR;
}
-
- nic_dev->default_cos = cos_id;
}
+ nic_dev->default_cos = cos_id;
+
+ PMD_DRV_LOG(INFO, "Default cos %d", nic_dev->default_cos);
+
return 0;
}