diff mbox

[RFC,7/8] api: packet_io: added packet io control info

Message ID A400FC85CF2669428A5A081F01B94F531DA1D4A4@DEMUMBX012.nsn-intra.net
State New
Headers show

Commit Message

Savolainen, Petri (Nokia - FI/Espoo) March 31, 2015, 7:26 a.m. UTC
From: ext Bill Fischofer [mailto:bill.fischofer@linaro.org]

Sent: Tuesday, March 31, 2015 12:44 AM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [RFC 7/8] api: packet_io: added packet io control info



On Mon, Mar 30, 2015 at 12:23 PM, Petri Savolainen <petri.savolainen@nokia.com<mailto:petri.savolainen@nokia.com>> 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).

Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com<mailto:petri.savolainen@nokia.com>>

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

typedef struct odp_pktio_ctrl_info_t {
        union {
                uint32_t all;
                struct {
                     ...individual flags as bits
                };
        };
} odp_pktio_ctrl_info_t;


With “all” user could check “all” vs. “nothing”. It may be useful and could be added. Although, I’m suspecting that the more we add ctrl functions (flags), the more likely it is that a virtual function on NICs/SoCs have some set of these set (vs all zeros). E.g. some NIC could support max_frame size setting per VF (== all ODP pktio interfaces) while others could not (== only on the interface that has the physical function role). Thus a VF interface would see 0x20000000 and a PF 0xF8000000.

-Petri
diff mbox

Patch

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;

We've used unions for these sort of flags in things like packet_flags, which I think makes for more convenient manipulation.  So better might be: