Ethernet driver enhancements
cover Ethernet driver enhancements
Includes replacing existing VMXNET3 driver. Our driver was independently developed based on the OpenSolaris driver (rather than FreeBSD). After evaluation, it wasn't worth fixing the original code; wholesale replacement was lower risk since the driver had been used through the whole product and QA cycle.
PATCH 1/6 Subjec: ethdev: add macro to cover all checksum flags
Convience to allow for devices that handle no checksum offload, but do do VLAN offload.
lib/librte_ether/rte_ethdev.h +6 -3
@@ -510,9 +510,12 @@ struct rte_eth_rxconf {#define ETH_TXQ_FLAGS_NOXSUMSCTP 0x0200/**< disable SCTP checksum offload */ #define ETH_TXQ_FLAGS_NOXSUMUDP 0x0400/**< disable UDP checksum offload */ #define ETH_TXQ_FLAGS_NOXSUMTCP 0x0800/**< disable TCP checksum offload */ -#define ETH_TXQ_FLAGS_NOOFFLOADS \ - (ETH_TXQ_FLAGS_NOVLANOFFL | ETH_TXQ_FLAGS_NOXSUMSCTP | \ - ETH_TXQ_FLAGS_NOXSUMUDP | ETH_TXQ_FLAGS_NOXSUMTCP) +#define ETH_TXQ_FLAGS_NOXSUMS (ETH_TXQ_FLAGS_NOXSUMSCTP | \ + ETH_TXQ_FLAGS_NOXSUMUDP | \ + ETH_TXQ_FLAGS_NOXSUMTCP) +#define ETH_TXQ_FLAGS_NOOFFLOADS (ETH_TXQ_FLAGS_NOVLANOFFL | \ + ETH_TXQ_FLAGS_NOXSUMS) +/** * A structure used to configure a TX ring of an Ethernet port. */
PATCH 2/6 Subjet: ethdev: add common code to atomicly access link
In reply to Stephen HemmingerMany drivers copy/paste same code to atomicly access link information. Add functions to do this instead.
lib/librte_ether/rte_ethdev.h +39 -0
@@ -1704,6 +1704,45 @@ extern void rte_eth_link_get_nowait(uint struct rte_eth_link *link);/** +* @internal +* Retrieve the link status from device in atomic fashion. +*/ +static inline void rte_eth_dev_get_link (struct rte_eth_dev *dev, +struct rte_eth_link *link) +{ +int64_t val; + + val =rte_atomic64_read ((rte_atomic64_t *)&dev->data->dev_link); + +memcpy (link, &val,sizeof (struct rte_eth_link )); +} + +/** +* @internal +* Set the link status from device in atomic fashion. +* Returns non-zero on success; 0 on failure +* Callers should retry on failure +*/ +static inline void rte_eth_dev_set_link (struct rte_eth_dev *dev, +struct rte_eth_link *link) +{ +rte_atomic64_t *dst = (rte_atomic64_t *)&dev->data->dev_link; + +rte_atomic64_set (dst, *(int64_t *)link); +} + +/** +* @internal +* Clear link status. +*/ +static inline void rte_eth_dev_clear_link (struct rte_eth_dev *dev) +{ +rte_atomic64_t *dst = (rte_atomic64_t *)&dev->data->dev_link; + +rte_atomic64_set (dst,0 ); +} + +/** * Retrieve the general I/O statistics of an Ethernet device. * * @param port_id
A message that is not in the archive (sent off-list or not yet received): 20140514185743.414400480-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org
Re: [PATCH 2/6] Subjet: ethdev: add common code to atomicly access link
Hi Stephen,
The new function rte_eth_dev_set_link() below is declared as void. Thus, the comments about its return value are wrong, and should be removed, unless they still refer to a desired behaviour, in which case it is the function itself that should be reworked to invoke rte_atomic64_cmpset and to return its result.
Regards,
Ivan
2014-05-14 20:55 GMT+02:00 Stephen Hemminger <[email protected]>:
Quoted 27 lines
Many drivers copy/paste same code to atomicly access link information. Add functions to do this instead.
Signed-off-by Stephen Hemminger <[email protected]>lib/librte_ether/rte_ethdev.h 2014-05-14 11:27:07.409461720 -0700 +15
-0@@ -1704,6 +1704,45 @@ extern void rte_eth_link_get_nowait(uint struct rte_eth_link *link); + +/** + * @internal + * Set the link status from device in atomic fashion. + * Returns non-zero on success; 0 on failure + * Callers should retry on failure + */ +static inline void rte_eth_dev_set_link(struct rte_eth_dev *dev, + struct rte_eth_link *link) +{ + rte_atomic64_t *dst = (rte_atomic64_t *)&dev->data->dev_link; + + rte_atomic64_set(dst, *(int64_t *)link); +} +
Signature · 3 lines
Ivan BOULE 6WIND Software Engineer
PATCH 3/6 ixgbe: use eth_dev_{get,set}_link
In reply to Stephen HemmingerNew common code can be used, eliminating driver code.
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +8 -66
@@ -56,7 +56,6 @@#include <rte_alarm.h> #include <rte_ether.h> #include <rte_ethdev.h> -#include <rte_atomic.h> #include <rte_malloc.h> #include "ixgbe_logs.h"
@@ -325,58 +324,6 @@ static struct eth_dev_ops ixgbevf_eth_de .tx_queue_release = ixgbe_dev_tx_queue_release, }; -/** -* Atomically reads the link status information from global -* structure rte_eth_dev. -* -* @param dev -* - Pointer to the structure rte_eth_dev to read from. -* - Pointer to the buffer to be saved with the link status. -* -* @return -* - On success, zero. -* - On failure, negative value. -*/ -static inline int -rte_ixgbe_dev_atomic_read_link_status (struct rte_eth_dev *dev, -struct rte_eth_link *link) -{ -struct rte_eth_link *dst = link; -struct rte_eth_link *src = &(dev->data->dev_link); - -if (rte_atomic64_cmpset ((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) ==0 ) -return -1 ; - -return 0 ; -} - -/** -* Atomically writes the link status information into global -* structure rte_eth_dev. -* -* @param dev -* - Pointer to the structure rte_eth_dev to read from. -* - Pointer to the buffer to be saved with the link status. -* -* @return -* - On success, zero. -* - On failure, negative value. -*/ -static inline int -rte_ixgbe_dev_atomic_write_link_status (struct rte_eth_dev *dev, -struct rte_eth_link *link) -{ -struct rte_eth_link *dst = &(dev->data->dev_link); -struct rte_eth_link *src = link; - -if (rte_atomic64_cmpset ((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) ==0 ) -return -1 ; - -return 0 ; -} -/* * This function is the same as ixgbe_is_sfp() in ixgbe/ixgbe.h. */
@@ -1453,7 +1400,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)/* Clear recorded link status */ memset (&link,0 ,sizeof (link)); -rte_ixgbe_dev_atomic_write_link_status (dev, &link); +rte_eth_dev_set_link (dev, &link); }/*
@@ -1764,11 +1711,8 @@ ixgbe_dev_link_update(struct rte_eth_devint link_up;int diag; - link.link_status =0 ; - link.link_speed =0 ; - link.link_duplex =0 ; -memset (&old,0 ,sizeof (old)); -rte_ixgbe_dev_atomic_read_link_status (dev, &old); +memset (&link,0 ,sizeof (link)); +rte_eth_dev_get_link (dev, &old);/* check if it needs to wait to complete, if lsc interrupt is enabled */ if (wait_to_complete ==0 || dev->data->dev_conf.intr_conf.lsc !=0 )
@@ -1778,14 +1722,14 @@ ixgbe_dev_link_update(struct rte_eth_devif (diag !=0 ) { link.link_speed =ETH_LINK_SPEED_100 ; link.link_duplex =ETH_LINK_HALF_DUPLEX ; -rte_ixgbe_dev_atomic_write_link_status (dev, &link); +rte_eth_dev_set_link (dev, &link);if (link.link_status == old.link_status)return -1 ;return 0 ; }if (link_up ==0 ) { -rte_ixgbe_dev_atomic_write_link_status (dev, &link); +rte_eth_dev_set_link (dev, &link);if (link.link_status == old.link_status)return -1 ;return 0 ;
@@ -1812,7 +1756,7 @@ ixgbe_dev_link_update(struct rte_eth_dev link.link_speed =ETH_LINK_SPEED_10000 ;break ; } -rte_ixgbe_dev_atomic_write_link_status (dev, &link); +rte_eth_dev_set_link (dev, &link);if (link.link_status == old.link_status)return -1 ;
@@ -1946,8 +1890,7 @@ ixgbe_dev_link_status_print(struct rte_e {struct rte_eth_link link; -memset (&link,0 ,sizeof (link)); -rte_ixgbe_dev_atomic_read_link_status (dev, &link); +rte_eth_dev_get_link (dev, &link);if (link.link_status) { PMD_INIT_LOG(INFO, "Port %d: Link Up - speed %u Mbps - %s", (int)(dev->data->port_id),
@@ -1993,8 +1936,7 @@ ixgbe_dev_interrupt_action(struct rte_etif (intr->flags &IXGBE_FLAG_NEED_LINK_UPDATE ) {/* get the link status before link update, for predicting later */ -memset (&link,0 ,sizeof (link)); -rte_ixgbe_dev_atomic_read_link_status (dev, &link); +rte_eth_dev_get_link (dev, &link);ixgbe_dev_link_update (dev,0 );
PATCH 4/6 e1000: use eth_dev_{get,set}_link
In reply to Stephen HemmingerNew common code can be used, eliminating driver code.
lib/librte_pmd_e1000/em_ethdev.c +5 -58
@@ -157,58 +157,6 @@ static struct eth_dev_ops eth_em_ops = { .mac_addr_remove = eth_em_rar_clear, }; -/** -* Atomically reads the link status information from global -* structure rte_eth_dev. -* -* @param dev -* - Pointer to the structure rte_eth_dev to read from. -* - Pointer to the buffer to be saved with the link status. -* -* @return -* - On success, zero. -* - On failure, negative value. -*/ -static inline int -rte_em_dev_atomic_read_link_status (struct rte_eth_dev *dev, -struct rte_eth_link *link) -{ -struct rte_eth_link *dst = link; -struct rte_eth_link *src = &(dev->data->dev_link); - -if (rte_atomic64_cmpset ((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) ==0 ) -return -1 ; - -return 0 ; -} - -/** -* Atomically writes the link status information into global -* structure rte_eth_dev. -* -* @param dev -* - Pointer to the structure rte_eth_dev to read from. -* - Pointer to the buffer to be saved with the link status. -* -* @return -* - On success, zero. -* - On failure, negative value. -*/ -static inline int -rte_em_dev_atomic_write_link_status (struct rte_eth_dev *dev, -struct rte_eth_link *link) -{ -struct rte_eth_link *dst = &(dev->data->dev_link); -struct rte_eth_link *src = link; - -if (rte_atomic64_cmpset ((uint64_t *)dst, *(uint64_t *)dst, - *(uint64_t *)src) ==0 ) -return -1 ; - -return 0 ; -} -static int eth_em_dev_init (__attribute__((unused))struct eth_driver *eth_drv,struct rte_eth_dev *eth_dev)
@@ -597,7 +545,7 @@ eth_em_stop(struct rte_eth_dev *dev)/* clear the recorded link status */ memset (&link,0 ,sizeof (link)); -rte_em_dev_atomic_write_link_status (dev, &link); +rte_eth_dev_set_link (dev, &link); } static void
@@ -916,8 +864,8 @@ eth_em_link_update(struct rte_eth_dev *dbreak ;rte_delay_ms (EM_LINK_UPDATE_CHECK_INTERVAL ); } -memset (&link,0 ,sizeof (link)); -rte_em_dev_atomic_read_link_status (dev, &link); + +rte_eth_dev_get_link (dev, &link); old = link;/* Now we check if a transition has happened */
@@ -930,7 +878,7 @@ eth_em_link_update(struct rte_eth_dev *d link.link_duplex =0 ; link.link_status =0 ; } -rte_em_dev_atomic_write_link_status (dev, &link); +rte_eth_dev_set_link (dev, &link);/* not changed */ if (old.link_status == link.link_status)
@@ -1281,8 +1229,7 @@ eth_em_interrupt_action(struct rte_eth_dif (ret <0 )return 0 ; -memset (&link,0 ,sizeof (link)); -rte_em_dev_atomic_read_link_status (dev, &link); + rte_eth_dev_get_link(dev, &link)if (link.link_status) { PMD_INIT_LOG(INFO, " Port %d: Link Up - speed %u Mbps - %s\n",
lib/librte_pmd_e1000/igb_ethdev.c +6 -59
101 lines not on this page · raw message
PATCH 5/6 ether: allow setting mac address
In reply to Stephen HemmingerAllow setting the default Ethernet address used on device. The underlying drivers allow it but the DPDK was blocking any attempts to change Ethernet address on device.
For most devices, this is just the same as filling in address in mac address table entry 0, but for some devices this requires special override.
lib/librte_ether/rte_ethdev.h +21 -0
@@ -982,6 +982,11 @@ typedef void (*eth_mac_addr_add_t)(strucstruct ether_addr *mac_addr, uint32_t index, uint32_t vmdq); +/**< @internal Change default MAC address */ + +typedef void (*eth_mac_addr_set_t )(struct rte_eth_dev *dev, +struct ether_addr *mac_addr); +/**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
@@ -1114,6 +1119,7 @@ struct eth_dev_ops {priority_flow_ctrl_set_t priority_flow_ctrl_set;/**< Setup priority flow control.*/ eth_mac_addr_remove_t mac_addr_remove;/**< Remove MAC address */ eth_mac_addr_add_t mac_addr_add;/**< Add a MAC address */ +eth_mac_addr_set_t mac_addr_set;/**< Change default MAC address */ eth_uc_hash_table_set_t uc_hash_table_set;/**< Set Unicast Table Array */ eth_uc_all_hash_table_set_t uc_all_hash_table_set;/**< Set Unicast hash bitmap */ eth_mirror_rule_set_t mirror_rule_set;/**< Add a traffic mirror rule.*/
@@ -2538,6 +2544,21 @@ int rte_eth_dev_mac_addr_add(uint8_t porint rte_eth_dev_mac_addr_remove (uint8_t port,struct ether_addr *mac_addr);/** +* Change the default MAC address +* +* @param port +* The port identifier of the Ethernet device. +* @param mac_addr +* MAC address to remove. +* @return +* - (0) if successfully added or *mac_addr" was already added. +* - (-ENOTSUP) if hardware doesn't support this feature. +* - (-ENODEV) if *port* is invalid. +* - (-EINVAL) if MAC address is invalid. +*/ +int rte_eth_dev_macaddr_set (uint8_t port,struct ether_addr *mac_addr); + +/** * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device. * * @param port
lib/librte_ether/rte_ethdev.c +27 -0
@@ -1059,6 +1059,33 @@ rte_eth_macaddr_get(uint8_t port_id, str }int +rte_eth_dev_macaddr_set (uint8_t port_id,struct ether_addr *addr) +{ +struct rte_eth_dev *dev; + +if (port_id >= nb_ports) { +PMD_DEBUG_TRACE ("Invalid port_id=%d\n" , port_id); +return (-ENODEV ); + } +if (is_zero_ether_addr (addr)) { +PMD_DEBUG_TRACE ("port %d: Cannot add NULL MAC address\n" , port_id); +return (-EINVAL ); + } + dev = &rte_eth_devices[port_id]; + +if (*dev->dev_ops->mac_addr_set) + (*dev->dev_ops->mac_addr_set)(dev, addr); +else { +FUNC_PTR_OR_ERR_RET (*dev->dev_ops->mac_addr_add, -ENOTSUP ); + (*dev->dev_ops->mac_addr_add)(dev, addr,0 ,0 ); + } + +ether_addr_copy (addr, &dev->data->mac_addrs[0 ]); + +return 0 ; +} + +int rte_eth_dev_vlan_filter (uint8_t port_id,uint16_t vlan_id,int on) {struct rte_eth_dev *dev;
A message that is not in the archive (sent off-list or not yet received): 20140514185750.257523699-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org
Re: [PATCH 5/6] ether: allow setting mac address
Hi Stephen,
By default, changing the [current] default MAC address of a device is not equivalent to adding a MAC address to it ! At least, the minimum to do should consist in:
1. checking that the PMD exports both mac_addr_remove()
and mac_addr_add() functions, returning a NON_SUPPORTED error code otherwise,
2. removing the current default MAC address by invoking the PMD'smac_addr_remove() function,
3. adding the new MAC address by invoking the PMD's mac_addr_add()
function.
Regards,
Ivan
2014-05-14 20:55 GMT+02:00 Stephen Hemminger <[email protected]>:
Quoted 102 lines
Allow setting the default Ethernet address used on device. The underlying drivers allow it but the DPDK was blocking any attempts to change Ethernet address on device.
For most devices, this is just the same as filling in address in mac address table entry 0, but for some devices this requires special override.
Signed-off-by Stephen Hemminger <[email protected]>lib/librte_ether/rte_ethdev.h 2014-05-14 11:44:27.373014227 -0700 +5
-0@@ -982,6 +982,11 @@ typedef void (*eth_mac_addr_add_t)(struc struct ether_addr *mac_addr, uint32_t index, uint32_t vmdq); +/**< @internal Change default MAC address */ + +typedef void (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, + struct ether_addr *mac_addr); + /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,@@ -1114,6 +1119,7 @@ struct eth_dev_ops { priority_flow_ctrl_set_t priority_flow_ctrl_set; /**< Setuppriority flow control.*/
eth_mac_addr_remove_tmac_addr_remove; /**< Remove MAC
address */eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address */ + eth_mac_addr_set_t mac_addr_set; /**< Change default MACaddress */
eth_uc_hash_table_set_tuc_hash_table_set; /**< Set Unicast
Table Array */
eth_uc_all_hash_table_set_tuc_all_hash_table_set; /**< Set
Unicast hash bitmap */
eth_mirror_rule_set_tmirror_rule_set; /**< Add a traffic
mirror rule.*/lib/librte_ether/rte_ethdev.h 2014-05-14 11:44:27.373014227 -0700 +15
-0@@ -2538,6 +2544,21 @@ int rte_eth_dev_mac_addr_add(uint8_t por int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr); /** + * Change the default MAC address + * + * @param port + * The port identifier of the Ethernet device. + * @param mac_addr + * MAC address to remove. + * @return + * - (0) if successfully added or *mac_addr" was already added. + * - (-ENOTSUP) if hardware doesn't support this feature. + * - (-ENODEV) if *port* is invalid. + * - (-EINVAL) if MAC address is invalid. + */ +int rte_eth_dev_macaddr_set(uint8_t port, struct ether_addr *mac_addr); + +/** * Update Redirection Table(RETA) of Receive Side Scaling of Ethernetdevice.
*
* @param portlib/librte_ether/rte_ethdev.c 2014-05-14 11:44:27.373014227 -0700 +27
-0@@ -1059,6 +1059,33 @@ rte_eth_macaddr_get(uint8_t port_id, str } int +rte_eth_dev_macaddr_set(uint8_t port_id, struct ether_addr *addr) +{ + struct rte_eth_dev *dev; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return (-ENODEV); + } + if (is_zero_ether_addr(addr)) { + PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n", port_id); + return (-EINVAL); + } + dev = &rte_eth_devices[port_id]; + + if (*dev->dev_ops->mac_addr_set) + (*dev->dev_ops->mac_addr_set)(dev, addr); + else { + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP); + (*dev->dev_ops->mac_addr_add)(dev, addr, 0, 0); + } + + ether_addr_copy(addr, &dev->data->mac_addrs[0]); + + return 0; +} + +int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on) {struct rte_eth_dev *dev;
Signature · 3 lines
Ivan BOULE 6WIND Software Engineer
A message that is not in the archive (sent off-list or not yet received): CAOm6c7qumb3xHT4K0QXzyPBbfXsWTeZLp4pxAKoJT6Dh+VpiHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 5/6] ether: allow setting mac address
Hi Stephen,
Looking more precisely to your patch, I think that your requirement can beaddressed without adding a new mac_addr_set function into the [already overloaded] set of operations exported by a PMD.
In fact, changing the default MAC address used by a port consists in executingthe following sequence of operations:
1- rte_eth_macaddr_get(port_id, &cur_mac_addr) to obtain the
default MACaddress currently used by the port,
2- rte_eth_dev_mac_addr_remove(port_id, &cur_mac_addr) to remove
thedefault MAC address currently used by the port,
3- rte_eth_dev_mac_addr_add(port_id, &new_mac_addr) to add the new
defaultMAC address to be used by the port.
This method takes advantage of the fact that the allocation of a freeentry into the array data->mac_addrs that contains the MAC addresses of a port searches the pool from the entry at index 0, which contains the default MAC address. This implementation simply needs to be mandatory from now.
The actual implementation might look like this.
Add the prototype of the function rte_eth_dev_macaddr_set in the filerte_ethdev.h:
extern int rte_eth_dev_macaddr_set((uint8_t port_id, structether_addr *addr);
And add the following generic implementation of the function rte_eth_dev_macaddr_setin the file rte_ethdev.c:
intrte_eth_dev_macaddr_set(uint8_t port_id, struct ether_addr *addr)
{
struct rte_eth_dev *dev;
struct ether_addr cur_addr;
int diag;
if (port_id >= nb_ports) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
return (-ENODEV);
}
if (is_zero_ether_addr(addr)) {
PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
port_id);
return (-EINVAL);
}
dev = &rte_eth_devices[port_id];
/*
* Check that both mac_addr_remove and mac_addr_add operations are
* supported by the PMD of the port.
*/FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP); FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
rte_eth_macaddr_get(port_id, &cur_addr);
diag = rte_eth_dev_mac_addr_remove(port_id, &cur_addr);
if (diag < 0)
return diag;
return rte_eth_dev_mac_addr_add(port_id, addr);
}Regards,
Ivan
Quoted 131 lines · Ivan Boule
Hi Stephen,
By default, changing the [current] default MAC address of a device is not equivalent to adding a MAC address to it ! At least, the minimum to do should consist in:
1. checking that the PMD exports bothmac_addr_remove()
andmac_addr_add()functions, returning aNON_SUPPORTEDerror code otherwise,
2. removing the current default MAC address by invoking the PMD'smac_addr_remove()function,
3. adding the new MAC address by invoking the PMD'smac_addr_add()
function.Regards,
Ivan2014-05-14 20:55 GMT+02:00 Stephen Hemminger <[email protected] <mailto:[email protected]>>:
Allow setting the default Ethernet address used on device. The underlying drivers allow it but the DPDK was blocking any attempts to change Ethernet address on device.
For most devices, this is just the same as filling in address in mac address table entry 0, but for some devices this requires special override.
Signed-off-by Stephen Hemminger <[email protected]<mailto:[email protected]>>
---
a/lib/librte_ether/rte_ethdev.h2014-05-14
11:44:27.373014227 -0700
+++b/lib/librte_ether/rte_ethdev.h2014-05-14
11:44:27.373014227 -0700
@@ -982,6 +982,11 @@ typedef void (*eth_mac_addr_add_t)(struc
structether_addr*mac_addr,uint32_tindex,uint32_tvmdq);
+/**< @internal Change default MAC address */
+
+typedef void (*eth_mac_addr_set_t)(structrte_eth_dev*dev,
+ structether_addr*mac_addr);
+
/**< @internal Set a MAC address into Receive Address Address
Register */typedef int (*eth_uc_hash_table_set_t)(struct
rte_eth_dev*dev,
@@ -1114,6 +1119,7 @@ structeth_dev_ops{
priority_flow_ctrl_set_tpriority_flow_ctrl_set; /**<
Setup priority flow control.*/
eth_mac_addr_remove_tmac_addr_remove; /**< Remove
MAC address */
eth_mac_addr_add_tmac_addr_add; /**< Add a MAC
address */
+eth_mac_addr_set_tmac_addr_set; /**< Change
default MAC address */
eth_uc_hash_table_set_tuc_hash_table_set; /**< Set
Unicast Table Array */
eth_uc_all_hash_table_set_tuc_all_hash_table_set; /**<
Set Unicast hash bitmap */
eth_mirror_rule_set_tmirror_rule_set; /**< Add a
traffic mirror rule.*/
@@ -2538,6 +2544,21 @@ int rte_eth_dev_mac_addr_add(uint8_t por
int rte_eth_dev_mac_addr_remove(uint8_t port, structether_addr
*mac_addr);/**
+ * Change the default MAC address
+ *
+ * @param port
+ * The port identifier of the Ethernet device.
+ * @parammac_addr
+ * MAC address to remove.
+ * @return
+ * - (0) if successfully added or*mac_addr" was already added.
+ * - (-ENOTSUP) if hardware doesn't support this feature.
+ * - (-ENODEV) if *port* is invalid.
+ * - (-EINVAL) if MAC address is invalid.
+ */
+intrte_eth_dev_macaddr_set(uint8_t port, struct ether_addr *mac_addr);
+
+/**
* Update Redirection Table(RETA) of Receive Side Scaling of
Ethernet device.
*
* @param port
---a/lib/librte_ether/rte_ethdev.c2014-05-14
11:44:27.373014227 -0700
+++b/lib/librte_ether/rte_ethdev.c2014-05-14
11:44:27.373014227 -0700
@@ -1059,6 +1059,33 @@ rte_eth_macaddr_get(uint8_tport_id, str
}int
+rte_eth_dev_macaddr_set(uint8_tport_id, structether_addr*addr) +{
+ structrte_eth_dev*dev;
+
+ if (port_id>=nb_ports) {
+PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+ return (-ENODEV);
+ }
+ if (is_zero_ether_addr(addr)) {
+ PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC
address\n",port_id);
+ return (-EINVAL);
+ }
+ dev = &rte_eth_devices[port_id];
+
+ if (*dev->dev_ops->mac_addr_set)
+ (*dev->dev_ops->mac_addr_set)(dev, addr);
+ else {
+FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
+ (*dev->dev_ops->mac_addr_add)(dev, addr, 0, 0);
+ }
+
+ether_addr_copy(addr, &dev->data->mac_addrs[0]);
+
+ return 0;
+}
+
+int
rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on){
structrte_eth_dev*dev;Signature · 3 lines
Ivan BOULE 6WIND Software Engineer
Signature · 2 lines
Ivan Boule 6WIND Development Engineer
PATCH 6/6 vmxnet3: replace Intel driver
In reply to Stephen HemmingerReplace the Intel VMXNET3 driver with the one developed by Brocade. The Intel code was a missing features, and had style and other issues.
Major changes:
- supports multi-segment
- supports vlan offload
- per queue stats
Fixes:
- link update reports link change correctly
- allows reconfiguration of # of queues (original code would have too small memzone).
--- lib/librte_pmd_vmxnet3/Makefile | 23 lib/librte_pmd_vmxnet3/README | 20 lib/librte_pmd_vmxnet3/vmxnet3/README | 50 lib/librte_pmd_vmxnet3/vmxnet3/includeCheck.h | 40 lib/librte_pmd_vmxnet3/vmxnet3/upt1_defs.h | 117 - lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_begin.h | 32 lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_end.h | 32 lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_defs.h | 751 ----------- lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_osdep.h | 48 lib/librte_pmd_vmxnet3/vmxnet3_defs.h | 717 ++++++++++ lib/librte_pmd_vmxnet3/vmxnet3_dev.h | 148 ++ lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 1087 +++++++--------- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h | 187 -- lib/librte_pmd_vmxnet3/vmxnet3_logs.h | 11 lib/librte_pmd_vmxnet3/vmxnet3_ring.h | 176 -- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 1387 +++++++++------------ 16 files changed, 2024 insertions(+), 2802 deletions(-)
lib/librte_pmd_vmxnet3/Makefile +2 -21
@@ -1,8 +1,8 @@ # BSD LICENSE # -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2012-2014 Brocade Computer Systems # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met:
@@ -39,25 +39,6 @@ LIB = librte_pmd_vmxnet3_uio.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -ifeq ($(CC), icc) -# -# CFLAGS for icc -# -CFLAGS_LAD = -wd174 -wd593 -wd869 -wd981 -wd2259 -else -# -# CFLAGS for gcc -# -ifneq ($(shell test $(GCC_MAJOR_VERSION) -le 4 -a $(GCC_MINOR_VERSION) -le 3 && echo 1), 1) -CFLAGS += -Wno-deprecated -endif -CFLAGS_LAD = -Wno-unused-parameter -Wno-unused-value -CFLAGS_LAD += -Wno-strict-aliasing -Wno-format-extra-args - -endif - -VPATH += $(RTE_SDK)/lib/librte_pmd_vmxnet3/vmxnet3 - # # all source are stored in SRCS-y #
lib/librte_pmd_vmxnet3/vmxnet3/README deleted +0 -50
50 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3/includeCheck.h deleted +0 -40
@@ -1,40 +0,0 @@ -/*- -* BSD LICENSE -* -* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef _INCLUDECHECK_H -#define _INCLUDECHECK_H - -#include "vmxnet3_osdep.h" - -#endif /* _INCLUDECHECK_H */ -
lib/librte_pmd_vmxnet3/vmxnet3/upt1_defs.h deleted +0 -117
117 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_begin.h deleted +0 -32
@@ -1,32 +0,0 @@ -/*- -* BSD LICENSE -* -* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/
lib/librte_pmd_vmxnet3/vmxnet3/vmware_pack_end.h deleted +0 -32
@@ -1,32 +0,0 @@ -/*- -* BSD LICENSE -* -* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/
lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_defs.h deleted +0 -751
751 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3/vmxnet3_osdep.h deleted +0 -48
48 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c +508 -579
1,246 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_ethdev.h deleted +0 -187
187 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_logs.h +6 -5
@@ -1,13 +1,13 @@/*- * BSD LICENSE -* -* Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +* +* Copyright(c) 2010-2012 Intel Corporation. All rights reserved. * All rights reserved. -* +* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: -* +* * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright
@@ -17,7 +17,7 @@* * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. -* +* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -29,6 +29,7 @@* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* */ #ifndef _VMXNET3_LOGS_H_
lib/librte_pmd_vmxnet3/vmxnet3_ring.h deleted +0 -176
176 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +623 -764
254 lines not on this page · raw message
lib/librte_pmd_vmxnet3/README new file +20 -0
Lines of this file are not shown. View the raw message.
lib/librte_pmd_vmxnet3/vmxnet3_defs.h new file +717 -0
717 lines not on this page · raw message
lib/librte_pmd_vmxnet3/vmxnet3_dev.h new file +148 -0
148 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
A message that is not in the archive (sent off-list or not yet received): 20140514185752.176396147-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org
Re: [PATCH 6/6] vmxnet3: replace Intel driver
Hi Stephen,
2014-05-14 11:55, Stephen Hemminger:
Quoted 8 lines
Replace the Intel VMXNET3 driver with the one developed by Brocade. The Intel code was a missing features, and had style and other issues.
Major changes:
- supports multi-segment
- supports vlan offload
- per queue stats
Quoted 6 lines
Fixes:
- link update reports link change correctly
- allows reconfiguration of # of queues (original code would have too small memzone).Signed-off-by Stephen Hemminger <[email protected]>
We cannot replace a driver by another one without comparing performances. Actually there is no good reason to remove an implementation if some people are willing to maintain it.
Please send a patch to import your vmxnet3 PMD as extension in a separated repository like these ones:
http://dpdk.org/browse
This way, we can have a first integration step and discuss/test this implementation during the next release cycle.
Thank you for contributing
Signature · 1 line
Thomas