diff options
author | Steve Kondik <steve@cyngn.com> | 2015-12-07 22:52:58 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-07 22:52:58 -0800 |
commit | 54455ee38fc75efa23fc7b8e57ca1c954380ecbe (patch) | |
tree | c1e80bcbc7c1c0bb7792e1ac5fb4b0aa690bb633 /tun.c | |
parent | 11ffa2451829c9bcb86f00c1cfff9f3be4b7064c (diff) | |
parent | 32961d08e3abe5b4e81178bb8c37dd4df231306d (diff) | |
download | android_external_android-clat-stable/cm-13.0-ZNH2K.tar.gz android_external_android-clat-stable/cm-13.0-ZNH2K.tar.bz2 android_external_android-clat-stable/cm-13.0-ZNH2K.zip |
Merge branch 'LA.BF64.1.2.2_rb4.9' of git://codeaurora.org/platform/external/android-clat into cm-13.0stable/cm-13.0-ZNH2KBstable/cm-13.0-ZNH2Kstable/cm-13.0-ZNH0E
Change-Id: I8ff75c228032b83459bfc1090488fb670c01734e
Diffstat (limited to 'tun.c')
-rw-r--r-- | tun.c | 67 |
1 files changed, 0 insertions, 67 deletions
@@ -22,14 +22,10 @@ #include <linux/if.h> #include <linux/if_tun.h> #include <sys/ioctl.h> -#include <linux/ethtool.h> #include <sys/uio.h> -#include "config.h" #include "clatd.h" -int rx_checksum_offloaded = 0; - /* function: tun_open * tries to open the tunnel device */ @@ -65,11 +61,6 @@ int tun_alloc(char *dev, int fd) { return err; } strcpy(dev, ifr.ifr_name); - - if (rx_checksum_offloaded) { - ioctl(fd, TUNSETNOCSUM, 1); - } - return 0; } @@ -96,61 +87,3 @@ int set_nonblocking(int fd) { int send_tun(int fd, clat_packet out, int iov_len) { return writev(fd, out, iov_len); } - -/* function: get_ethtool_feature_val - * gets if a particular ethtool feature is enabled - * dev - the device name to query the feature on - * cmd - the feature to query - * returns: 1 if feature is enabled, 0 if disabled - */ -int get_ethtool_feature_val(char *dev, int cmd) { - int fd; - struct ifreq ifr; - struct ethtool_value eval; - - if (!dev){ - return 0; - } - - if((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0 ) { - return 0; - } - - memset(&ifr, 0, sizeof(ifr)); - memset(&eval, 0, sizeof(eval)); - strlcpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); - eval.cmd = cmd; - eval.data = 0; - ifr.ifr_data = (caddr_t)&eval; - if (ioctl(fd, SIOCETHTOOL, &ifr) == -1) { - close(fd); - return 0; - } - - close(fd); - - if (!eval.data) { - return 0; - } - - return 1; -} - -/* function: check_csum_offload - * checks if GRO and RXCSUM are enabled on the device - * dev - the device name to query on - * returns: 1 if checksum is offloaded, 0 if checksum needs - * to be validated in network stack. - */ -int check_csum_offload(char *dev) { - if (!dev){ - return 0; - } - - if(get_ethtool_feature_val(dev, ETHTOOL_GGRO) && - get_ethtool_feature_val(dev, ETHTOOL_GRXCSUM)) { - return 1; - } - - return 0; -} |