one minor question: Is this API mainly for debugging or is there any
other use case? Apart from this

Reviewed-by: Balasubramanian Manoharan <[email protected]>

Regards,
Bala


On 2 August 2016 at 14:20,  <[email protected]> wrote:
> From: Xuelin Shi <[email protected]>
>
> generate mac string representation (XX:XX:XX:XX:XX:XX) of odph_ethaddr_t
>
> Signed-off-by: Xuelin Shi <[email protected]>
> ---
> v2:
>  fix style issue.
>
>  helper/eth.c                    | 11 +++++++++++
>  helper/include/odp/helper/eth.h | 14 ++++++++++++++
>  2 files changed, 25 insertions(+)
>
> diff --git a/helper/eth.c b/helper/eth.c
> index 9a151fa..393e529 100644
> --- a/helper/eth.c
> +++ b/helper/eth.c
> @@ -34,3 +34,14 @@ int odph_eth_addr_parse(odph_ethaddr_t *mac, const char 
> *str)
>
>         return 0;
>  }
> +
> +char *odph_eth_addr_string(odph_ethaddr_t *mac, char *buf)
> +{
> +       uint8_t *byte;
> +
> +       byte = mac->addr;
> +       sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",
> +               byte[0], byte[1], byte[2], byte[3], byte[4], byte[5]);
> +
> +       return buf;
> +}
> diff --git a/helper/include/odp/helper/eth.h b/helper/include/odp/helper/eth.h
> index 9f47ddf..9291774 100644
> --- a/helper/include/odp/helper/eth.h
> +++ b/helper/include/odp/helper/eth.h
> @@ -120,6 +120,20 @@ ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == 
> ODPH_VLANHDR_LEN,
>  int odph_eth_addr_parse(odph_ethaddr_t *mac, const char *str);
>
>  /**
> + * Generate text string representation of a MAC address
> + *
> + * The mac address string representation (xx:xx:xx:xx:xx:xx) is stored into a
> + * buffer specified by the second param, caller should guarantee the size of 
> the
> + * buffer is big enough.
> + *
> + * @param mac   Pointer to MAC address
> + * @param buf   Pointer to buffer to store string
> + *
> + * @return     Pointer to the supplied buffer
> + */
> +char *odph_eth_addr_string(odph_ethaddr_t *mac, char *buf);
> +
> +/**
>   * @}
>   */
>
> --
> 2.1.0.27.g96db324
>

Reply via email to