[dpdk-dev] [PATCH v2 2/2] drivers/net/vmxnet3: add ethdev functions
Yong Wang
yongwang at vmware.com
Fri Mar 4 20:12:02 CET 2016
On 3/4/16, 7:25 AM, "Remy Horton" <remy.horton at intel.com> wrote:
>Implements driver support for setting of MAC address.
>
>Signed-off-by: Remy Horton <remy.horton at intel.com>
Acked-by: Yong Wang <yongwang at vmware.com>
mac_hi is not initialized so the upper 16bits are random when calling
VMXNET3_WRITE_BAR1_REG(). The handler of the mac changing ignores
them so it should be fine.
>---
> doc/guides/rel_notes/release_16_04.rst | 4 ++++
> drivers/net/vmxnet3/vmxnet3_ethdev.c | 19 +++++++++++++++++++
> 2 files changed, 23 insertions(+)
>
>diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
>index 4e0112e..39db674 100644
>--- a/doc/guides/rel_notes/release_16_04.rst
>+++ b/doc/guides/rel_notes/release_16_04.rst
>@@ -62,6 +62,10 @@ This section should contain new features added in this release. Sample format:
> Implemented driver functions for Register dumping, EEPROM dumping, and
> setting of MAC address.
>
>+* **vmxnet3: Added ethdev support functions.**
>+
>+ Implemented driver functionality for setting MAC address.
>+
>
> Resolved Issues
> ---------------
>diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>index c363bf6..bc83524 100644
>--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
>+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
>@@ -91,6 +91,8 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev,
> static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask);
> static void vmxnet3_dev_vlan_offload_set_clear(struct rte_eth_dev *dev,
> int mask, int clear);
>+static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
>+ struct ether_addr *mac_addr);
>
> #if PROCESS_SYS_EVENTS == 1
> static void vmxnet3_process_events(struct vmxnet3_hw *);
>@@ -124,6 +126,7 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = {
> .rx_queue_release = vmxnet3_dev_rx_queue_release,
> .tx_queue_setup = vmxnet3_dev_tx_queue_setup,
> .tx_queue_release = vmxnet3_dev_tx_queue_release,
>+ .mac_addr_set = vmxnet3_mac_addr_set,
> };
>
> static const struct rte_memzone *
>@@ -922,6 +925,22 @@ vmxnet3_process_events(struct vmxnet3_hw *hw)
> }
> #endif
>
>+static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
>+ struct ether_addr *mac_addr)
>+{
>+ struct vmxnet3_hw *hw = dev->data->dev_private;
>+ uint32_t mac_hi, mac_lo;
>+
>+ if (!is_valid_assigned_ether_addr(mac_addr)) {
>+ PMD_DRV_LOG(ERR, "Tried to set invalid MAC address.");
>+ return;
>+ }
>+ memcpy(&mac_lo, mac_addr, 4);
>+ memcpy(&mac_hi, mac_addr + 4, 2);
>+ VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, mac_lo);
>+ VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, mac_hi);
>+}
>+
> static struct rte_driver rte_vmxnet3_driver = {
> .type = PMD_PDEV,
> .init = rte_vmxnet3_pmd_init,
>--
>2.5.0
>
More information about the dev
mailing list