Message ID | 1442498163-12390-2-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | New |
Headers | show |
OK here is the link speed API I asked for in another email. But why do we need to be able to (attempt) to set link speed? I think ODP applications only need to be able to read link state and speed. Changing link/device configuration is problematic from a security and robustness aspect and not something I want individual dataplane applications should be able to do. -- Ola On 17 September 2015 at 15:56, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > include/odp/api/packet_io.h | 69 > +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 69 insertions(+) > > diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h > index 631aec2..b7db037 100644 > --- a/include/odp/api/packet_io.h > +++ b/include/odp/api/packet_io.h > @@ -91,6 +91,20 @@ typedef struct odp_pktio_param_t { > odp_pktio_output_mode_t out_mode; > } odp_pktio_param_t; > > +#define ODP_PKTIO_SPEED_10HD (1 << 1) > +#define ODP_PKTIO_SPEED_10FD (1 << 2) > +#define ODP_PKTIO_SPEED_100HD (1 << 3) > +#define ODP_PKTIO_SPEED_100FD (1 << 4) > +#define ODP_PKTIO_SPEED_1000HD (1 << 5) > +#define ODP_PKTIO_SPEED_1000FD (1 << 6) > +#define ODP_PKTIO_SPEED_10000HD (1 << 7) > +#define ODP_PKTIO_SPEED_10000FD (1 << 8) > +#define ODP_PKTIO_SPEED_20000HD (1 << 9) > +#define ODP_PKTIO_SPEED_20000FD (1 << 10) > +#define ODP_PKTIO_SPEED_40000HD (1 << 11) > +#define ODP_PKTIO_SPEED_40000FD (1 << 12) > +#define ODP_PKTIO_SPEED_AUTO (1 << 13) > + > /** > * Open a packet IO interface > * > @@ -367,6 +381,61 @@ int odp_pktio_link(odp_pktio_t pktio); > int odp_pktio_link_set(odp_pktio_t pktio, odp_bool_t up); > > /** > + * Get speed of packet IO interface. > + * > + * @param[in] pktio Packet IO handle. > + * > + * @retval >0 link speed (ODP_PKTIO_SPEED_ value). > + * @retval 0 getting link speed unsupported by platform. > + * @retval <0 on failure > +*/ > +int odp_pktio_speed(odp_pktio_t pktio); > + > +/** > + * Set link speed on a packet IO interface. > + * > + * @param[in] pktio Packet IO handle. > + * @param[in] speed Value of the speed (ODP_PKTIO_SPEED_ value). > + * > + * @retval 0 on success > + * @retval <0 on failure > + */ > +int odp_pktio_speed_set(odp_pktio_t pktio, int speed); > + > +/** > + * Get supported speeds for packet IO interface. > + * > + * @param[in] pktio Packet IO handle. > + * > + * @retval >0 Bit mask of ODP_PKTIO_SPEED_ supported speeds. > + * @retval 0 operation is not supported by that pktio. > + * @retval <0 on failure > +*/ > +int odp_pktio_speed_supported(odp_pktio_t pktio); > + > +/** > + * Check if link speed auto negotiation turned on for packet IO interface. > + * > + * @param[in] pktio Packet IO handle. > + * > + * @retval 1 Turned on. > + * @retval 0 Turned off. > + * @retval <0 on failure. > +*/ > +int odp_pktio_speed_autoneg(odp_pktio_t pktio); > + > +/** > + * Set link speed auto negotiation on a packet IO interface. > + * > + * @param[in] pktio Packet IO handle. > + * @param[in] enable 1 to enable, 0 to disable. > + * > + * @retval 0 on success > + * @retval <0 on failure > + */ > +int odp_pktio_speed_autoneg_set(odp_pktio_t pktio, int enable); > + > +/** > * @} > */ > > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h index 631aec2..b7db037 100644 --- a/include/odp/api/packet_io.h +++ b/include/odp/api/packet_io.h @@ -91,6 +91,20 @@ typedef struct odp_pktio_param_t { odp_pktio_output_mode_t out_mode; } odp_pktio_param_t; +#define ODP_PKTIO_SPEED_10HD (1 << 1) +#define ODP_PKTIO_SPEED_10FD (1 << 2) +#define ODP_PKTIO_SPEED_100HD (1 << 3) +#define ODP_PKTIO_SPEED_100FD (1 << 4) +#define ODP_PKTIO_SPEED_1000HD (1 << 5) +#define ODP_PKTIO_SPEED_1000FD (1 << 6) +#define ODP_PKTIO_SPEED_10000HD (1 << 7) +#define ODP_PKTIO_SPEED_10000FD (1 << 8) +#define ODP_PKTIO_SPEED_20000HD (1 << 9) +#define ODP_PKTIO_SPEED_20000FD (1 << 10) +#define ODP_PKTIO_SPEED_40000HD (1 << 11) +#define ODP_PKTIO_SPEED_40000FD (1 << 12) +#define ODP_PKTIO_SPEED_AUTO (1 << 13) + /** * Open a packet IO interface * @@ -367,6 +381,61 @@ int odp_pktio_link(odp_pktio_t pktio); int odp_pktio_link_set(odp_pktio_t pktio, odp_bool_t up); /** + * Get speed of packet IO interface. + * + * @param[in] pktio Packet IO handle. + * + * @retval >0 link speed (ODP_PKTIO_SPEED_ value). + * @retval 0 getting link speed unsupported by platform. + * @retval <0 on failure +*/ +int odp_pktio_speed(odp_pktio_t pktio); + +/** + * Set link speed on a packet IO interface. + * + * @param[in] pktio Packet IO handle. + * @param[in] speed Value of the speed (ODP_PKTIO_SPEED_ value). + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_pktio_speed_set(odp_pktio_t pktio, int speed); + +/** + * Get supported speeds for packet IO interface. + * + * @param[in] pktio Packet IO handle. + * + * @retval >0 Bit mask of ODP_PKTIO_SPEED_ supported speeds. + * @retval 0 operation is not supported by that pktio. + * @retval <0 on failure +*/ +int odp_pktio_speed_supported(odp_pktio_t pktio); + +/** + * Check if link speed auto negotiation turned on for packet IO interface. + * + * @param[in] pktio Packet IO handle. + * + * @retval 1 Turned on. + * @retval 0 Turned off. + * @retval <0 on failure. +*/ +int odp_pktio_speed_autoneg(odp_pktio_t pktio); + +/** + * Set link speed auto negotiation on a packet IO interface. + * + * @param[in] pktio Packet IO handle. + * @param[in] enable 1 to enable, 0 to disable. + * + * @retval 0 on success + * @retval <0 on failure + */ +int odp_pktio_speed_autoneg_set(odp_pktio_t pktio, int enable); + +/** * @} */
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- include/odp/api/packet_io.h | 69 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)