#include <sys/types.h> #include <sys/ioctl.h> #include <linux/sockios.h> #include <unistd.h> #include <errno.h> #include "link.h" #include "sock.h" #include "str.h" u32 wireless_bitrate(const char *ifname) { int sock, ret, rate_in_mbit; struct iwreq iwr; sock = af_socket(AF_INET); memset(&iwr, 0, sizeof(iwr)); strlcpy(iwr.ifr_name, ifname, IFNAMSIZ); ret = ioctl(sock, SIOCGIWRATE, &iwr); if (!ret) rate_in_mbit = iwr.u.bitrate.value / 1000000; else rate_in_mbit = 0; close(sock); return rate_in_mbit; } int wireless_sigqual(const char *ifname, struct iw_statistics *stats) { int ret, sock; struct iwreq iwr; sock = af_socket(AF_INET); memset(&iwr, 0, sizeof(iwr)); strlcpy(iwr.ifr_name, ifname, IFNAMSIZ); iwr.u.data.pointer = (caddr_t) stats; iwr.u.data.length = sizeof(*stats); iwr.u.data.flags = 1; ret = ioctl(sock, SIOCGIWSTATS, &iwr); close(sock); return ret; } int wireless_rangemax_sigqual(const char *ifname) { int ret, sock, sigqual; struct iwreq iwr; struct iw_range iwrange; sock = af_socket(AF_INET); memset(&iwrange, 0, sizeof(iwrange)); memset(&iwr, 0, sizeof(iwr)); strlcpy(iwr.ifr_name, ifname, IFNAMSIZ); iwr.u.data.pointer = (caddr_t) &iwrange; iwr.u.data.length = sizeof(iwrange); iwr.u.data.flags = 0; ret = ioctl(sock, SIOCGIWRANGE, &iwr); if (!ret) sigqual = iwrange.max_qual.qual; else sigqual = 0; close(sock); return sigqual; } u32 ethtool_bitrate(const char *ifname) { int ret, sock, bitrate; struct ifreq ifr; struct ethtool_cmd ecmd; sock = af_socket(AF_INET); memset(&ecmd, 0, sizeof(ecmd)); memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); ecmd.cmd = ETHTOOL_GSET; ifr.ifr_data = (char *) &ecmd; ret = ioctl(sock, SIOCETHTOOL, &ifr); if (ret) { bitrate = 0; goto out; } bitrate = ethtool_cmd_speed(&ecmd); if (bitrate == SPEED_UNKNOWN) bitrate = 0; out: close(sock); return bitrate; } int ethtool_link(const char *ifname) { int ret, sock; struct ifreq ifr; struct ethtool_value ecmd; sock = af_socket(AF_INET); memset(&ecmd, 0, sizeof(ecmd)); memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); ecmd.cmd = ETHTOOL_GLINK; ifr.ifr_data = (char *) &ecmd; ret = ioctl(sock, SIOCETHTOOL, &ifr); if (ret) ret = -EINVAL; else ret = !!ecmd.data; close(sock); return ret; } int ethtool_drvinf(const char *ifname, struct ethtool_drvinfo *drvinf) { int ret, sock; struct ifreq ifr; sock = af_socket(AF_INET); memset(drvinf, 0, sizeof(*drvinf)); memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); drvinf->cmd = ETHTOOL_GDRVINFO; ifr.ifr_data = (char *) drvinf; ret = ioctl(sock, SIOCETHTOOL, &ifr); close(sock); return ret; } xt.git/log/net?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>net</a>/<a href='/cgit.cgi/linux/net-next.git/log/net/lapb?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>lapb</a>/<a href='/cgit.cgi/linux/net-next.git/log/net/lapb/lapb_out.c?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff'>lapb_out.c</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/net/lapb/lapb_out.c?id=5a0fd98b7b5be8773c53c40c47451ec6cd11d1ff&showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr> '><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='id' value='3efa70d78f218e4c9276b0bac0545e5184c1c47b'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'> <tr><th>author</th><td>David S. Miller <davem@davemloft.net></td><td class='right'>2017-02-07 16:29:30 -0500</td></tr> <tr><th>committer</th><td>David S. Miller <davem@davemloft.net></td><td class='right'>2017-02-07 16:29:30 -0500</td></tr> <tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/include/uapi/asm-generic/unistd.h?id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>3efa70d78f218e4c9276b0bac0545e5184c1c47b</a> (<a href='/cgit.cgi/linux/net-next.git/patch/include/uapi/asm-generic/unistd.h?id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>patch</a>)</td></tr> <tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>f4abe2f05e173023d2a262afd4aebb1e89fe6985</a> /<a href='/cgit.cgi/linux/net-next.git/tree/include/uapi/asm-generic/unistd.h?id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>include/uapi/asm-generic/unistd.h</a></td></tr> <tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/include/uapi/asm-generic/unistd.h?id=76e0e70e6452b971a69cc9794ff4a6715c11f7f2'>76e0e70e6452b971a69cc9794ff4a6715c11f7f2</a> (<a href='/cgit.cgi/linux/net-next.git/diff/include/uapi/asm-generic/unistd.h?id=3efa70d78f218e4c9276b0bac0545e5184c1c47b&id2=76e0e70e6452b971a69cc9794ff4a6715c11f7f2'>diff</a>)</td></tr><tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/include/uapi/asm-generic/unistd.h?id=926af6273fc683cd98cd0ce7bf0d04a02eed6742'>926af6273fc683cd98cd0ce7bf0d04a02eed6742</a> (<a href='/cgit.cgi/linux/net-next.git/diff/include/uapi/asm-generic/unistd.h?id=3efa70d78f218e4c9276b0bac0545e5184c1c47b&id2=926af6273fc683cd98cd0ce7bf0d04a02eed6742'>diff</a>)</td></tr></table> <div class='commit-subject'>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</div><div class='commit-msg'>The conflict was an interaction between a bug fix in the netvsc driver in 'net' and an optimization of the RX path in 'net-next'. Signed-off-by: David S. Miller <davem@davemloft.net> </div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>Diffstat</a> (limited to 'include/uapi/asm-generic/unistd.h')</div><table summary='diffstat' class='diffstat'>