Adds new pktio APIs to set MTU and MAC address on pktio interface. Signed-off-by: Vamsi Attunuru <vattun...@cavium.com> Signed-off-by: Mahipal Challa <mcha...@cavium.com> Signed-off-by: Shally Verma <sve...@cavium.com>
--- include/odp/api/spec/packet_io.h | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 8802089..1269f44 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -451,6 +451,10 @@ typedef union odp_pktio_set_op_t { struct { /** Promiscuous mode */ uint32_t promisc_mode : 1; + /** MAC address */ + uint32_t mac : 1; + /** MTU size */ + uint32_t mtu : 1; } op; /** All bits of the bit field structure. * This field can be used to set/clear all flags, or bitwise @@ -482,6 +486,12 @@ 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 address supported on this specific interface */ + uint32_t mac_addr_len; } odp_pktio_capability_t; /** @@ -912,6 +922,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. + * + * @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 +971,26 @@ 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 MAC address of a packet IO interface. + * + * Application should pass mac_addr buffer with size >= + * odp_pktio_capablity_t:mac_addr_len, size value less than + * implementation supported will result in API failure. + * + * On success, Implementation would read mac_addr buffer bytes + * upto mac_addr_len value indicated in capability information. + * + * @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 + */ +int odp_pktio_mac_addr_set(odp_pktio_t pktio, const uint8_t *mac_addr, + int size); + +/** * Setup per-port default class-of-service. * * @param[in] pktio Ingress port pktio handle. -- 1.9.3