{"action":"created","comment":{"url":"https://api.github.com/repos/systemd/systemd/pulls/comments/75676629","id":75676629,"diff_hunk":"@@ -206,3 +212,116 @@ int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol) {\n \n         return 0;\n }\n+\n+static int ethtool_get_stringset(int *fd, struct ifreq *ifr, int stringset_id, struct ethtool_gstrings **gstrings) {\n+        _cleanup_free_ struct ethtool_sset_info *info = NULL;\n+        _cleanup_free_ struct ethtool_gstrings *strings = NULL;\n+        unsigned len;\n+        int r;\n+\n+        info = malloc0(sizeof (*info) + sizeof (unsigned));\n+        if (!info)\n+                return log_oom();\n+\n+        info->cmd = ETHTOOL_GSSET_INFO;\n+        info->reserved = 0;\n+        info->sset_mask = 1ULL << stringset_id;\n+\n+        ifr->ifr_data = (void *) info;\n+\n+        r = ioctl(*fd, SIOCETHTOOL, ifr);\n+        if (r < 0)\n+                return -errno;\n+\n+        if (!info->sset_mask)\n+                return -1;\n+\n+        len = info->data[0];\n+\n+        strings = malloc0(sizeof(*strings) + len * ETH_GSTRING_LEN);\n+        if (!strings)\n+                return log_oom();\n+\n+        strings->cmd = ETHTOOL_GSTRINGS;\n+        strings->string_set = stringset_id;\n+        strings->len = len;\n+\n+        ifr->ifr_data = (void *) strings;\n+\n+        r = ioctl(*fd, SIOCETHTOOL, ifr);\n+        if (r < 0)\n+                return -errno;\n+\n+        *gstrings = strings;\n+        strings = NULL;\n+\n+        return 0;\n+}\n+\n+static int find_feature_index(struct ethtool_gstrings *strings, const char *feature) {\n+        unsigned i;\n+\n+        for (i = 0; i < strings->len; i++) {\n+                if (streq((char *) &strings->data[i * ETH_GSTRING_LEN], feature))\n+                        return i;\n+        }\n+\n+        return -1;\n+}\n+\n+int ethtool_set_features(int *fd, const char *ifname, NetDevFeature *features) {\n+        _cleanup_free_ struct ethtool_sfeatures *sfeatures = NULL;\n+        _cleanup_free_ struct ethtool_gstrings *strings = NULL;\n+        int block, bit, i, r;\n+        struct ifreq ifr;\n+\n+        if (*fd < 0) {\n+                r = ethtool_connect(fd);\n+                if (r < 0)\n+                        return log_warning_errno(r, \"link_config: could not connect to ethtool: %m\");\n+        }\n+\n+        strscpy(ifr.ifr_name, IFNAMSIZ, ifname);\n+\n+        r = ethtool_get_stringset(fd, &ifr, ETH_SS_FEATURES, &strings);\n+        if (r < 0)\n+                return log_warning_errno(r, \"link_config: could not get ethtool features for %s\", ifname);\n+\n+        sfeatures = malloc0(sizeof(*sfeatures) + DIV_ROUND_UP(strings->len, 32U) * sizeof(sfeatures->features[0]));\n+        if (!sfeatures)\n+                return log_oom();\n+\n+        sfeatures->cmd = ETHTOOL_SFEATURES;\n+        sfeatures->size = DIV_ROUND_UP(strings->len, 32U);\n+\n+        for (i = 0; i < _NET_DEV_FEAT_MAX; i++) {\n+\n+                if (features[i] != -1) {\n+\n+                        r = find_feature_index(strings, netdev_featute_table[i]);\n+                        if (r < 0) {\n+                                log_warning_errno(r, \"link_config: could not find feature: %s\", netdev_featute_table[i]);\n+                                continue;\n+                        }\n+\n+                        block = r / 32;\n+                        bit = r % 32;\n+\n+                        if (features[i]) {\n+                                sfeatures->features[block].valid |= 1 << bit;\n+                                sfeatures->features[block].requested |= 1 << bit;\n+                        } else {\n+                                sfeatures->features[block].valid  |= 1 << bit;\n+                                sfeatures->features[block].requested &= ~(1 << bit);\n+                        }\n+                }\n+        }\n+\n+        ifr.ifr_data = (void *) sfeatures;","path":"src/udev/net/ethtool-util.c","position":115,"original_position":122,"commit_id":"67d7574ef81db69696a049f08d18c8e8560a6036","original_commit_id":"25223b8adc00ee2be29e80b4f19343014530c4c0","user":{"login":"ssahani","id":145210,"avatar_url":"https://avatars.githubusercontent.com/u/145210?v=3","gravatar_id":"","url":"https://api.github.com/users/ssahani","html_url":"https://github.com/ssahani","followers_url":"https://api.github.com/users/ssahani/followers","following_url":"https://api.github.com/users/ssahani/following{/other_user}","gists_url":"https://api.github.com/users/ssahani/gists{/gist_id}","starred_url":"https://api.github.com/users/ssahani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssahani/subscriptions","organizations_url":"https://api.github.com/users/ssahani/orgs","repos_url":"https://api.github.com/users/ssahani/repos","events_url":"https://api.github.com/users/ssahani/events{/privacy}","received_events_url":"https://api.github.com/users/ssahani/received_events","type":"User","site_admin":false},"body":"`src/udev/net/ethtool-util.c: In function ‘ethtool_set_features’:\r\nsrc/udev/net/ethtool-util.c:312:22: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]\r\n         ifr.ifr_data = sfeatures;`\r\n","created_at":"2016-08-22T13:28:35Z","updated_at":"2016-08-22T13:28:35Z","html_url":"https://github.com/systemd/systemd/pull/4017#discussion_r75676629","pull_request_url":"https://api.github.com/repos/systemd/systemd/pulls/4017","_links":{"self":{"href":"https://api.github.com/repos/systemd/systemd/pulls/comments/75676629"},"html":{"href":"https://github.com/systemd/systemd/pull/4017#discussion_r75676629"},"pull_request":{"href":"https://api.github.com/repos/systemd/systemd/pulls/4017"}}},"pull_request":{"url":"https://api.github.com/repos/systemd/systemd/pulls/4017","id":82143379,"html_url":"https://github.com/systemd/systemd/pull/4017","diff_url":"https://github.com/systemd/systemd/pull/4017.diff","patch_url":"https://github.com/systemd/systemd/pull/4017.patch","issue_url":"https://api.github.com/repos/systemd/systemd/issues/4017","number":4017,"state":"open","locked":false,"title":"link : add support to configure Offload features","user":{"login":"ssahani","id":145210,"avatar_url":"https://avatars.githubusercontent.com/u/145210?v=3","gravatar_id":"","url":"https://api.github.com/users/ssahani","html_url":"https://github.com/ssahani","followers_url":"https://api.github.com/users/ssahani/followers","following_url":"https://api.github.com/users/ssahani/following{/other_user}","gists_url":"https://api.github.com/users/ssahani/gists{/gist_id}","starred_url":"https://api.github.com/users/ssahani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssahani/subscriptions","organizations_url":"https://api.github.com/users/ssahani/orgs","repos_url":"https://api.github.com/users/ssahani/repos","events_url":"https://api.github.com/users/ssahani/events{/privacy}","received_events_url":"https://api.github.com/users/ssahani/received_events","type":"User","site_admin":false},"body":"This patch supports these features to be on or off\r\n\r\nGeneric Segmentation Offload\r\nTCP Segmentation Offload\r\nUDP Segmentation Offload\r\n\r\nfixes #432","created_at":"2016-08-22T07:11:47Z","updated_at":"2016-08-22T13:28:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"017131cf84d7b2cf449edd7acadfad35ae06f520","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/systemd/systemd/pulls/4017/commits","review_comments_url":"https://api.github.com/repos/systemd/systemd/pulls/4017/comments","review_comment_url":"https://api.github.com/repos/systemd/systemd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/systemd/systemd/issues/4017/comments","statuses_url":"https://api.github.com/repos/systemd/systemd/statuses/67d7574ef81db69696a049f08d18c8e8560a6036","head":{"label":"ssahani:network-tso","ref":"network-tso","sha":"67d7574ef81db69696a049f08d18c8e8560a6036","user":{"login":"ssahani","id":145210,"avatar_url":"https://avatars.githubusercontent.com/u/145210?v=3","gravatar_id":"","url":"https://api.github.com/users/ssahani","html_url":"https://github.com/ssahani","followers_url":"https://api.github.com/users/ssahani/followers","following_url":"https://api.github.com/users/ssahani/following{/other_user}","gists_url":"https://api.github.com/users/ssahani/gists{/gist_id}","starred_url":"https://api.github.com/users/ssahani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssahani/subscriptions","organizations_url":"https://api.github.com/users/ssahani/orgs","repos_url":"https://api.github.com/users/ssahani/repos","events_url":"https://api.github.com/users/ssahani/events{/privacy}","received_events_url":"https://api.github.com/users/ssahani/received_events","type":"User","site_admin":false},"repo":{"id":37174911,"name":"systemd","full_name":"ssahani/systemd","owner":{"login":"ssahani","id":145210,"avatar_url":"https://avatars.githubusercontent.com/u/145210?v=3","gravatar_id":"","url":"https://api.github.com/users/ssahani","html_url":"https://github.com/ssahani","followers_url":"https://api.github.com/users/ssahani/followers","following_url":"https://api.github.com/users/ssahani/following{/other_user}","gists_url":"https://api.github.com/users/ssahani/gists{/gist_id}","starred_url":"https://api.github.com/users/ssahani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssahani/subscriptions","organizations_url":"https://api.github.com/users/ssahani/orgs","repos_url":"https://api.github.com/users/ssahani/repos","events_url":"https://api.github.com/users/ssahani/events{/privacy}","received_events_url":"https://api.github.com/users/ssahani/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ssahani/systemd","description":"systemd upstream","fork":true,"url":"https://api.github.com/repos/ssahani/systemd","forks_url":"https://api.github.com/repos/ssahani/systemd/forks","keys_url":"https://api.github.com/repos/ssahani/systemd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ssahani/systemd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ssahani/systemd/teams","hooks_url":"https://api.github.com/repos/ssahani/systemd/hooks","issue_events_url":"https://api.github.com/repos/ssahani/systemd/issues/events{/number}","events_url":"https://api.github.com/repos/ssahani/systemd/events","assignees_url":"https://api.github.com/repos/ssahani/systemd/assignees{/user}","branches_url":"https://api.github.com/repos/ssahani/systemd/branches{/branch}","tags_url":"https://api.github.com/repos/ssahani/systemd/tags","blobs_url":"https://api.github.com/repos/ssahani/systemd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ssahani/systemd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ssahani/systemd/git/refs{/sha}","trees_url":"https://api.github.com/repos/ssahani/systemd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ssahani/systemd/statuses/{sha}","languages_url":"https://api.github.com/repos/ssahani/systemd/languages","stargazers_url":"https://api.github.com/repos/ssahani/systemd/stargazers","contributors_url":"https://api.github.com/repos/ssahani/systemd/contributors","subscribers_url":"https://api.github.com/repos/ssahani/systemd/subscribers","subscription_url":"https://api.github.com/repos/ssahani/systemd/subscription","commits_url":"https://api.github.com/repos/ssahani/systemd/commits{/sha}","git_commits_url":"https://api.github.com/repos/ssahani/systemd/git/commits{/sha}","comments_url":"https://api.github.com/repos/ssahani/systemd/comments{/number}","issue_comment_url":"https://api.github.com/repos/ssahani/systemd/issues/comments{/number}","contents_url":"https://api.github.com/repos/ssahani/systemd/contents/{+path}","compare_url":"https://api.github.com/repos/ssahani/systemd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ssahani/systemd/merges","archive_url":"https://api.github.com/repos/ssahani/systemd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ssahani/systemd/downloads","issues_url":"https://api.github.com/repos/ssahani/systemd/issues{/number}","pulls_url":"https://api.github.com/repos/ssahani/systemd/pulls{/number}","milestones_url":"https://api.github.com/repos/ssahani/systemd/milestones{/number}","notifications_url":"https://api.github.com/repos/ssahani/systemd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ssahani/systemd/labels{/name}","releases_url":"https://api.github.com/repos/ssahani/systemd/releases{/id}","deployments_url":"https://api.github.com/repos/ssahani/systemd/deployments","created_at":"2015-06-10T04:14:27Z","updated_at":"2016-01-11T03:59:35Z","pushed_at":"2016-08-22T13:25:34Z","git_url":"git://github.com/ssahani/systemd.git","ssh_url":"git@github.com:ssahani/systemd.git","clone_url":"https://github.com/ssahani/systemd.git","svn_url":"https://github.com/ssahani/systemd","homepage":"http://www.freedesktop.org/wiki/Software/systemd/","size":68570,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"systemd:master","ref":"master","sha":"05b4d3b55c0a60aa17817d51129f2bc83914c1f4","user":{"login":"systemd","id":1918868,"avatar_url":"https://avatars.githubusercontent.com/u/1918868?v=3","gravatar_id":"","url":"https://api.github.com/users/systemd","html_url":"https://github.com/systemd","followers_url":"https://api.github.com/users/systemd/followers","following_url":"https://api.github.com/users/systemd/following{/other_user}","gists_url":"https://api.github.com/users/systemd/gists{/gist_id}","starred_url":"https://api.github.com/users/systemd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemd/subscriptions","organizations_url":"https://api.github.com/users/systemd/orgs","repos_url":"https://api.github.com/users/systemd/repos","events_url":"https://api.github.com/users/systemd/events{/privacy}","received_events_url":"https://api.github.com/users/systemd/received_events","type":"Organization","site_admin":false},"repo":{"id":32873313,"name":"systemd","full_name":"systemd/systemd","owner":{"login":"systemd","id":1918868,"avatar_url":"https://avatars.githubusercontent.com/u/1918868?v=3","gravatar_id":"","url":"https://api.github.com/users/systemd","html_url":"https://github.com/systemd","followers_url":"https://api.github.com/users/systemd/followers","following_url":"https://api.github.com/users/systemd/following{/other_user}","gists_url":"https://api.github.com/users/systemd/gists{/gist_id}","starred_url":"https://api.github.com/users/systemd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemd/subscriptions","organizations_url":"https://api.github.com/users/systemd/orgs","repos_url":"https://api.github.com/users/systemd/repos","events_url":"https://api.github.com/users/systemd/events{/privacy}","received_events_url":"https://api.github.com/users/systemd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/systemd/systemd","description":"systemd upstream","fork":false,"url":"https://api.github.com/repos/systemd/systemd","forks_url":"https://api.github.com/repos/systemd/systemd/forks","keys_url":"https://api.github.com/repos/systemd/systemd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/systemd/systemd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/systemd/systemd/teams","hooks_url":"https://api.github.com/repos/systemd/systemd/hooks","issue_events_url":"https://api.github.com/repos/systemd/systemd/issues/events{/number}","events_url":"https://api.github.com/repos/systemd/systemd/events","assignees_url":"https://api.github.com/repos/systemd/systemd/assignees{/user}","branches_url":"https://api.github.com/repos/systemd/systemd/branches{/branch}","tags_url":"https://api.github.com/repos/systemd/systemd/tags","blobs_url":"https://api.github.com/repos/systemd/systemd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/systemd/systemd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/systemd/systemd/git/refs{/sha}","trees_url":"https://api.github.com/repos/systemd/systemd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/systemd/systemd/statuses/{sha}","languages_url":"https://api.github.com/repos/systemd/systemd/languages","stargazers_url":"https://api.github.com/repos/systemd/systemd/stargazers","contributors_url":"https://api.github.com/repos/systemd/systemd/contributors","subscribers_url":"https://api.github.com/repos/systemd/systemd/subscribers","subscription_url":"https://api.github.com/repos/systemd/systemd/subscription","commits_url":"https://api.github.com/repos/systemd/systemd/commits{/sha}","git_commits_url":"https://api.github.com/repos/systemd/systemd/git/commits{/sha}","comments_url":"https://api.github.com/repos/systemd/systemd/comments{/number}","issue_comment_url":"https://api.github.com/repos/systemd/systemd/issues/comments{/number}","contents_url":"https://api.github.com/repos/systemd/systemd/contents/{+path}","compare_url":"https://api.github.com/repos/systemd/systemd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/systemd/systemd/merges","archive_url":"https://api.github.com/repos/systemd/systemd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/systemd/systemd/downloads","issues_url":"https://api.github.com/repos/systemd/systemd/issues{/number}","pulls_url":"https://api.github.com/repos/systemd/systemd/pulls{/number}","milestones_url":"https://api.github.com/repos/systemd/systemd/milestones{/number}","notifications_url":"https://api.github.com/repos/systemd/systemd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/systemd/systemd/labels{/name}","releases_url":"https://api.github.com/repos/systemd/systemd/releases{/id}","deployments_url":"https://api.github.com/repos/systemd/systemd/deployments","created_at":"2015-03-25T15:27:27Z","updated_at":"2016-08-22T09:21:10Z","pushed_at":"2016-08-22T13:25:34Z","git_url":"git://github.com/systemd/systemd.git","ssh_url":"git@github.com:systemd/systemd.git","clone_url":"https://github.com/systemd/systemd.git","svn_url":"https://github.com/systemd/systemd","homepage":"http://www.freedesktop.org/wiki/Software/systemd/","size":73562,"stargazers_count":1283,"watchers_count":1283,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":544,"mirror_url":null,"open_issues_count":419,"forks":544,"open_issues":419,"watchers":1283,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/systemd/systemd/pulls/4017"},"html":{"href":"https://github.com/systemd/systemd/pull/4017"},"issue":{"href":"https://api.github.com/repos/systemd/systemd/issues/4017"},"comments":{"href":"https://api.github.com/repos/systemd/systemd/issues/4017/comments"},"review_comments":{"href":"https://api.github.com/repos/systemd/systemd/pulls/4017/comments"},"review_comment":{"href":"https://api.github.com/repos/systemd/systemd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/systemd/systemd/pulls/4017/commits"},"statuses":{"href":"https://api.github.com/repos/systemd/systemd/statuses/67d7574ef81db69696a049f08d18c8e8560a6036"}}}}
{"actor":{"display_login":"ssahani"}}