summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-07-16 21:48:39 +0100
committerBen Hutchings <bhutchings@solarflare.com>2012-07-16 23:25:37 +0100
commitb982755ffffb67ef8c5738707fbf8a1a8685d99b (patch)
treec8e06879452947c938658474c2490ee69fe28aee
parentb17dcb99726427b6f7a26be8c46023c5d7d15e08 (diff)
downloadethtool-b982755ffffb67ef8c5738707fbf8a1a8685d99b.tar.gz
Remove bogus error message when changing offload settings on Linux < 2.6.39
We should not be checking for fixed features when we have no information about which are fixed. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r--ethtool.c60
1 files changed, 33 insertions, 27 deletions
diff --git a/ethtool.c b/ethtool.c
index 3c34273..b424756 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1962,39 +1962,45 @@ static int do_sfeatures(struct cmd_context *ctx)
if (!old_state)
return 1;
- /* For each offload that the user specified, update any
- * related features that the user did not specify and that
- * are not fixed. Warn if all related features are fixed.
- */
- for (i = 0; i < ARRAY_SIZE(off_flag_def); i++) {
- int fixed = 1;
-
- if (!(off_flags_mask & off_flag_def[i].value))
- continue;
+ if (efeatures) {
+ /* For each offload that the user specified, update any
+ * related features that the user did not specify and that
+ * are not fixed. Warn if all related features are fixed.
+ */
+ for (i = 0; i < ARRAY_SIZE(off_flag_def); i++) {
+ int fixed = 1;
- for (j = 0; j < defs->n_features; j++) {
- if (defs->def[j].off_flag_index != i ||
- !FEATURE_BIT_IS_SET(old_state->features.features,
- j, available) ||
- FEATURE_BIT_IS_SET(old_state->features.features,
- j, never_changed))
+ if (!(off_flags_mask & off_flag_def[i].value))
continue;
- fixed = 0;
- if (!FEATURE_BIT_IS_SET(efeatures->features, j, valid)) {
- FEATURE_BIT_SET(efeatures->features, j, valid);
- if (off_flags_wanted & off_flag_def[i].value)
- FEATURE_BIT_SET(efeatures->features, j,
- requested);
+ for (j = 0; j < defs->n_features; j++) {
+ if (defs->def[j].off_flag_index != i ||
+ !FEATURE_BIT_IS_SET(
+ old_state->features.features,
+ j, available) ||
+ FEATURE_BIT_IS_SET(
+ old_state->features.features,
+ j, never_changed))
+ continue;
+
+ fixed = 0;
+ if (!FEATURE_BIT_IS_SET(efeatures->features,
+ j, valid)) {
+ FEATURE_BIT_SET(efeatures->features,
+ j, valid);
+ if (off_flags_wanted &
+ off_flag_def[i].value)
+ FEATURE_BIT_SET(
+ efeatures->features,
+ j, requested);
+ }
}
- }
- if (fixed)
- fprintf(stderr, "Cannot change %s\n",
- off_flag_def[i].long_name);
- }
+ if (fixed)
+ fprintf(stderr, "Cannot change %s\n",
+ off_flag_def[i].long_name);
+ }
- if (efeatures) {
err = send_ioctl(ctx, efeatures);
if (err < 0) {
perror("Cannot set device feature settings");