#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 lftests/firmware/fw_userhelper.sh'>
label'>space:
AgeCommit message (Expand)AuthorFilesLines
mode:
authorDavid S. Miller <davem@davemloft.net>2017-01-30 15:55:48 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-30 15:56:40 -0500
commit1930b60352e7e195f55b27cde15d2a8f43342a8b (patch)
treeec3f66cd8d8110bf7b4f61e0446bdea505915db9 /net/ipv4/ip_sockglue.c
parent4be9993493bc7ee3fdf950a83bc050a3e6cf2a45 (diff)
parentec960de61503ef349588dccfa3ae02efabcc2762 (diff)
Merge branch 'dsa-port-mirroring'
Florian Fainelli says: ==================== net: dsa: Port mirroring support This patch series adds support for port mirroring in the two Broadcom switch drivers. The major part of the functional are actually with the plumbing between tc and the drivers. Changes in v5: - Added Jiri's Reviewed-by tag to first patch - rebase against latest net-next/master after bcm_sf2 CFP series Changes in v4: - rebased against latest net-next/master after Vivien's changes Changes in v3: - removed multiline comments from added structures - simplify error handling in dsa_slave_add_cls_matchall Changes in v2: - fixed filter removal logic to disable the ingress or egress mirroring when there are no longer ports being monitored in ingress or egress - removed a stray list_head in dsa_port structure that is not used Tested using the two iproute2 examples: tc qdisc add dev eth1 handle ffff: ingress tc filter add dev eth1 parent ffff: \ matchall skip_sw \ action mirred egress mirror \ dev eth2 tc qdisc add dev eth1 handle 1: root prio tc filter add dev eth1 parent 1: \ matchall skip_sw \ action mirred egress mirror \ dev eth2 ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_sockglue.c')