net/qede/base: add UDP ports in bulletin board message
[dpdk.git] / drivers / net / qede / base / bcm_osal.c
index f46f31b..28be958 100644 (file)
@@ -6,14 +6,16 @@
  * See LICENSE.qede_pmd for copyright and licensing details.
  */
 
-#include <zlib.h>
-
 #include <rte_memzone.h>
 #include <rte_errno.h>
 
 #include "bcm_osal.h"
 #include "ecore.h"
 #include "ecore_hw.h"
+#include "ecore_iov_api.h"
+#include "ecore_mcp_api.h"
+#include "ecore_l2_api.h"
+
 
 unsigned long qede_log2_align(unsigned long n)
 {
@@ -61,6 +63,27 @@ inline bool qede_test_bit(u32 nr, unsigned long *addr)
        return res;
 }
 
+static inline u32 qede_ffb(unsigned long word)
+{
+       unsigned long first_bit;
+
+       first_bit = __builtin_ffsl(word);
+       return first_bit ? (first_bit - 1) : OSAL_BITS_PER_UL;
+}
+
+inline u32 qede_find_first_bit(unsigned long *addr, u32 limit)
+{
+       u32 i;
+       u32 nwords = 0;
+       OSAL_BUILD_BUG_ON(!limit);
+       nwords = (limit - 1) / OSAL_BITS_PER_UL + 1;
+       for (i = 0; i < nwords; i++)
+               if (addr[i] != 0)
+                       break;
+
+       return (i == nwords) ? limit : i * OSAL_BITS_PER_UL + qede_ffb(addr[i]);
+}
+
 static inline u32 qede_ffz(unsigned long word)
 {
        unsigned long first_zero;
@@ -81,6 +104,14 @@ inline u32 qede_find_first_zero_bit(unsigned long *addr, u32 limit)
        return (i == nwords) ? limit : i * OSAL_BITS_PER_UL + qede_ffz(addr[i]);
 }
 
+void qede_vf_fill_driver_data(struct ecore_hwfn *hwfn,
+                             __rte_unused struct vf_pf_resc_request *resc_req,
+                             struct ecore_vf_acquire_sw_info *vf_sw_info)
+{
+       vf_sw_info->os_type = VFPF_ACQUIRE_OS_LINUX_USERSPACE;
+       vf_sw_info->override_fw_version = 1;
+}
+
 void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,
                              dma_addr_t *phys, size_t size)
 {
@@ -106,7 +137,7 @@ void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,
        }
        *phys = mz->phys_addr;
        DP_VERBOSE(p_dev, ECORE_MSG_PROBE,
-                  "size=%zu phys=0x%lx virt=%p on socket=%u\n",
+                  "size=%zu phys=0x%" PRIx64 " virt=%p on socket=%u\n",
                   mz->len, mz->phys_addr, mz->addr, socket_id);
        return mz->addr;
 }
@@ -135,11 +166,12 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *p_dev,
        }
        *phys = mz->phys_addr;
        DP_VERBOSE(p_dev, ECORE_MSG_PROBE,
-                  "aligned memory size=%zu phys=0x%lx virt=%p core=%d\n",
+                  "aligned memory size=%zu phys=0x%" PRIx64 " virt=%p core=%d\n",
                   mz->len, mz->phys_addr, mz->addr, core_id);
        return mz->addr;
 }
 
+#ifdef CONFIG_ECORE_ZIPPED_FW
 u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len,
                    u8 *input_buf, u32 max_size, u8 *unzip_buf)
 {
@@ -170,3 +202,22 @@ u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len,
 
        return p_hwfn->stream->total_out / 4;
 }
+#endif
+
+void
+qede_get_mcp_proto_stats(struct ecore_dev *edev,
+                        enum ecore_mcp_protocol_type type,
+                        union ecore_mcp_protocol_stats *stats)
+{
+       struct ecore_eth_stats lan_stats;
+
+       if (type == ECORE_MCP_LAN_STATS) {
+               ecore_get_vport_stats(edev, &lan_stats);
+               stats->lan_stats.ucast_rx_pkts = lan_stats.rx_ucast_pkts;
+               stats->lan_stats.ucast_tx_pkts = lan_stats.tx_ucast_pkts;
+               stats->lan_stats.fcs_err = -1;
+       } else {
+               DP_INFO(edev, "Statistics request type %d not supported\n",
+                      type);
+       }
+}