提交 013c000a 编写于 作者: R Roopa Prabhu 提交者: Stefan Berger

802.1Qbh: Add support for IFLA_VF_MAC

Current code does not pass VM mac address to a 802.1Qbh direct attach
interface using IFLA_VF_MAC.  This patch adds support in macvtap code to
send IFLA_VF_MAC netlink request during port profile association on a
802.1Qbh interface.

Stefan Cc'ed for comments because this patch changes a condition for
802.1Qbg

802.1Qbh support for IFLA_VF_MAC in enic driver has been posted and is
pending acceptance at http://marc.info/?l=linux-netdev&m=129185244410557&w=2
上级 e8d05c97
......@@ -140,6 +140,7 @@ Patches have also been contributed by:
Laurent Léonard <laurent@open-minds.org>
MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Josh Durgin <joshd@hq.newdream.net>
Roopa Prabhu <roprabhu@cisco.com>
[....send patches to get your name here....]
......
......@@ -1031,19 +1031,8 @@ doPortProfileOpSetLink(bool nltarget_kernel,
nla_put(nl_msg, IFLA_IFNAME, strlen(ifname)+1, ifname) < 0)
goto buffer_too_small;
if (macaddr && vlanid >= 0) {
if (macaddr || vlanid >= 0) {
struct nlattr *vfinfolist, *vfinfo;
struct ifla_vf_mac ifla_vf_mac = {
.vf = vf,
.mac = { 0, },
};
struct ifla_vf_vlan ifla_vf_vlan = {
.vf = vf,
.vlan = vlanid,
.qos = 0,
};
memcpy(ifla_vf_mac.mac, macaddr, 6);
if (!(vfinfolist = nla_nest_start(nl_msg, IFLA_VFINFO_LIST)))
goto buffer_too_small;
......@@ -1051,13 +1040,30 @@ doPortProfileOpSetLink(bool nltarget_kernel,
if (!(vfinfo = nla_nest_start(nl_msg, IFLA_VF_INFO)))
goto buffer_too_small;
if (!nla_put(nl_msg, IFLA_VF_MAC, sizeof(ifla_vf_mac),
&ifla_vf_mac) < 0)
goto buffer_too_small;
if (macaddr) {
struct ifla_vf_mac ifla_vf_mac = {
.vf = vf,
.mac = { 0, },
};
if (!nla_put(nl_msg, IFLA_VF_VLAN, sizeof(ifla_vf_vlan),
&ifla_vf_vlan) < 0)
goto buffer_too_small;
memcpy(ifla_vf_mac.mac, macaddr, 6);
if (!nla_put(nl_msg, IFLA_VF_MAC, sizeof(ifla_vf_mac),
&ifla_vf_mac) < 0)
goto buffer_too_small;
}
if (vlanid >= 0) {
struct ifla_vf_vlan ifla_vf_vlan = {
.vf = vf,
.vlan = vlanid,
.qos = 0,
};
if (!nla_put(nl_msg, IFLA_VF_VLAN, sizeof(ifla_vf_vlan),
&ifla_vf_vlan) < 0)
goto buffer_too_small;
}
nla_nest_end(nl_msg, vfinfo);
nla_nest_end(nl_msg, vfinfolist);
......@@ -1402,6 +1408,7 @@ getPhysfn(const char *linkdev,
static int
doPortProfileOp8021Qbh(const char *ifname,
const unsigned char *macaddr,
const virVirtualPortProfileParamsPtr virtPort,
const unsigned char *vm_uuid,
enum virVirtualPortOp virtPortOp)
......@@ -1411,6 +1418,7 @@ doPortProfileOp8021Qbh(const char *ifname,
# ifndef IFLA_VF_PORT_MAX
(void)ifname;
(void)macaddr;
(void)virtPort;
(void)vm_uuid;
(void)virtPortOp;
......@@ -1426,7 +1434,6 @@ doPortProfileOp8021Qbh(const char *ifname,
bool nltarget_kernel = true;
int ifindex;
int vlanid = -1;
const unsigned char *macaddr = NULL;
rc = getPhysfn(ifname, &vf, &physfndev);
if (rc)
......@@ -1456,7 +1463,7 @@ doPortProfileOp8021Qbh(const char *ifname,
/* Association timed out, disassociate */
doPortProfileOpCommon(nltarget_kernel, NULL, ifindex,
NULL,
0,
vlanid,
NULL,
NULL,
NULL,
......@@ -1470,7 +1477,7 @@ doPortProfileOp8021Qbh(const char *ifname,
case DISASSOCIATE:
rc = doPortProfileOpCommon(nltarget_kernel, NULL, ifindex,
NULL,
0,
vlanid,
NULL,
NULL,
NULL,
......@@ -1545,9 +1552,8 @@ vpAssociatePortProfileId(const char *macvtap_ifname,
/* avoid associating twice */
if (vmOp == VIR_VM_OP_MIGRATE_IN_FINISH)
break;
rc = doPortProfileOp8021Qbh(linkdev, virtPort,
vmuuid,
ASSOCIATE);
rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
virtPort, vmuuid, ASSOCIATE);
break;
}
......@@ -1594,9 +1600,8 @@ vpDisassociatePortProfileId(const char *macvtap_ifname,
/* avoid disassociating twice */
if (vmOp == VIR_VM_OP_MIGRATE_IN_FINISH)
break;
rc = doPortProfileOp8021Qbh(linkdev, virtPort,
NULL,
DISASSOCIATE);
rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
virtPort, NULL, DISASSOCIATE);
break;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册