net/sfc/base: handle manual and auto filter clashes in EF10
[dpdk.git] / drivers / net / sfc / base / efx.h
index a43ddd9..d94d3c0 100644 (file)
@@ -29,6 +29,18 @@ extern "C" {
 /* The macro expands divider twice */
 #define        EFX_DIV_ROUND_UP(_n, _d)                (((_n) + (_d) - 1) / (_d))
 
+/* Round value up to the nearest power of two. */
+#define        EFX_P2ROUNDUP(_type, _value, _align)    \
+       (-(-(_type)(_value) & -(_type)(_align)))
+
+/* Align value down to the nearest power of two. */
+#define        EFX_P2ALIGN(_type, _value, _align)      \
+       ((_type)(_value) & -(_type)(_align))
+
+/* Test if value is power of 2 aligned. */
+#define        EFX_IS_P2ALIGNED(_type, _value, _align) \
+       ((((_type)(_value)) & ((_type)(_align) - 1)) == 0)
+
 /* Return codes */
 
 typedef __success(return == 0) int efx_rc_t;
@@ -498,10 +510,10 @@ typedef enum efx_link_mode_e {
            + /* bug16011 */ 16)                                \
 
 #define        EFX_MAC_PDU(_sdu)                                       \
-       P2ROUNDUP((_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8)
+       EFX_P2ROUNDUP(size_t, (_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8)
 
 /*
- * Due to the P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give
+ * Due to the EFX_P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give
  * the SDU rounded up slightly.
  */
 #define        EFX_MAC_SDU_FROM_PDU(_pdu)      ((_pdu) - EFX_MAC_PDU_ADJUSTMENT)
@@ -587,8 +599,9 @@ efx_mac_stat_name(
 
 #define        EFX_MAC_STATS_MASK_BITS_PER_PAGE        (8 * sizeof (uint32_t))
 
-#define        EFX_MAC_STATS_MASK_NPAGES       \
-       (P2ROUNDUP(EFX_MAC_NSTATS, EFX_MAC_STATS_MASK_BITS_PER_PAGE) / \
+#define        EFX_MAC_STATS_MASK_NPAGES                               \
+       (EFX_P2ROUNDUP(uint32_t, EFX_MAC_NSTATS,                \
+                      EFX_MAC_STATS_MASK_BITS_PER_PAGE) /      \
            EFX_MAC_STATS_MASK_BITS_PER_PAGE)
 
 /*
@@ -2936,17 +2949,15 @@ typedef uint8_t efx_filter_flags_t;
 
 typedef uint32_t efx_filter_match_flags_t;
 
+/* Filter priority from lowest to highest */
 typedef enum efx_filter_priority_s {
-       EFX_FILTER_PRI_HINT = 0,        /* Performance hint */
-       EFX_FILTER_PRI_AUTO,            /* Automatic filter based on device
+       EFX_FILTER_PRI_AUTO = 0,        /* Automatic filter based on device
                                         * address list or hardware
                                         * requirements. This may only be used
                                         * by the filter implementation for
                                         * each NIC type. */
        EFX_FILTER_PRI_MANUAL,          /* Manually configured filter */
-       EFX_FILTER_PRI_REQUIRED,        /* Required for correct behaviour of the
-                                        * client (e.g. SR-IOV, HyperV VMQ etc.)
-                                        */
+       EFX_FILTER_NPRI,
 } efx_filter_priority_t;
 
 /*
@@ -2961,6 +2972,11 @@ typedef struct efx_filter_spec_s {
        uint16_t                        efs_dmaq_id;
        uint32_t                        efs_rss_context;
        uint32_t                        efs_mark;
+       /*
+        * Saved lower-priority filter. If it is set, it is restored on
+        * filter delete operation.
+        */
+       struct efx_filter_spec_s        *efs_overridden_spec;
        /* Fields below here are hashed for software filter lookup */
        uint16_t                        efs_outer_vid;
        uint16_t                        efs_inner_vid;
@@ -3513,6 +3529,21 @@ efx_proxy_auth_set_privilege_mask(
        __in            uint32_t mask,
        __in            uint32_t value);
 
+       __checkReturn   efx_rc_t
+efx_proxy_auth_privilege_mask_get(
+       __in            efx_nic_t *enp,
+       __in            uint32_t pf_index,
+       __in            uint32_t vf_index,
+       __out           uint32_t *maskp);
+
+       __checkReturn   efx_rc_t
+efx_proxy_auth_privilege_modify(
+       __in            efx_nic_t *enp,
+       __in            uint32_t pf_index,
+       __in            uint32_t vf_index,
+       __in            uint32_t add_privileges_mask,
+       __in            uint32_t remove_privileges_mask);
+
 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */
 
 #ifdef __cplusplus