diff options
Diffstat (limited to 'drivers/net/vxge/vxge-config.c')
-rw-r--r-- | drivers/net/vxge/vxge-config.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c index 9e94c4b0fb18..11cdb381681a 100644 --- a/drivers/net/vxge/vxge-config.c +++ b/drivers/net/vxge/vxge-config.c | |||
@@ -356,10 +356,8 @@ __vxge_hw_device_access_rights_get(u32 host_type, u32 func_id) | |||
356 | 356 | ||
357 | switch (host_type) { | 357 | switch (host_type) { |
358 | case VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION: | 358 | case VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION: |
359 | if (func_id == 0) { | 359 | access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM | |
360 | access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM | | 360 | VXGE_HW_DEVICE_ACCESS_RIGHT_SRPCIM; |
361 | VXGE_HW_DEVICE_ACCESS_RIGHT_SRPCIM; | ||
362 | } | ||
363 | break; | 361 | break; |
364 | case VXGE_HW_MR_NO_SR_VH0_BASE_FUNCTION: | 362 | case VXGE_HW_MR_NO_SR_VH0_BASE_FUNCTION: |
365 | access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM | | 363 | access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM | |
@@ -382,6 +380,22 @@ __vxge_hw_device_access_rights_get(u32 host_type, u32 func_id) | |||
382 | return access_rights; | 380 | return access_rights; |
383 | } | 381 | } |
384 | /* | 382 | /* |
383 | * __vxge_hw_device_is_privilaged | ||
384 | * This routine checks if the device function is privilaged or not | ||
385 | */ | ||
386 | |||
387 | enum vxge_hw_status | ||
388 | __vxge_hw_device_is_privilaged(u32 host_type, u32 func_id) | ||
389 | { | ||
390 | if (__vxge_hw_device_access_rights_get(host_type, | ||
391 | func_id) & | ||
392 | VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM) | ||
393 | return VXGE_HW_OK; | ||
394 | else | ||
395 | return VXGE_HW_ERR_PRIVILAGED_OPEARATION; | ||
396 | } | ||
397 | |||
398 | /* | ||
385 | * __vxge_hw_device_host_info_get | 399 | * __vxge_hw_device_host_info_get |
386 | * This routine returns the host type assignments | 400 | * This routine returns the host type assignments |
387 | */ | 401 | */ |
@@ -446,18 +460,6 @@ __vxge_hw_verify_pci_e_info(struct __vxge_hw_device *hldev) | |||
446 | return VXGE_HW_OK; | 460 | return VXGE_HW_OK; |
447 | } | 461 | } |
448 | 462 | ||
449 | enum vxge_hw_status | ||
450 | __vxge_hw_device_is_privilaged(struct __vxge_hw_device *hldev) | ||
451 | { | ||
452 | if ((hldev->host_type == VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION || | ||
453 | hldev->host_type == VXGE_HW_MR_NO_SR_VH0_BASE_FUNCTION || | ||
454 | hldev->host_type == VXGE_HW_NO_MR_SR_VH0_FUNCTION0) && | ||
455 | (hldev->func_id == 0)) | ||
456 | return VXGE_HW_OK; | ||
457 | else | ||
458 | return VXGE_HW_ERR_PRIVILAGED_OPEARATION; | ||
459 | } | ||
460 | |||
461 | /* | 463 | /* |
462 | * vxge_hw_wrr_rebalance - Rebalance the RX_WRR and KDFC_WRR calandars. | 464 | * vxge_hw_wrr_rebalance - Rebalance the RX_WRR and KDFC_WRR calandars. |
463 | * Rebalance the RX_WRR and KDFC_WRR calandars. | 465 | * Rebalance the RX_WRR and KDFC_WRR calandars. |
@@ -470,7 +472,8 @@ vxge_hw_status vxge_hw_wrr_rebalance(struct __vxge_hw_device *hldev) | |||
470 | u32 i, j, how_often = 1; | 472 | u32 i, j, how_often = 1; |
471 | enum vxge_hw_status status = VXGE_HW_OK; | 473 | enum vxge_hw_status status = VXGE_HW_OK; |
472 | 474 | ||
473 | status = __vxge_hw_device_is_privilaged(hldev); | 475 | status = __vxge_hw_device_is_privilaged(hldev->host_type, |
476 | hldev->func_id); | ||
474 | if (status != VXGE_HW_OK) | 477 | if (status != VXGE_HW_OK) |
475 | goto exit; | 478 | goto exit; |
476 | 479 | ||
@@ -668,7 +671,8 @@ enum vxge_hw_status __vxge_hw_device_initialize(struct __vxge_hw_device *hldev) | |||
668 | { | 671 | { |
669 | enum vxge_hw_status status = VXGE_HW_OK; | 672 | enum vxge_hw_status status = VXGE_HW_OK; |
670 | 673 | ||
671 | if (VXGE_HW_OK == __vxge_hw_device_is_privilaged(hldev)) { | 674 | if (VXGE_HW_OK == __vxge_hw_device_is_privilaged(hldev->host_type, |
675 | hldev->func_id)) { | ||
672 | /* Validate the pci-e link width and speed */ | 676 | /* Validate the pci-e link width and speed */ |
673 | status = __vxge_hw_verify_pci_e_info(hldev); | 677 | status = __vxge_hw_verify_pci_e_info(hldev); |
674 | if (status != VXGE_HW_OK) | 678 | if (status != VXGE_HW_OK) |
@@ -953,7 +957,8 @@ vxge_hw_mrpcim_stats_access(struct __vxge_hw_device *hldev, | |||
953 | u64 val64; | 957 | u64 val64; |
954 | enum vxge_hw_status status = VXGE_HW_OK; | 958 | enum vxge_hw_status status = VXGE_HW_OK; |
955 | 959 | ||
956 | status = __vxge_hw_device_is_privilaged(hldev); | 960 | status = __vxge_hw_device_is_privilaged(hldev->host_type, |
961 | hldev->func_id); | ||
957 | if (status != VXGE_HW_OK) | 962 | if (status != VXGE_HW_OK) |
958 | goto exit; | 963 | goto exit; |
959 | 964 | ||
@@ -990,7 +995,8 @@ vxge_hw_device_xmac_aggr_stats_get(struct __vxge_hw_device *hldev, u32 port, | |||
990 | 995 | ||
991 | val64 = (u64 *)aggr_stats; | 996 | val64 = (u64 *)aggr_stats; |
992 | 997 | ||
993 | status = __vxge_hw_device_is_privilaged(hldev); | 998 | status = __vxge_hw_device_is_privilaged(hldev->host_type, |
999 | hldev->func_id); | ||
994 | if (status != VXGE_HW_OK) | 1000 | if (status != VXGE_HW_OK) |
995 | goto exit; | 1001 | goto exit; |
996 | 1002 | ||
@@ -1023,7 +1029,8 @@ vxge_hw_device_xmac_port_stats_get(struct __vxge_hw_device *hldev, u32 port, | |||
1023 | u32 offset = 0x0; | 1029 | u32 offset = 0x0; |
1024 | val64 = (u64 *) port_stats; | 1030 | val64 = (u64 *) port_stats; |
1025 | 1031 | ||
1026 | status = __vxge_hw_device_is_privilaged(hldev); | 1032 | status = __vxge_hw_device_is_privilaged(hldev->host_type, |
1033 | hldev->func_id); | ||
1027 | if (status != VXGE_HW_OK) | 1034 | if (status != VXGE_HW_OK) |
1028 | goto exit; | 1035 | goto exit; |
1029 | 1036 | ||
@@ -1221,7 +1228,8 @@ enum vxge_hw_status vxge_hw_device_setpause_data(struct __vxge_hw_device *hldev, | |||
1221 | goto exit; | 1228 | goto exit; |
1222 | } | 1229 | } |
1223 | 1230 | ||
1224 | status = __vxge_hw_device_is_privilaged(hldev); | 1231 | status = __vxge_hw_device_is_privilaged(hldev->host_type, |
1232 | hldev->func_id); | ||
1225 | if (status != VXGE_HW_OK) | 1233 | if (status != VXGE_HW_OK) |
1226 | goto exit; | 1234 | goto exit; |
1227 | 1235 | ||