DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@cavium.com>
To: dev@dpdk.org, ferruh.yigit@intel.com
Cc: Rasesh Mody <rasesh.mody@cavium.com>, Dept-EngDPDKDev@cavium.com
Subject: [dpdk-dev] [PATCH 07/17] net/qede/base: add various OS abtraction macros
Date: Fri,  6 Oct 2017 23:31:02 -0700	[thread overview]
Message-ID: <1507357872-26475-8-git-send-email-rasesh.mody@cavium.com> (raw)
In-Reply-To: <1507357872-26475-1-git-send-email-rasesh.mody@cavium.com>

 - Introduce OSAL_IOV_VF_VPORT_STOP to allow VF to carry out required
   operations and prevent a potential assert before closing vport
 - Add OSAL_DIV_S64() for 64-bit division on 32-bit platforms.
 - Add OSAL for transceiver update OSAL_TRANSCEIVER_UPDATE()
 - Add OSAL for MFW command preemption OSAL_MFW_CMD_PREEMPT() within the
   spinning loops while sending a mailbox command to the MFW
 - Implement OSAL_SPIN_LOCK_IRQSAVE macro
 - Rename OSAL_NUM_ACTIVE_CPU() to OSAL_NUM_CPUS()

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/qede/base/bcm_osal.h    |   16 ++++++++++++++--
 drivers/net/qede/base/ecore_dev.c   |    2 +-
 drivers/net/qede/base/ecore_mcp.c   |    4 ++++
 drivers/net/qede/base/ecore_sriov.c |    1 +
 4 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 47290f4..74e5188 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -46,6 +46,8 @@
 
 #define OSAL_WARN(arg1, arg2, arg3, ...) (0)
 
+#define UNUSED(x)	(void)(x)
+
 /* Memory Types */
 typedef uint8_t u8;
 typedef uint16_t u16;
@@ -165,7 +167,12 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *, dma_addr_t *,
 #define OSAL_SPIN_LOCK_INIT(lock) rte_spinlock_init(lock)
 #define OSAL_SPIN_LOCK(lock) rte_spinlock_lock(lock)
 #define OSAL_SPIN_UNLOCK(lock) rte_spinlock_unlock(lock)
-#define OSAL_SPIN_LOCK_IRQSAVE(lock, flags) nothing
+#define OSAL_SPIN_LOCK_IRQSAVE(lock, flags)	\
+	do {					\
+		UNUSED(lock);			\
+		flags = 0;			\
+		UNUSED(flags);			\
+	} while (0)
 #define OSAL_SPIN_UNLOCK_IRQSAVE(lock, flags) nothing
 #define OSAL_SPIN_LOCK_ALLOC(hwfn, lock) nothing
 #define OSAL_SPIN_LOCK_DEALLOC(lock) nothing
@@ -332,6 +339,7 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *, dma_addr_t *,
 #define OSAL_BITMAP_WEIGHT(bitmap, count) 0
 
 #define OSAL_LINK_UPDATE(hwfn, ptt) qed_link_update(hwfn, ptt)
+#define OSAL_TRANSCEIVER_UPDATE(hwfn) nothing
 #define OSAL_DCBX_AEN(hwfn, mib_type) nothing
 
 /* SR-IOV channel */
@@ -350,6 +358,7 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *, dma_addr_t *,
 #define OSAL_IOV_GET_OS_TYPE() 0
 #define OSAL_IOV_VF_MSG_TYPE(hwfn, vfid, vf_msg_type) nothing
 #define OSAL_IOV_PF_RESP_TYPE(hwfn, vfid, pf_resp_type) nothing
+#define OSAL_IOV_VF_VPORT_STOP(hwfn, vf) nothing
 
 u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len,
 		   u8 *input_buf, u32 max_size, u8 *unzip_buf);
@@ -369,7 +378,7 @@ void qede_hw_err_notify(struct ecore_hwfn *p_hwfn,
 	qede_hw_err_notify(hwfn, err_type)
 
 #define OSAL_NVM_IS_ACCESS_ENABLED(hwfn) (1)
-#define OSAL_NUM_ACTIVE_CPU()	0
+#define OSAL_NUM_CPUS()	0
 
 /* Utility functions */
 
@@ -440,7 +449,10 @@ void qede_get_mcp_proto_stats(struct ecore_dev *, enum ecore_mcp_protocol_type,
 #define OSAL_CRC8(table, pdata, nbytes, crc) 0
 #define OSAL_MFW_TLV_REQ(p_hwfn) nothing
 #define OSAL_MFW_FILL_TLV_DATA(type, buf, data) (0)
+#define OSAL_MFW_CMD_PREEMPT(p_hwfn) nothing
 #define OSAL_PF_VALIDATE_MODIFY_TUNN_CONFIG(p_hwfn, mask, b_update, tunn) 0
+
+#define OSAL_DIV_S64(a, b)	((a) / (b))
 #define OSAL_LLDP_RX_TLVS(p_hwfn, tlv_buf, tlv_size) nothing
 
 #endif /* __BCM_OSAL_H */
diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c
index d3abe08..c81048a 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -1989,7 +1989,7 @@ enum ECORE_ROCE_EDPM_MODE {
 		/* Either EDPM is mandatory, or we are attempting to allocate a
 		 * WID per CPU.
 		 */
-		n_cpus = OSAL_NUM_ACTIVE_CPU();
+		n_cpus = OSAL_NUM_CPUS();
 		rc = ecore_hw_init_dpi_size(p_hwfn, p_ptt, pwm_regsize, n_cpus);
 	}
 
diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c
index f370fb6..f09462b 100644
--- a/drivers/net/qede/base/ecore_mcp.c
+++ b/drivers/net/qede/base/ecore_mcp.c
@@ -477,6 +477,7 @@ static void ecore_mcp_cmd_set_blocking(struct ecore_hwfn *p_hwfn,
 
 		OSAL_SPIN_UNLOCK(&p_hwfn->mcp_info->cmd_lock);
 		OSAL_UDELAY(delay);
+		OSAL_MFW_CMD_PREEMPT(p_hwfn);
 	} while (++cnt < max_retries);
 
 	if (cnt >= max_retries) {
@@ -518,6 +519,7 @@ static void ecore_mcp_cmd_set_blocking(struct ecore_hwfn *p_hwfn,
 			goto err;
 
 		OSAL_SPIN_UNLOCK(&p_hwfn->mcp_info->cmd_lock);
+		OSAL_MFW_CMD_PREEMPT(p_hwfn);
 	} while (++cnt < max_retries);
 
 	if (cnt >= max_retries) {
@@ -1195,6 +1197,8 @@ static void ecore_mcp_handle_transceiver_change(struct ecore_hwfn *p_hwfn,
 		DP_NOTICE(p_hwfn, false, "Transceiver is present.\n");
 	else
 		DP_NOTICE(p_hwfn, false, "Transceiver is unplugged.\n");
+
+	OSAL_TRANSCEIVER_UPDATE(p_hwfn);
 }
 
 static void ecore_mcp_read_eee_config(struct ecore_hwfn *p_hwfn,
diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c
index 53d3d24..8eafb83 100644
--- a/drivers/net/qede/base/ecore_sriov.c
+++ b/drivers/net/qede/base/ecore_sriov.c
@@ -2173,6 +2173,7 @@ static void ecore_iov_vf_mbx_stop_vport(struct ecore_hwfn *p_hwfn,
 	u8 status = PFVF_STATUS_SUCCESS;
 	enum _ecore_status_t rc;
 
+	OSAL_IOV_VF_VPORT_STOP(p_hwfn, vf);
 	vf->vport_instance--;
 	vf->spoof_chk = false;
 
-- 
1.7.10.3

  parent reply	other threads:[~2017-10-07  6:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-07  6:30 [dpdk-dev] [PATCH 00/17] update QEDE base driver to 8.30.8.0 Rasesh Mody
2017-10-07  6:30 ` [dpdk-dev] [PATCH 01/17] net/qede/base: add xcvr type and DON FW defines Rasesh Mody
2017-10-07  6:30 ` [dpdk-dev] [PATCH 02/17] net/qede/base: add NVRAM config options Rasesh Mody
2017-10-07  6:30 ` [dpdk-dev] [PATCH 03/17] net/qede/base: introduce HW/SW channel Rasesh Mody
2017-10-07  6:30 ` [dpdk-dev] [PATCH 04/17] net/qede/base: add LLDP support Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 05/17] net/qede/base: add check for DMA engine state Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 06/17] net/qede/base: use the correct size value Rasesh Mody
2017-10-07  6:31 ` Rasesh Mody [this message]
2017-10-07  6:31 ` [dpdk-dev] [PATCH 08/17] net/qede/base: add/fix comments Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 09/17] net/qede/base: add/change/revise logs Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 10/17] net/qede/base: semantic changes Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 11/17] net/qede/base: code cleanup Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 12/17] net/qede/base: check device personality for feature setting Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 13/17] net/qede/base: change default page size of ILT clients Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 14/17] net/qede/base: fix access to an uninitialized list Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 15/17] net/qede/base: fix for VF malicious indication Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 16/17] net/qede/base: fix return code to align with FW Rasesh Mody
2017-10-07  6:31 ` [dpdk-dev] [PATCH 17/17] net/qede/base: update base driver version to 8.30.8.0 Rasesh Mody
2017-10-09  3:33 ` [dpdk-dev] [PATCH 00/17] update QEDE base driver " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507357872-26475-8-git-send-email-rasesh.mody@cavium.com \
    --to=rasesh.mody@cavium.com \
    --cc=Dept-EngDPDKDev@cavium.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).