Skip to content

Commit aba4a26

Browse files
Vadim Lomovtsevdavem330
authored andcommitted
net: thunderx: add XCAST messages handlers for PF
This commit is to add message handling for ndo_set_rx_mode() callback at PF side. Signed-off-by: Vadim Lomovtsev <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0b849f5 commit aba4a26

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

drivers/net/ethernet/cavium/thunder/nic_main.c

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#define DRV_NAME "nicpf"
2222
#define DRV_VERSION "1.0"
2323

24+
#define NIC_VF_PER_MBX_REG 64
25+
2426
struct hw_info {
2527
u8 bgx_cnt;
2628
u8 chans_per_lmac;
@@ -1072,6 +1074,40 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
10721074
case NIC_MBOX_MSG_PTP_CFG:
10731075
nic_config_timestamp(nic, vf, &mbx.ptp);
10741076
break;
1077+
case NIC_MBOX_MSG_RESET_XCAST:
1078+
if (vf >= nic->num_vf_en) {
1079+
ret = -1; /* NACK */
1080+
break;
1081+
}
1082+
bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
1083+
lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
1084+
bgx_reset_xcast_mode(nic->node, bgx, lmac,
1085+
vf < NIC_VF_PER_MBX_REG ? vf :
1086+
vf - NIC_VF_PER_MBX_REG);
1087+
break;
1088+
1089+
case NIC_MBOX_MSG_ADD_MCAST:
1090+
if (vf >= nic->num_vf_en) {
1091+
ret = -1; /* NACK */
1092+
break;
1093+
}
1094+
bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
1095+
lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
1096+
bgx_set_dmac_cam_filter(nic->node, bgx, lmac,
1097+
mbx.xcast.data.mac,
1098+
vf < NIC_VF_PER_MBX_REG ? vf :
1099+
vf - NIC_VF_PER_MBX_REG);
1100+
break;
1101+
1102+
case NIC_MBOX_MSG_SET_XCAST:
1103+
if (vf >= nic->num_vf_en) {
1104+
ret = -1; /* NACK */
1105+
break;
1106+
}
1107+
bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
1108+
lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]);
1109+
bgx_set_xcast_mode(nic->node, bgx, lmac, mbx.xcast.data.mode);
1110+
break;
10751111
default:
10761112
dev_err(&nic->pdev->dev,
10771113
"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)
10941130
struct nicpf *nic = (struct nicpf *)nic_irq;
10951131
int mbx;
10961132
u64 intr;
1097-
u8 vf, vf_per_mbx_reg = 64;
1133+
u8 vf;
10981134

10991135
if (irq == pci_irq_vector(nic->pdev, NIC_PF_INTR_ID_MBOX0))
11001136
mbx = 0;
@@ -1103,12 +1139,13 @@ static irqreturn_t nic_mbx_intr_handler(int irq, void *nic_irq)
11031139

11041140
intr = nic_reg_read(nic, NIC_PF_MAILBOX_INT + (mbx << 3));
11051141
dev_dbg(&nic->pdev->dev, "PF interrupt Mbox%d 0x%llx\n", mbx, intr);
1106-
for (vf = 0; vf < vf_per_mbx_reg; vf++) {
1142+
for (vf = 0; vf < NIC_VF_PER_MBX_REG; vf++) {
11071143
if (intr & (1ULL << vf)) {
11081144
dev_dbg(&nic->pdev->dev, "Intr from VF %d\n",
1109-
vf + (mbx * vf_per_mbx_reg));
1145+
vf + (mbx * NIC_VF_PER_MBX_REG));
11101146

1111-
nic_handle_mbx_intr(nic, vf + (mbx * vf_per_mbx_reg));
1147+
nic_handle_mbx_intr(nic, vf +
1148+
(mbx * NIC_VF_PER_MBX_REG));
11121149
nic_clear_mbx_intr(nic, vf, mbx);
11131150
}
11141151
}

0 commit comments

Comments
 (0)