aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dev_iavf
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dev_iavf')
-rw-r--r--src/plugins/dev_iavf/port.c13
-rw-r--r--src/plugins/dev_iavf/virtchnl_funcs.h4
2 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/dev_iavf/port.c b/src/plugins/dev_iavf/port.c
index 7e4200ab37c..f1578fccb59 100644
--- a/src/plugins/dev_iavf/port.c
+++ b/src/plugins/dev_iavf/port.c
@@ -91,7 +91,7 @@ iavf_port_init_rss (vlib_main_t *vm, vnet_dev_port_t *port)
.key_len = keylen,
};
- clib_memcpy (key->key, default_rss_key, sizeof (default_rss_key));
+ clib_memcpy (key->key, default_rss_key, keylen);
return iavf_vc_op_config_rss_key (vm, dev, key);
}
@@ -425,17 +425,20 @@ iavf_port_add_del_eth_addr (vlib_main_t *vm, vnet_dev_port_t *port,
int is_primary)
{
iavf_port_t *ap = vnet_dev_get_port_data (port);
- virtchnl_ether_addr_list_t al = {
+ u8 buffer[VIRTCHNL_MSG_SZ (virtchnl_ether_addr_list_t, list, 1)];
+ virtchnl_ether_addr_list_t *al = (virtchnl_ether_addr_list_t *) buffer;
+
+ *al = (virtchnl_ether_addr_list_t){
.vsi_id = ap->vsi_id,
.num_elements = 1,
.list[0].primary = is_primary ? 1 : 0,
.list[0].extra = is_primary ? 0 : 1,
};
- clib_memcpy (al.list[0].addr, addr, sizeof (al.list[0].addr));
+ clib_memcpy (al->list[0].addr, addr, sizeof (al->list[0].addr));
- return is_add ? iavf_vc_op_add_eth_addr (vm, port->dev, &al) :
- iavf_vc_op_del_eth_addr (vm, port->dev, &al);
+ return is_add ? iavf_vc_op_add_eth_addr (vm, port->dev, al) :
+ iavf_vc_op_del_eth_addr (vm, port->dev, al);
}
static vnet_dev_rv_t
diff --git a/src/plugins/dev_iavf/virtchnl_funcs.h b/src/plugins/dev_iavf/virtchnl_funcs.h
index e7f3901e0ee..0d4ab2835f4 100644
--- a/src/plugins/dev_iavf/virtchnl_funcs.h
+++ b/src/plugins/dev_iavf/virtchnl_funcs.h
@@ -9,6 +9,10 @@
#include <vnet/dev/dev.h>
#include <dev_iavf/iavf.h>
+/* The "+ 1" fakes a trailing element, but the driver requires that.
+ * Using this "wrong" macro is the easiest solution, as long as
+ * port.c uses buffer sized by the same macro as the functions here.
+ */
#define VIRTCHNL_MSG_SZ(s, e, n) STRUCT_OFFSET_OF (s, e[(n) + 1])
typedef struct