|
@@ -1647,87 +1647,6 @@ int hns_dsaf_rm_mac_addr(
|
|
|
mac_entry->addr);
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * hns_dsaf_set_mac_mc_entry - set mac mc-entry
|
|
|
- * @dsaf_dev: dsa fabric device struct pointer
|
|
|
- * @mac_entry: mc-mac entry
|
|
|
- */
|
|
|
-int hns_dsaf_set_mac_mc_entry(
|
|
|
- struct dsaf_device *dsaf_dev,
|
|
|
- struct dsaf_drv_mac_multi_dest_entry *mac_entry)
|
|
|
-{
|
|
|
- u16 entry_index = DSAF_INVALID_ENTRY_IDX;
|
|
|
- struct dsaf_drv_tbl_tcam_key mac_key;
|
|
|
- struct dsaf_tbl_tcam_mcast_cfg mac_data;
|
|
|
- struct dsaf_drv_priv *priv =
|
|
|
- (struct dsaf_drv_priv *)hns_dsaf_dev_priv(dsaf_dev);
|
|
|
- struct dsaf_drv_soft_mac_tbl *soft_mac_entry = priv->soft_mac_tbl;
|
|
|
- struct dsaf_drv_tbl_tcam_key tmp_mac_key;
|
|
|
- struct dsaf_tbl_tcam_data tcam_data;
|
|
|
-
|
|
|
- /* mac addr check */
|
|
|
- if (MAC_IS_ALL_ZEROS(mac_entry->addr)) {
|
|
|
- dev_err(dsaf_dev->dev, "set uc %s Mac %pM err!\n",
|
|
|
- dsaf_dev->ae_dev.name, mac_entry->addr);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- /*config key */
|
|
|
- hns_dsaf_set_mac_key(dsaf_dev, &mac_key,
|
|
|
- mac_entry->in_vlan_id,
|
|
|
- mac_entry->in_port_num, mac_entry->addr);
|
|
|
-
|
|
|
- /* entry ie exist? */
|
|
|
- entry_index = hns_dsaf_find_soft_mac_entry(dsaf_dev, &mac_key);
|
|
|
- if (entry_index == DSAF_INVALID_ENTRY_IDX) {
|
|
|
- /*if hasnot, find enpty entry*/
|
|
|
- entry_index = hns_dsaf_find_empty_mac_entry(dsaf_dev);
|
|
|
- if (entry_index == DSAF_INVALID_ENTRY_IDX) {
|
|
|
- /*if hasnot empty, error*/
|
|
|
- dev_err(dsaf_dev->dev,
|
|
|
- "set_uc_entry failed, %s Mac key(%#x:%#x)\n",
|
|
|
- dsaf_dev->ae_dev.name,
|
|
|
- mac_key.high.val, mac_key.low.val);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- /* config hardware entry */
|
|
|
- memset(mac_data.tbl_mcast_port_msk,
|
|
|
- 0, sizeof(mac_data.tbl_mcast_port_msk));
|
|
|
- } else {
|
|
|
- /* config hardware entry */
|
|
|
- hns_dsaf_tcam_mc_get(dsaf_dev, entry_index, &tcam_data,
|
|
|
- &mac_data);
|
|
|
-
|
|
|
- tmp_mac_key.high.val =
|
|
|
- le32_to_cpu(tcam_data.tbl_tcam_data_high);
|
|
|
- tmp_mac_key.low.val = le32_to_cpu(tcam_data.tbl_tcam_data_low);
|
|
|
- }
|
|
|
- mac_data.tbl_mcast_old_en = 0;
|
|
|
- mac_data.tbl_mcast_item_vld = 1;
|
|
|
- dsaf_set_field(mac_data.tbl_mcast_port_msk[0],
|
|
|
- 0x3F, 0, mac_entry->port_mask[0]);
|
|
|
-
|
|
|
- dev_dbg(dsaf_dev->dev,
|
|
|
- "set_uc_entry, %s key(%#x:%#x) entry_index%d\n",
|
|
|
- dsaf_dev->ae_dev.name, mac_key.high.val,
|
|
|
- mac_key.low.val, entry_index);
|
|
|
-
|
|
|
- tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val);
|
|
|
- tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val);
|
|
|
-
|
|
|
- hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index, &tcam_data, NULL,
|
|
|
- &mac_data);
|
|
|
-
|
|
|
- /* config software entry */
|
|
|
- soft_mac_entry += entry_index;
|
|
|
- soft_mac_entry->index = entry_index;
|
|
|
- soft_mac_entry->tcam_key.high.val = mac_key.high.val;
|
|
|
- soft_mac_entry->tcam_key.low.val = mac_key.low.val;
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static void hns_dsaf_mc_mask_bit_clear(char *dst, const char *src)
|
|
|
{
|
|
|
u16 *a = (u16 *)dst;
|