Message ID | 1516110120-32132-2-git-send-email-galp@mellanox.com |
---|---|
State | Accepted, archived |
Delegated to: | stephen hemminger |
Headers | show |
Series | Fixes for minimum/maximum VF rate API | expand |
diff --git a/ip/iplink.c b/ip/iplink.c index 4c96711..22c9a29 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -539,6 +539,14 @@ static int iplink_parse_vf(int vf, int *argcp, char ***argvp, if (tivt.max_tx_rate == -1) tivt.max_tx_rate = tmax; } + + if (tivt.max_tx_rate && tivt.min_tx_rate > tivt.max_tx_rate) { + fprintf(stderr, + "Invalid min_tx_rate %d - must be <= max_tx_rate %d\n", + tivt.min_tx_rate, tivt.max_tx_rate); + return -1; + } + addattr_l(&req->n, sizeof(*req), IFLA_VF_RATE, &tivt, sizeof(tivt)); }