#if defined(__i386__) || defined(__x86_64__) #include #include #include #include #include "helpers/helpers.h" /* Intel specific MSRs */ #define MSR_IA32_PERF_STATUS 0x198 #define MSR_IA32_MISC_ENABLES 0x1a0 #define MSR_IA32_ENERGY_PERF_BIAS 0x1b0 #define MSR_NEHALEM_TURBO_RATIO_LIMIT 0x1ad /* * read_msr * * Will return 0 on success and -1 on failure. * Possible errno values could be: * EFAULT -If the read/write did not fully complete * EIO -If the CPU does not support MSRs * ENXIO -If the CPU does not exist */ int read_msr(int cpu, unsigned int idx, unsigned long long *val) { int fd; char msr_file_name[64]; sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu); fd = open(msr_file_name, O_RDONLY); if (fd < 0) return -1; if (lseek(fd, idx, SEEK_CUR) == -1) goto err; if (read(fd, val, sizeof *val) != sizeof *val) goto err; close(fd); return 0; err: close(fd); return -1; } /* * write_msr * * Will return 0 on success and -1 on failure. * Possible errno values could be: * EFAULT -If the read/write did not fully complete * EIO -If the CPU does not support MSRs * ENXIO -If the CPU does not exist */ int write_msr(int cpu, unsigned int idx, unsigned long long val) { int fd; char msr_file_name[64]; sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu); fd = open(msr_file_name, O_WRONLY); if (fd < 0) return -1; if (lseek(fd, idx, SEEK_CUR) == -1) goto err; if (write(fd, &val, sizeof val) != sizeof val) goto err; close(fd); return 0; err: close(fd); return -1; } int msr_intel_get_perf_bias(unsigned int cpu) { unsigned long long val; int ret; if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_PERF_BIAS)) return -1; ret = read_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, &val); if (ret) return ret; return val; } int msr_intel_set_perf_bias(unsigned int cpu, unsigned int val) { int ret; if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_PERF_BIAS)) return -1; ret = write_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, val); if (ret) return ret; return 0; } unsigned long long msr_intel_get_turbo_ratio(unsigned int cpu) { unsigned long long val; int ret; if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_HAS_TURBO_RATIO)) return -1; ret = read_msr(cpu, MSR_NEHALEM_TURBO_RATIO_LIMIT, &val); if (ret) return ret; return val; } #endif en' name='h' value='nds-private-remove'/>
diff options
context:
space:
mode:
authorNogah Frankel <nogahf@mellanox.com>2017-02-09 14:54:47 +0100
committerDavid S. Miller <davem@davemloft.net>2017-02-10 11:46:40 -0500
commit8ecd4591e7612a7ea5c67589cf1a7f18bd17ba14 (patch)
treee7d2a7196afa312af9fa7379afd8a4a7ca7360ae /drivers
parent71c365bdc4396893798c8e1c9247663096ff4829 (diff)
mlxsw: spectrum: Add an option to flood mc by mc_router_port
The decision whether to flood a multicast packet to a port dependent on three flags: mc_disabled, mc_router_port, mc_flood. If mc_disabled is on, the port will be flooded according to mc_flood, otherwise, according to mc_router_port. To accomplish that, add those flags into the mlxsw_sp_port struct and update the mc flood table accordingly. Update mc_router_port by switchdev attribute SWITCHDEV_ATTR_ID_PORT_MC_ROUTER_PORT. Signed-off-by: Nogah Frankel <nogahf@mellanox.com> Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')