Skip to content

Commit 25c020a

Browse files
Sudarsana Reddy Kallurudavem330
authored andcommitted
qed: Correct Multicast API to reflect existence of 256 approximate buckets.
FW hsi contains 256 approximation buckets which are split in ramrod into eight u32 values, but driver is using eight 'unsigned long' variables. This patch fixes the mcast logic by making the API utilize u32. Fixes: 83aeb93 ("qed*: Trivial modifications") Signed-off-by: Sudarsana Reddy Kalluru <[email protected]> Signed-off-by: Ariel Elior <[email protected]> Signed-off-by: Michal Kalderon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 58874c7 commit 25c020a

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

drivers/net/ethernet/qlogic/qed/qed_l2.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ qed_sp_update_mcast_bin(struct qed_hwfn *p_hwfn,
665665

666666
p_ramrod->common.update_approx_mcast_flg = 1;
667667
for (i = 0; i < ETH_MULTICAST_MAC_BINS_IN_REGS; i++) {
668-
u32 *p_bins = (u32 *)p_params->bins;
668+
u32 *p_bins = p_params->bins;
669669

670670
p_ramrod->approx_mcast.bins[i] = cpu_to_le32(p_bins[i]);
671671
}
@@ -1476,8 +1476,8 @@ qed_sp_eth_filter_mcast(struct qed_hwfn *p_hwfn,
14761476
enum spq_mode comp_mode,
14771477
struct qed_spq_comp_cb *p_comp_data)
14781478
{
1479-
unsigned long bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
14801479
struct vport_update_ramrod_data *p_ramrod = NULL;
1480+
u32 bins[ETH_MULTICAST_MAC_BINS_IN_REGS];
14811481
struct qed_spq_entry *p_ent = NULL;
14821482
struct qed_sp_init_data init_data;
14831483
u8 abs_vport_id = 0;
@@ -1513,26 +1513,25 @@ qed_sp_eth_filter_mcast(struct qed_hwfn *p_hwfn,
15131513
/* explicitly clear out the entire vector */
15141514
memset(&p_ramrod->approx_mcast.bins, 0,
15151515
sizeof(p_ramrod->approx_mcast.bins));
1516-
memset(bins, 0, sizeof(unsigned long) *
1517-
ETH_MULTICAST_MAC_BINS_IN_REGS);
1516+
memset(bins, 0, sizeof(bins));
15181517
/* filter ADD op is explicit set op and it removes
15191518
* any existing filters for the vport
15201519
*/
15211520
if (p_filter_cmd->opcode == QED_FILTER_ADD) {
15221521
for (i = 0; i < p_filter_cmd->num_mc_addrs; i++) {
1523-
u32 bit;
1522+
u32 bit, nbits;
15241523

15251524
bit = qed_mcast_bin_from_mac(p_filter_cmd->mac[i]);
1526-
__set_bit(bit, bins);
1525+
nbits = sizeof(u32) * BITS_PER_BYTE;
1526+
bins[bit / nbits] |= 1 << (bit % nbits);
15271527
}
15281528

15291529
/* Convert to correct endianity */
15301530
for (i = 0; i < ETH_MULTICAST_MAC_BINS_IN_REGS; i++) {
15311531
struct vport_update_ramrod_mcast *p_ramrod_bins;
1532-
u32 *p_bins = (u32 *)bins;
15331532

15341533
p_ramrod_bins = &p_ramrod->approx_mcast;
1535-
p_ramrod_bins->bins[i] = cpu_to_le32(p_bins[i]);
1534+
p_ramrod_bins->bins[i] = cpu_to_le32(bins[i]);
15361535
}
15371536
}
15381537

drivers/net/ethernet/qlogic/qed/qed_l2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ struct qed_sp_vport_update_params {
215215
u8 anti_spoofing_en;
216216
u8 update_accept_any_vlan_flg;
217217
u8 accept_any_vlan;
218-
unsigned long bins[8];
218+
u32 bins[8];
219219
struct qed_rss_params *rss_params;
220220
struct qed_filter_accept_flags accept_flags;
221221
struct qed_sge_tpa_params *sge_tpa_params;

drivers/net/ethernet/qlogic/qed/qed_sriov.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2831,7 +2831,7 @@ qed_iov_vp_update_mcast_bin_param(struct qed_hwfn *p_hwfn,
28312831

28322832
p_data->update_approx_mcast_flg = 1;
28332833
memcpy(p_data->bins, p_mcast_tlv->bins,
2834-
sizeof(unsigned long) * ETH_MULTICAST_MAC_BINS_IN_REGS);
2834+
sizeof(u32) * ETH_MULTICAST_MAC_BINS_IN_REGS);
28352835
*tlvs_mask |= 1 << QED_IOV_VP_UPDATE_MCAST;
28362836
}
28372837

drivers/net/ethernet/qlogic/qed/qed_vf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
11261126
resp_size += sizeof(struct pfvf_def_resp_tlv);
11271127

11281128
memcpy(p_mcast_tlv->bins, p_params->bins,
1129-
sizeof(unsigned long) * ETH_MULTICAST_MAC_BINS_IN_REGS);
1129+
sizeof(u32) * ETH_MULTICAST_MAC_BINS_IN_REGS);
11301130
}
11311131

11321132
update_rx = p_params->accept_flags.update_rx_mode_config;
@@ -1272,7 +1272,7 @@ void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
12721272
u32 bit;
12731273

12741274
bit = qed_mcast_bin_from_mac(p_filter_cmd->mac[i]);
1275-
__set_bit(bit, sp_params.bins);
1275+
sp_params.bins[bit / 32] |= 1 << (bit % 32);
12761276
}
12771277
}
12781278

drivers/net/ethernet/qlogic/qed/qed_vf.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,12 @@ struct vfpf_vport_update_mcast_bin_tlv {
392392
struct channel_tlv tl;
393393
u8 padding[4];
394394

395-
u64 bins[8];
395+
/* There are only 256 approx bins, and in HSI they're divided into
396+
* 32-bit values. As old VFs used to set-bit to the values on its side,
397+
* the upper half of the array is never expected to contain any data.
398+
*/
399+
u64 bins[4];
400+
u64 obsolete_bins[4];
396401
};
397402

398403
struct vfpf_vport_update_accept_param_tlv {

0 commit comments

Comments
 (0)