From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Greg Rose <gregory.v.rose@intel.com>,
davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next] iproute2: Add new command to IP link to enable/disable VF spoof check
Date: Sun, 25 Sep 2011 01:23:18 -0700 [thread overview]
Message-ID: <1316938998-29855-1-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
From: Greg Rose <gregory.v.rose@intel.com>
Add IP link command parsing for VF spoof checking enable/disable
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
include/linux/if_link.h | 7 +++++++
ip/ipaddress.c | 6 ++++++
ip/iplink.c | 15 +++++++++++++++
man/man8/ip.8 | 4 +++-
4 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 304c44f..e421f60 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -277,6 +277,7 @@ enum {
IFLA_VF_MAC, /* Hardware queue specific attributes */
IFLA_VF_VLAN,
IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
+ IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
__IFLA_VF_MAX,
};
@@ -298,12 +299,18 @@ struct ifla_vf_tx_rate {
__u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
};
+struct ifla_vf_spoofchk {
+ __u32 vf;
+ __u32 setting;
+};
+
struct ifla_vf_info {
__u32 vf;
__u8 mac[32];
__u32 vlan;
__u32 qos;
__u32 tx_rate;
+ __u32 spoofchk;
};
/* VF ports management section
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 85f05a2..7e6ac50 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -197,6 +197,7 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
struct ifla_vf_mac *vf_mac;
struct ifla_vf_vlan *vf_vlan;
struct ifla_vf_tx_rate *vf_tx_rate;
+ struct ifla_vf_spoofchk *vf_spoofchk;
struct rtattr *vf[IFLA_VF_MAX+1];
SPRINT_BUF(b1);
@@ -210,6 +211,7 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
vf_mac = RTA_DATA(vf[IFLA_VF_MAC]);
vf_vlan = RTA_DATA(vf[IFLA_VF_VLAN]);
vf_tx_rate = RTA_DATA(vf[IFLA_VF_TX_RATE]);
+ vf_spoofchk = RTA_DATA(vf[IFLA_VF_SPOOFCHK]);
fprintf(fp, "\n vf %d MAC %s", vf_mac->vf,
ll_addr_n2a((unsigned char *)&vf_mac->mac,
@@ -220,6 +222,10 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
fprintf(fp, ", qos %d", vf_vlan->qos);
if (vf_tx_rate->rate)
fprintf(fp, ", tx rate %d (Mbps)", vf_tx_rate->rate);
+ if (vf_spoofchk->setting)
+ fprintf(fp, ", spoof checking on");
+ else
+ fprintf(fp, ", spoof checking off");
}
int print_linkinfo(const struct sockaddr_nl *who,
diff --git a/ip/iplink.c b/ip/iplink.c
index e5325a6..f4a5243 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -71,7 +71,10 @@ void iplink_usage(void)
fprintf(stderr, " [ alias NAME ]\n");
fprintf(stderr, " [ vf NUM [ mac LLADDR ]\n");
fprintf(stderr, " [ vlan VLANID [ qos VLAN-QOS ] ]\n");
+
fprintf(stderr, " [ rate TXRATE ] ] \n");
+
+ fprintf(stderr, " [ spoofchk { on | off} ] ] \n");
fprintf(stderr, " [ master DEVICE ]\n");
fprintf(stderr, " [ nomaster ]\n");
fprintf(stderr, " ip link show [ DEVICE | group GROUP ]\n");
@@ -228,6 +231,18 @@ int iplink_parse_vf(int vf, int *argcp, char ***argvp,
ivt.vf = vf;
addattr_l(&req->n, sizeof(*req), IFLA_VF_TX_RATE, &ivt, sizeof(ivt));
+ } else if (matches(*argv, "spoofchk") == 0) {
+ struct ifla_vf_spoofchk ivs;
+ NEXT_ARG();
+ if (matches(*argv, "on") == 0)
+ ivs.setting = 1;
+ else if (matches(*argv, "off") == 0)
+ ivs.setting = 0;
+ else
+ invarg("Invalid \"spoofchk\" value\n", *argv);
+ ivs.vf = vf;
+ addattr_l(&req->n, sizeof(*req), IFLA_VF_SPOOFCHK, &ivs, sizeof(ivs));
+
} else {
/* rewind arg */
PREV_ARG();
diff --git a/man/man8/ip.8 b/man/man8/ip.8
index 27993a4..cd7b97a 100644
--- a/man/man8/ip.8
+++ b/man/man8/ip.8
@@ -100,7 +100,9 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
.B qos
.IR VLAN-QOS " ] ] ["
.B rate
-.IR TXRATE " ] |"
+.IR TXRATE " ] ["
+.B spoofchk { on | off }
+] |
.br
.B master
.IR DEVICE
--
1.7.6.2
next reply other threads:[~2011-09-25 8:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-25 8:23 Jeff Kirsher [this message]
2011-09-25 17:23 ` [net-next] iproute2: Add new command to IP link to enable/disable VF spoof check Stephen Hemminger
2011-09-26 16:21 ` Rose, Gregory V
2011-09-26 16:41 ` Ben Hutchings
2011-09-26 16:47 ` Stephen Hemminger
2011-09-26 16:58 ` Rose, Gregory V
2011-09-26 20:54 ` Christian Benvenuti (benve)
2011-09-26 21:00 ` David Miller
2011-09-26 21:19 ` Stephen Hemminger
2011-09-26 21:27 ` David Miller
2011-11-17 23:39 ` Greg Rose
2011-11-18 0:40 ` Stephen Hemminger
2011-11-18 0:43 ` Greg Rose
2011-11-18 0:45 ` Stephen Hemminger
2011-11-18 17:06 ` Greg Rose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1316938998-29855-1-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=gregory.v.rose@intel.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).