21
21
#define DRV_NAME "nicpf"
22
22
#define DRV_VERSION "1.0"
23
23
24
+ #define NIC_VF_PER_MBX_REG 64
25
+
24
26
struct hw_info {
25
27
u8 bgx_cnt ;
26
28
u8 chans_per_lmac ;
@@ -1072,6 +1074,40 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
1072
1074
case NIC_MBOX_MSG_PTP_CFG :
1073
1075
nic_config_timestamp (nic , vf , & mbx .ptp );
1074
1076
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 ;
1075
1111
default :
1076
1112
dev_err (& nic -> pdev -> dev ,
1077
1113
"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)
1094
1130
struct nicpf * nic = (struct nicpf * )nic_irq ;
1095
1131
int mbx ;
1096
1132
u64 intr ;
1097
- u8 vf , vf_per_mbx_reg = 64 ;
1133
+ u8 vf ;
1098
1134
1099
1135
if (irq == pci_irq_vector (nic -> pdev , NIC_PF_INTR_ID_MBOX0 ))
1100
1136
mbx = 0 ;
@@ -1103,12 +1139,13 @@ static irqreturn_t nic_mbx_intr_handler(int irq, void *nic_irq)
1103
1139
1104
1140
intr = nic_reg_read (nic , NIC_PF_MAILBOX_INT + (mbx << 3 ));
1105
1141
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 ++ ) {
1107
1143
if (intr & (1ULL << vf )) {
1108
1144
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 ));
1110
1146
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 ));
1112
1149
nic_clear_mbx_intr (nic , vf , mbx );
1113
1150
}
1114
1151
}
0 commit comments