diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2012-07-16 21:48:39 +0100 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2012-07-16 23:25:37 +0100 |
commit | b982755ffffb67ef8c5738707fbf8a1a8685d99b (patch) | |
tree | c8e06879452947c938658474c2490ee69fe28aee | |
parent | b17dcb99726427b6f7a26be8c46023c5d7d15e08 (diff) | |
download | ethtool-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.c | 60 |
1 files changed, 33 insertions, 27 deletions
@@ -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"); |