MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx5_sys_roce_disable

Function mlx5_sys_roce_disable

dpdk/drivers/common/mlx5/linux/mlx5_common_os.c:643–681  ·  view source on GitHub ↗

Try to disable ROCE by sysfs. */

Source from the content-addressed store, hash-verified

641
642/* Try to disable ROCE by sysfs. */
643static int
644mlx5_sys_roce_disable(const char *addr)
645{
646 FILE *file_o;
647 int enable;
648 int ret;
649
650 MKSTR(file_p, "/sys/bus/pci/devices/%s/roce_enable", addr);
651 file_o = fopen(file_p, "rb");
652 if (!file_o) {
653 rte_errno = ENOTSUP;
654 return -ENOTSUP;
655 }
656 ret = fscanf(file_o, "%d", &enable);
657 if (ret != 1) {
658 rte_errno = EINVAL;
659 ret = EINVAL;
660 goto close;
661 } else if (!enable) {
662 ret = 0;
663 DRV_LOG(INFO, "ROCE has already disabled(sysfs).");
664 goto close;
665 }
666 fclose(file_o);
667 file_o = fopen(file_p, "wb");
668 if (!file_o) {
669 rte_errno = ENOTSUP;
670 return -ENOTSUP;
671 }
672 fprintf(file_o, "0\n");
673 ret = 0;
674close:
675 if (ret)
676 DRV_LOG(DEBUG, "Failed to disable ROCE by sysfs: %d.", ret);
677 else
678 DRV_LOG(INFO, "ROCE is disabled by sysfs successfully.");
679 fclose(file_o);
680 return ret;
681}
682
683static int
684mlx5_roce_disable(const struct rte_device *dev)

Callers 1

mlx5_roce_disableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected