From: Stephen Hemminger Date: Thu, 11 Jun 2015 15:53:25 +0000 (-0700) Subject: virtio: do not set mac table unless negotiated X-Git-Tag: spdx-start~9119 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2704623620fa725ce511f7393466cc5703e451e6;p=dpdk.git virtio: do not set mac table unless negotiated Don't attempt to set the MAC address table unless the host allows it in feature negotiation. Also, don't return a value from mac_table_set since all callers ignore the return value. Signed-off-by: Stephen Hemminger Acked-by: Changchun Ouyang --- diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 395df12fa0..ebf91d8204 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -668,7 +668,7 @@ virtio_get_hwaddr(struct virtio_hw *hw) } } -static int +static void virtio_mac_table_set(struct virtio_hw *hw, const struct virtio_net_ctrl_mac *uc, const struct virtio_net_ctrl_mac *mc) @@ -676,6 +676,11 @@ virtio_mac_table_set(struct virtio_hw *hw, struct virtio_pmd_ctrl ctrl; int err, len[2]; + if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) { + PMD_DRV_LOG(INFO, "host does not support mac table\n"); + return; + } + ctrl.hdr.class = VIRTIO_NET_CTRL_MAC; ctrl.hdr.cmd = VIRTIO_NET_CTRL_MAC_TABLE_SET; @@ -688,8 +693,6 @@ virtio_mac_table_set(struct virtio_hw *hw, err = virtio_send_command(hw->cvq, &ctrl, len, 2); if (err != 0) PMD_DRV_LOG(NOTICE, "mac table set failed: %d", err); - - return err; } static void