[dpdk-dev] [PATCH 3/5] virtio: don't set mac table unless negotiated

2015-06-12 Thread Ouyang, Changchun


> -Original Message-
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Thursday, June 11, 2015 11:53 PM
> To: Ouyang, Changchun
> Cc: dev at dpdk.org; Stephen Hemminger; Stephen Hemminger
> Subject: [PATCH 3/5] virtio: don't set mac table unless negotiated
> 
> From: Stephen Hemminger 
> 
> 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


[dpdk-dev] [PATCH 3/5] virtio: don't set mac table unless negotiated

2015-06-11 Thread Stephen Hemminger
From: Stephen Hemminger 

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 
---
 drivers/net/virtio/virtio_ethdev.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index 3476ad3..ad49fc1 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, , len, 2);
if (err != 0)
PMD_DRV_LOG(NOTICE, "mac table set failed: %d", err);
-
-   return err;
 }

 static void
-- 
2.1.4



[dpdk-dev] [PATCH 3/5] virtio: don't set mac table unless negotiated

2015-04-16 Thread Ouyang, Changchun


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Wednesday, April 15, 2015 11:20 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH 3/5] virtio: don't set mac table unless negotiated
> 
> Don't attempt to set the MAC address table unless the host allows it.
> 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 


[dpdk-dev] [PATCH 3/5] virtio: don't set mac table unless negotiated

2015-04-15 Thread Stephen Hemminger
Don't attempt to set the MAC address table unless the host allows it.
Also, don't return a value from mac_table_set since all callers
ignore the return value.

Signed-off-by: Stephen Hemminger 
---
 lib/librte_pmd_virtio/virtio_ethdev.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c 
b/lib/librte_pmd_virtio/virtio_ethdev.c
index f0859d8..3cb9c6a 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_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, , len, 2);
if (err != 0)
PMD_DRV_LOG(NOTICE, "mac table set failed: %d", err);
-
-   return err;
 }

 static void
-- 
2.1.4