linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
To: sgoutham@cavium.com, sunil.kovvuri@gmail.com, rric@kernel.org,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, davem@davemloft.net
Cc: dnelson@redhat.com, ynorov@caviumnetworks.com,
	Vadim Lomovtsev <Vadim.Lomovtsev@cavium.com>
Subject: [PATCH v2 5/7] net: thunderx: add XCAST messages handlers for PF
Date: Fri, 30 Mar 2018 04:59:51 -0700	[thread overview]
Message-ID: <20180330115953.17154-6-Vadim.Lomovtsev@caviumnetworks.com> (raw)
In-Reply-To: <20180330115953.17154-1-Vadim.Lomovtsev@caviumnetworks.com>

From: Vadim Lomovtsev <Vadim.Lomovtsev@cavium.com>

This commit is to add message handling for ndo_set_rx_mode()
callback at PF side.

Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@cavium.com>
---
 drivers/net/ethernet/cavium/thunder/nic_main.c | 45 +++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 7ff66a8194e2..55af04fa03a7 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -21,6 +21,8 @@
 #define DRV_NAME	"nicpf"
 #define DRV_VERSION	"1.0"
 
+#define NIC_VF_PER_MBX_REG      64
+
 struct hw_info {
 	u8		bgx_cnt;
 	u8		chans_per_lmac;
@@ -1072,6 +1074,40 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
 	case NIC_MBOX_MSG_PTP_CFG:
 		nic_config_timestamp(nic, vf, &mbx.ptp);
 		break;
+	case NIC_MBOX_MSG_RESET_XCAST:
+		if (vf >= nic->num_vf_en) {
+			ret = -1; /* NACK */
+			break;
+		}
+		bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
+		lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
+		bgx_reset_xcast_mode(nic->node, bgx, lmac,
+				     vf < NIC_VF_PER_MBX_REG ? vf :
+				     vf - NIC_VF_PER_MBX_REG);
+		break;
+
+	case NIC_MBOX_MSG_ADD_MCAST:
+		if (vf >= nic->num_vf_en) {
+			ret = -1; /* NACK */
+			break;
+		}
+		bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
+		lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
+		bgx_set_dmac_cam_filter(nic->node, bgx, lmac,
+					mbx.xcast.data.mac,
+					vf < NIC_VF_PER_MBX_REG ? vf :
+					vf - NIC_VF_PER_MBX_REG);
+		break;
+
+	case NIC_MBOX_MSG_SET_XCAST:
+		if (vf >= nic->num_vf_en) {
+			ret = -1; /* NACK */
+			break;
+		}
+		bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
+		lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
+		bgx_set_xcast_mode(nic->node, bgx, lmac, mbx.xcast.data.mode);
+		break;
 	default:
 		dev_err(&nic->pdev->dev,
 			"Invalid msg from VF%d, msg 0x%x\n", vf, mbx.msg.msg);
@@ -1094,7 +1130,7 @@ static irqreturn_t nic_mbx_intr_handler(int irq, void *nic_irq)
 	struct nicpf *nic = (struct nicpf *)nic_irq;
 	int mbx;
 	u64 intr;
-	u8  vf, vf_per_mbx_reg = 64;
+	u8  vf;
 
 	if (irq == pci_irq_vector(nic->pdev, NIC_PF_INTR_ID_MBOX0))
 		mbx = 0;
@@ -1103,12 +1139,13 @@ static irqreturn_t nic_mbx_intr_handler(int irq, void *nic_irq)
 
 	intr = nic_reg_read(nic, NIC_PF_MAILBOX_INT + (mbx << 3));
 	dev_dbg(&nic->pdev->dev, "PF interrupt Mbox%d 0x%llx\n", mbx, intr);
-	for (vf = 0; vf < vf_per_mbx_reg; vf++) {
+	for (vf = 0; vf < NIC_VF_PER_MBX_REG; vf++) {
 		if (intr & (1ULL << vf)) {
 			dev_dbg(&nic->pdev->dev, "Intr from VF %d\n",
-				vf + (mbx * vf_per_mbx_reg));
+				vf + (mbx * NIC_VF_PER_MBX_REG));
 
-			nic_handle_mbx_intr(nic, vf + (mbx * vf_per_mbx_reg));
+			nic_handle_mbx_intr(nic, vf +
+					    (mbx * NIC_VF_PER_MBX_REG));
 			nic_clear_mbx_intr(nic, vf, mbx);
 		}
 	}
-- 
2.14.3

  parent reply	other threads:[~2018-03-30 12:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 15:07 [PATCH 0/7] net: thunderx: implement DMAC filtering support Vadim Lomovtsev
2018-03-27 15:07 ` [PATCH 1/7] net: thunderx: move filter register related macro into proper place Vadim Lomovtsev
2018-03-27 15:07 ` [PATCH 2/7] net: thunderx: add MAC address filter tracking for LMAC Vadim Lomovtsev
2018-03-27 15:07 ` [PATCH 3/7] net: thunderx: add multicast filter management support Vadim Lomovtsev
2018-03-28 12:29   ` kbuild test robot
2018-03-27 15:07 ` [PATCH 4/7] net: thunderx: add new messages for handle ndo_set_rx_mode callback Vadim Lomovtsev
2018-03-27 15:07 ` [PATCH 5/7] net: thunderx: add XCAST messages handlers for PF Vadim Lomovtsev
2018-03-27 15:07 ` [PATCH 6/7] net: thunderx: add workqueue control structures for handle ndo_set_rx_mode request Vadim Lomovtsev
2018-03-27 15:07 ` [PATCH 7/7] net: thunderx: add ndo_set_rx_mode callback implementation for VF Vadim Lomovtsev
2018-03-27 17:28 ` [PATCH 0/7] net: thunderx: implement DMAC filtering support David Miller
2018-03-28  8:47   ` Vadim Lomovtsev
2018-03-30 11:59 ` [PATCH v2 " Vadim Lomovtsev
2018-03-30 11:59   ` [PATCH v2 1/7] net: thunderx: move filter register related macro into proper place Vadim Lomovtsev
2018-03-30 11:59   ` [PATCH v2 2/7] net: thunderx: add MAC address filter tracking for LMAC Vadim Lomovtsev
2018-03-30 11:59   ` [PATCH v2 3/7] net: thunderx: add multicast filter management support Vadim Lomovtsev
2018-03-30 11:59   ` [PATCH v2 4/7] net: thunderx: add new messages for handle ndo_set_rx_mode callback Vadim Lomovtsev
2018-03-30 11:59   ` Vadim Lomovtsev [this message]
2018-03-30 11:59   ` [PATCH v2 6/7] net: thunderx: add workqueue control structures for handle ndo_set_rx_mode request Vadim Lomovtsev
2018-03-30 11:59   ` [PATCH v2 7/7] net: thunderx: add ndo_set_rx_mode callback implementation for VF Vadim Lomovtsev
2018-04-01  2:07   ` [PATCH v2 0/7] net: thunderx: implement DMAC filtering support David Miller
2018-04-02 10:40     ` Vadim Lomovtsev
2019-02-20 11:02 ` [PATCH v3 0/8] nic: thunderx: fix communication races between VF & PF Vadim Lomovtsev
2019-02-20 11:02   ` [PATCH v3 1/8] net: thunderx: correct typo in macro name Vadim Lomovtsev
2019-02-20 11:02   ` [PATCH v3 2/8] net: thunderx: replace global nicvf_rx_mode_wq work queue for all VFs to private for each of them Vadim Lomovtsev
2019-02-20 11:02   ` [PATCH v3 3/8] net: thunderx: make CFG_DONE message to run through generic send-ack sequence Vadim Lomovtsev
2019-02-20 11:02   ` [PATCH v3 5/8] net: thunderx: rework xcast message structure to make it fit into 64 bit Vadim Lomovtsev
2019-02-20 11:02   ` [PATCH v3 6/8] net: thunderx: add mutex to protect mailbox from concurrent calls for same VF Vadim Lomovtsev
2019-02-20 11:02   ` [PATCH v3 4/8] net: thunderx: add nicvf_send_msg_to_pf result check for set_rx_mode_task Vadim Lomovtsev
2019-02-20 11:02   ` [PATCH v3 7/8] net: thunderx: move link state polling function to VF Vadim Lomovtsev
2019-02-20 11:02   ` [PATCH v3 8/8] net: thunderx: remove link change polling code and info from nicpf Vadim Lomovtsev
2019-02-20 11:19   ` [PATCH v3 0/8] nic: thunderx: fix communication races between VF & PF Vadim Lomovtsev
2019-02-22 19:44   ` David Miller

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=20180330115953.17154-6-Vadim.Lomovtsev@caviumnetworks.com \
    --to=vadim.lomovtsev@caviumnetworks.com \
    --cc=Vadim.Lomovtsev@cavium.com \
    --cc=davem@davemloft.net \
    --cc=dnelson@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rric@kernel.org \
    --cc=sgoutham@cavium.com \
    --cc=sunil.kovvuri@gmail.com \
    --cc=ynorov@caviumnetworks.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).