On 30 March 2015 at 19:23, Petri Savolainen <[email protected]> wrote:
> Structure tells which packet io control operation are permitted > on the interface. Some control operations may not be permitted > from all interfaces (virtual functions). > Is it better to be able to figure this out in advance (before you actually try to change one of these configurations)? Instead of just trying to perform the operation and it possibly fails with some suitable error code. Implementations still need to be robust and handle that the user tries to set e.g. max frame size on a shared resource (virtual function) which the implementation does not support. A user can always read the current value of a config and then try to write it back. I think the ODP API just gets more complex without actually adding any new features. > > Signed-off-by: Petri Savolainen <[email protected]> > --- > include/odp/api/packet_io.h | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h > index 7e84fe1..dc76270 100644 > --- a/include/odp/api/packet_io.h > +++ b/include/odp/api/packet_io.h > @@ -48,6 +48,24 @@ extern "C" { > * Actual MAC address sizes may be different. > */ > > +/** > + * Packet IO interface control information > + * > + * A collection of flags that indicate interface control operation > availability. > + * A packet IO interface control operation is permitted when the > corresponding > + * flag is set. Otherwise, the operation is not permitted on the > interface. > + */ > +typedef struct odp_pktio_ctrl_info_t { > + struct { > + uint32_t mtu:1; /**< Set MTU */ > + uint32_t promisc:1; /**< Set promiscuous mode */ > + uint32_t max_frame:1; /**< Set maximum frame length */ > + uint32_t min_frame:1; /**< Set minimum frame length */ > + uint32_t link:1; /**< Set link status*/ > + > + uint32_t _reserved:27; /**< Reserved for future use */ > + } flag; /**< Operation flags */ > +} odp_pktio_ctrl_info_t; > > /** > * Packet input mode > @@ -276,6 +294,19 @@ int odp_pktio_inq_remdef(odp_pktio_t pktio); > odp_queue_t odp_pktio_outq_getdef(odp_pktio_t pktio); > > /** > + * Retrieve information about packet IO control > + * > + * Outputs information structure about packet IO control operations. > + * > + * @param pktio Packet IO handle > + * @param[out] info Pointer to control info structure for output > + * > + * @retval 0 on success > + * @retval <0 on failure > + */ > +int odp_pktio_ctrl_info(odp_pktio_t pktio, odp_pktio_ctrl_info_t *info); > + > +/** > * Return the currently configured MTU value of a packet IO interface. > * > * @param[in] pktio Packet IO handle. > -- > 2.3.4 > > _______________________________________________ > lng-odp mailing list > [email protected] > https://lists.linaro.org/mailman/listinfo/lng-odp >
_______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
