Signed-off-by: Vamsi Attunuru <vattun...@cavium.com>
Signed-off-by: Shally Verma   <sve...@cavium.com>
Signed-off-by: Mahipal Challa <mcha...@cavium.com>

---
 include/odp/api/spec/packet_io.h | 167 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 167 insertions(+)

diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index 8802089..7174c0f 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -451,6 +451,16 @@ typedef union odp_pktio_set_op_t {
        struct {
                /** Promiscuous mode */
                uint32_t promisc_mode : 1;
+               /** Allow default MAC address to be set */
+               uint32_t mac_addr_set : 1;
+               /** Allow multiple addresses to be added
+                 * other than default. When enabled, app
+                 * can call odp_mac_addr_add API to set
+                 * mac addresses upto the limit indicated by
+                 * Odp_pktio_capability_t:max_mac_addresses */
+               uint32_t mac_addr_add : 1;
+               /** Allow app to set MTU size */
+               uint32_t mtu_set : 1;
        } op;
        /** All bits of the bit field structure.
          * This field can be used to set/clear all flags, or bitwise
@@ -459,6 +469,71 @@ typedef union odp_pktio_set_op_t {
 } odp_pktio_set_op_t;
 
 /**
+ * MAC address type
+ */
+typedef enum odp_mac_addr_type_t {
+       /** Unicast MAC address type */
+       ODP_MAC_ADDR_TYPE_UCAST = 0,
+
+       /** Multicast MAC address type */
+       ODP_MAC_ADDR_TYPE_BCAST
+} odp_mac_addr_type_t;
+
+/**
+ * MAC address add/remove operation status types
+ *
+ * These status types denote various statuses set by
+ * odp_pktio_mac_addr_add/remove APIs in odp_pktio_mac_addr_t:status.
+ */
+typedef enum odp_mac_ops_status_t {
+       /** MAC address add/remove is successful */
+       ODP_MAC_ADDR_OP_SUCCESS = 0,
+
+       /** Invalid mac address passed in odp_pktio_mac_addr_t:mac_addr */
+       ODP_MAC_ADDR_INVALID,
+
+       /** odp_pktio_mac_addr_t:mac_addr points to NULL */
+       ODP_MAC_ADDR_PTR_NULL,
+
+       /** Entry in mac_addr_tbl[] is NULL */
+       ODP_MAC_ADDR_ENTRY_NULL,
+
+       /** MAC address size mismatch
+        * odp_pktio_mac_addr_t:mac_addr_len
+        * != odp_pktio_capability_t:mac_addr_len */
+       ODP_MAC_ADDR_SIZE_ERR,
+
+       /** Index is invalid,
+        * odp_pktio_mac_addr_t:index >= 
odp_pktio_capability_t:max_mac_addresses */
+       ODP_MAC_ADDR_INVALID_INDEX
+} odp_mac_ops_status_t;
+
+/**
+ * Packet IO MAC address structure
+ *
+ * These parameters are used for adding/removing MAC addresses.
+ * "status" parameter of each index indicates the result after
+ * the odp_pktio_mac_addr_add/remove operation.
+ */
+typedef union odp_pktio_mac_addr_t {
+       /** Type of MAC address (ucast/mcast) */
+       odp_mac_addr_type_t mac_type;
+
+       /** Pointer to buffer containing MAC address */
+       uint8_t *mac_addr;
+
+       /** Length of mac_addr buffer */
+       uint32_t mac_addr_len;
+
+       /** Index value associated to this MAC address.
+        * Should be <= odp_pktio_capability_t:max_mac_addresses */
+       uint32_t index;
+
+       /** Status flag of the mac_addr_add/remove operation */
+       odp_mac_ops_status_t status;
+} odp_pktio_mac_addr_t;
+
+/**
  * Packet IO capabilities
  */
 typedef struct odp_pktio_capability_t {
@@ -482,6 +557,17 @@ typedef struct odp_pktio_capability_t {
         * A boolean to denote whether loop back mode is supported on this
         * specific interface. */
        odp_bool_t loop_supported;
+
+       /** Maximum MTU size supported */
+       uint32_t max_mtu_size;
+
+       /** Length of MAC addresses supported on this specific interface
+        * All of the mac addresses supported by this pktio carry ,fixed size
+        * length as indicated by this capability param */
+       uint32_t mac_addr_len;
+
+       /** Maximum number of MAC addresses supported on this specific 
interface */
+       uint32_t max_mac_addresses;
 } odp_pktio_capability_t;
 
 /**
@@ -912,6 +998,21 @@ int odp_pktout_send(odp_pktout_queue_t queue, const 
odp_packet_t packets[],
 uint32_t odp_pktio_mtu(odp_pktio_t pktio);
 
 /**
+ * Set MTU value of a packet IO interface.
+ *
+ * Application should pass value upto max_mtu_size as indicated by
+ * odp_pktio_capability_t:max_mtu_size. Any value beyond max_mtu_size
+ * limit will result in failure. mtu value == 0 also results in failure.
+ *
+ * @param pktio  Packet IO handle.
+ * @param mtu    MTU value to be set.
+ *
+ * @return  0 on success
+ * @retval <0 on failure
+ */
+int odp_pktio_mtu_set(odp_pktio_t pktio, uint32_t mtu);
+
+/**
  * Enable/Disable promiscuous mode on a packet IO interface.
  *
  * @param[in] pktio    Packet IO handle.
@@ -946,6 +1047,72 @@ int odp_pktio_promisc_mode(odp_pktio_t pktio);
 int odp_pktio_mac_addr(odp_pktio_t pktio, void *mac_addr, int size);
 
 /**
+ * Set the default MAC address of a packet IO interface.
+ *
+ * Changes interface default MAC address to the address pointed by 'mac_addr'.
+ * Value of 'size' must be equal to the interface mac address size, which is
+ * specified by 'mac_addr_len' capability. Operation returns failure on other
+ * values of 'size'. MAC address is not changed on failure.
+ *
+ * @param pktio        Packet IO handle
+ * @param mac_addr     Pointer to MAC address to be set
+ * @param size         Size of MAC address buffer
+ *
+ * @return  0 on success
+ * @retval <0 on failure
+ *
+ * @note This API only modifies default MAC address. It doesn’t impact
+ * addresses added via call to odp_mac_add_add().
+ */
+int odp_pktio_mac_addr_set(odp_pktio_t pktio, const uint8_t *mac_addr,
+                 int size);
+
+/**
+ * Add MAC address to a packet IO interface.
+ *
+ * Adds one or more number of MAC addresses to the given packet IO interface.
+ * Operation returns failure for num > odp_pktio_capablity_t:max_mac_addresses.
+ * Else return number of mac addresses actually set.
+ * MAC addresses are not added on failure.
+ *
+ * @param pktio        Packet IO handle
+ * @param mac_addr_tbl Points to an array of MAC addresses to be added
+ * @param num          Number of MAC addresses to be added
+ *
+ * @return Number of MAC addresses actually set
+ * @retval <0 on failure
+ *
+ * @note If number returns < number originally passed, application needs
+ * to verify odp_pktio_mac_addr_t:status parameter of each MAC address to
+ * confirm whether the corresponding MAC address is added successfully or not.
+ */
+int odp_pktio_mac_addr_add(odp_pktio_t pktio,
+                                odp_pktio_mac_addr_t *mac_addr_tbl[], int num);
+
+/**
+ * Remove MAC address of a packet IO interface.
+ *
+ * Removes one or more number of MAC addresses of the given packet IO 
interface.
+ * Operation returns failure for num > odp_pktio_capablity_t:max_mac_addresses.
+ * Else return number of mac addresses actually removed.
+ * MAC addresses are not removed on failure.
+ *
+ * @param pktio        Packet IO handle
+ * @param mac_addr_tbl Points to an array of MAC address to be removed
+ * @param num          Number of MAC addresses to be removed
+ *
+ * @return Number of MAC addresses actually removed
+ * @retval <0 on failure
+ *
+ * @note If number returns < number originally passed, application needs
+ * to verify odp_pktio_mac_addr_t:status parameter of each MAC address to
+ * confirm whether the corresponding MAC address is removed successfully
+ * or not.
+ */
+int odp_pktio_mac_addr_remove(odp_pktio_t pktio,
+                       odp_pktio_mac_addr_t *mac_addr_tbl[], int num);
+
+/**
  * Setup per-port default class-of-service.
  *
  * @param[in]  pktio           Ingress port pktio handle.
-- 
1.9.3

Reply via email to