net/sfc/base: add API to control UDP tunnel ports
[dpdk.git] / drivers / net / sfc / base / efx.h
index d4e0bc5..8c59a99 100644 (file)
@@ -1205,6 +1205,11 @@ typedef struct efx_nic_cfg_s {
        boolean_t               enc_pm_and_rxdp_counters;
        boolean_t               enc_mac_stats_40g_tx_size_bins;
        uint32_t                enc_tunnel_encapsulations_supported;
+       /*
+        * NIC global maximum for unique UDP tunnel ports shared by all
+        * functions.
+        */
+       uint32_t                enc_tunnel_config_udp_entries_max;
        /* External port identifier */
        uint8_t                 enc_external_port;
        uint32_t                enc_mcdi_max_payload_length;
@@ -2012,6 +2017,15 @@ typedef enum efx_rxq_type_e {
  */
 #define        EFX_RXQ_FLAG_NONE               0x0
 #define        EFX_RXQ_FLAG_SCATTER            0x1
+/*
+ * If tunnels are supported and Rx event can provide information about
+ * either outer or inner packet classes (e.g. SFN8xxx adapters with
+ * full-feature firmware variant running), outer classes are requested by
+ * default. However, if the driver supports tunnels, the flag allows to
+ * request inner classes which are required to be able to interpret inner
+ * Rx checksum offload results.
+ */
+#define        EFX_RXQ_FLAG_INNER_CLASSES      0x2
 
 extern __checkReturn   efx_rc_t
 efx_rx_qcreate(
@@ -2622,6 +2636,52 @@ efx_lic_finish_partition(
 
 #endif /* EFSYS_OPT_LICENSING */
 
+/* TUNNEL */
+
+#if EFSYS_OPT_TUNNEL
+
+extern __checkReturn   efx_rc_t
+efx_tunnel_init(
+       __in            efx_nic_t *enp);
+
+extern                 void
+efx_tunnel_fini(
+       __in            efx_nic_t *enp);
+
+/*
+ * For overlay network encapsulation using UDP, the firmware needs to know
+ * the configured UDP port for the overlay so it can decode encapsulated
+ * frames correctly.
+ * The UDP port/protocol list is global.
+ */
+
+extern __checkReturn   efx_rc_t
+efx_tunnel_config_udp_add(
+       __in            efx_nic_t *enp,
+       __in            uint16_t port /* host/cpu-endian */,
+       __in            efx_tunnel_protocol_t protocol);
+
+extern __checkReturn   efx_rc_t
+efx_tunnel_config_udp_remove(
+       __in            efx_nic_t *enp,
+       __in            uint16_t port /* host/cpu-endian */,
+       __in            efx_tunnel_protocol_t protocol);
+
+extern                 void
+efx_tunnel_config_clear(
+       __in            efx_nic_t *enp);
+
+/**
+ * Apply tunnel UDP ports configuration to hardware.
+ *
+ * EAGAIN is returned if hardware will be reset (datapath and managment CPU
+ * reboot).
+ */
+extern __checkReturn   efx_rc_t
+efx_tunnel_reconfigure(
+       __in            efx_nic_t *enp);
+
+#endif /* EFSYS_OPT_TUNNEL */
 
 
 #ifdef __cplusplus