• Home
  • Raw
  • Download

Lines Matching refs:ale

231 static int cpsw_ale_entry_get_fld(struct cpsw_ale *ale,  in cpsw_ale_entry_get_fld()  argument
239 if (!ale || !ale_entry) in cpsw_ale_entry_get_fld()
244 dev_err(ale->params.dev, "get: wrong ale fld id %d\n", fld_id); in cpsw_ale_entry_get_fld()
250 bits = ale->port_mask_bits; in cpsw_ale_entry_get_fld()
255 static void cpsw_ale_entry_set_fld(struct cpsw_ale *ale, in cpsw_ale_entry_set_fld() argument
264 if (!ale || !ale_entry) in cpsw_ale_entry_set_fld()
269 dev_err(ale->params.dev, "set: wrong ale fld id %d\n", fld_id); in cpsw_ale_entry_set_fld()
275 bits = ale->port_mask_bits; in cpsw_ale_entry_set_fld()
280 static int cpsw_ale_vlan_get_fld(struct cpsw_ale *ale, in cpsw_ale_vlan_get_fld() argument
284 return cpsw_ale_entry_get_fld(ale, ale_entry, in cpsw_ale_vlan_get_fld()
285 ale->vlan_entry_tbl, fld_id); in cpsw_ale_vlan_get_fld()
288 static void cpsw_ale_vlan_set_fld(struct cpsw_ale *ale, in cpsw_ale_vlan_set_fld() argument
293 cpsw_ale_entry_set_fld(ale, ale_entry, in cpsw_ale_vlan_set_fld()
294 ale->vlan_entry_tbl, fld_id, value); in cpsw_ale_vlan_set_fld()
314 static int cpsw_ale_read(struct cpsw_ale *ale, int idx, u32 *ale_entry) in cpsw_ale_read() argument
318 WARN_ON(idx > ale->params.ale_entries); in cpsw_ale_read()
320 writel_relaxed(idx, ale->params.ale_regs + ALE_TABLE_CONTROL); in cpsw_ale_read()
323 ale_entry[i] = readl_relaxed(ale->params.ale_regs + in cpsw_ale_read()
329 static int cpsw_ale_write(struct cpsw_ale *ale, int idx, u32 *ale_entry) in cpsw_ale_write() argument
333 WARN_ON(idx > ale->params.ale_entries); in cpsw_ale_write()
336 writel_relaxed(ale_entry[i], ale->params.ale_regs + in cpsw_ale_write()
339 writel_relaxed(idx | ALE_TABLE_WRITE, ale->params.ale_regs + in cpsw_ale_write()
345 static int cpsw_ale_match_addr(struct cpsw_ale *ale, const u8 *addr, u16 vid) in cpsw_ale_match_addr() argument
350 for (idx = 0; idx < ale->params.ale_entries; idx++) { in cpsw_ale_match_addr()
353 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_match_addr()
366 static int cpsw_ale_match_vlan(struct cpsw_ale *ale, u16 vid) in cpsw_ale_match_vlan() argument
371 for (idx = 0; idx < ale->params.ale_entries; idx++) { in cpsw_ale_match_vlan()
372 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_match_vlan()
382 static int cpsw_ale_match_free(struct cpsw_ale *ale) in cpsw_ale_match_free() argument
387 for (idx = 0; idx < ale->params.ale_entries; idx++) { in cpsw_ale_match_free()
388 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_match_free()
396 static int cpsw_ale_find_ageable(struct cpsw_ale *ale) in cpsw_ale_find_ageable() argument
401 for (idx = 0; idx < ale->params.ale_entries; idx++) { in cpsw_ale_find_ageable()
402 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_find_ageable()
416 static void cpsw_ale_flush_mcast(struct cpsw_ale *ale, u32 *ale_entry, in cpsw_ale_flush_mcast() argument
422 ale->port_mask_bits); in cpsw_ale_flush_mcast()
430 ale->port_mask_bits); in cpsw_ale_flush_mcast()
435 int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid) in cpsw_ale_flush_multicast() argument
440 for (idx = 0; idx < ale->params.ale_entries; idx++) { in cpsw_ale_flush_multicast()
441 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_flush_multicast()
462 cpsw_ale_flush_mcast(ale, ale_entry, port_mask); in cpsw_ale_flush_multicast()
465 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_flush_multicast()
481 int cpsw_ale_add_ucast(struct cpsw_ale *ale, const u8 *addr, int port, in cpsw_ale_add_ucast() argument
493 cpsw_ale_set_port_num(ale_entry, port, ale->port_num_bits); in cpsw_ale_add_ucast()
495 idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); in cpsw_ale_add_ucast()
497 idx = cpsw_ale_match_free(ale); in cpsw_ale_add_ucast()
499 idx = cpsw_ale_find_ageable(ale); in cpsw_ale_add_ucast()
503 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_add_ucast()
507 int cpsw_ale_del_ucast(struct cpsw_ale *ale, const u8 *addr, int port, in cpsw_ale_del_ucast() argument
513 idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); in cpsw_ale_del_ucast()
518 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_del_ucast()
522 int cpsw_ale_add_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, in cpsw_ale_add_mcast() argument
528 idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); in cpsw_ale_add_mcast()
530 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_add_mcast()
539 ale->port_mask_bits); in cpsw_ale_add_mcast()
542 ale->port_mask_bits); in cpsw_ale_add_mcast()
545 idx = cpsw_ale_match_free(ale); in cpsw_ale_add_mcast()
547 idx = cpsw_ale_find_ageable(ale); in cpsw_ale_add_mcast()
551 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_add_mcast()
555 int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, in cpsw_ale_del_mcast() argument
562 idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); in cpsw_ale_del_mcast()
566 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_del_mcast()
570 ale->port_mask_bits); in cpsw_ale_del_mcast()
576 ale->port_mask_bits); in cpsw_ale_del_mcast()
580 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_del_mcast()
585 static void cpsw_ale_set_vlan_mcast(struct cpsw_ale *ale, u32 *ale_entry, in cpsw_ale_set_vlan_mcast() argument
591 idx = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_set_vlan_mcast()
593 writel(reg_mcast, ale->params.ale_regs + ALE_VLAN_MASK_MUX(idx)); in cpsw_ale_set_vlan_mcast()
596 idx = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_set_vlan_mcast()
598 writel(unreg_mcast, ale->params.ale_regs + ALE_VLAN_MASK_MUX(idx)); in cpsw_ale_set_vlan_mcast()
601 static void cpsw_ale_set_vlan_untag(struct cpsw_ale *ale, u32 *ale_entry, in cpsw_ale_set_vlan_untag() argument
604 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_set_vlan_untag()
608 bitmap_set(ale->p0_untag_vid_mask, vid, 1); in cpsw_ale_set_vlan_untag()
610 bitmap_clear(ale->p0_untag_vid_mask, vid, 1); in cpsw_ale_set_vlan_untag()
613 int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port_mask, int untag, in cpsw_ale_add_vlan() argument
619 idx = cpsw_ale_match_vlan(ale, vid); in cpsw_ale_add_vlan()
621 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_add_vlan()
625 cpsw_ale_set_vlan_untag(ale, ale_entry, vid, untag); in cpsw_ale_add_vlan()
627 if (!ale->params.nu_switch_ale) { in cpsw_ale_add_vlan()
628 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_add_vlan()
630 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_add_vlan()
633 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_add_vlan()
636 cpsw_ale_set_vlan_mcast(ale, ale_entry, reg_mcast, unreg_mcast); in cpsw_ale_add_vlan()
639 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_add_vlan()
643 idx = cpsw_ale_match_free(ale); in cpsw_ale_add_vlan()
645 idx = cpsw_ale_find_ageable(ale); in cpsw_ale_add_vlan()
649 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_add_vlan()
653 static void cpsw_ale_vlan_del_modify_int(struct cpsw_ale *ale, u32 *ale_entry, in cpsw_ale_vlan_del_modify_int() argument
659 members = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_del_modify_int()
663 cpsw_ale_set_vlan_untag(ale, ale_entry, vid, 0); in cpsw_ale_vlan_del_modify_int()
668 untag = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_del_modify_int()
670 reg_mcast = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_del_modify_int()
672 unreg_mcast = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_del_modify_int()
678 cpsw_ale_set_vlan_untag(ale, ale_entry, vid, untag); in cpsw_ale_vlan_del_modify_int()
680 if (!ale->params.nu_switch_ale) { in cpsw_ale_vlan_del_modify_int()
681 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_vlan_del_modify_int()
683 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_vlan_del_modify_int()
686 cpsw_ale_set_vlan_mcast(ale, ale_entry, reg_mcast, in cpsw_ale_vlan_del_modify_int()
689 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_vlan_del_modify_int()
693 int cpsw_ale_vlan_del_modify(struct cpsw_ale *ale, u16 vid, int port_mask) in cpsw_ale_vlan_del_modify() argument
698 idx = cpsw_ale_match_vlan(ale, vid); in cpsw_ale_vlan_del_modify()
702 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_vlan_del_modify()
704 cpsw_ale_vlan_del_modify_int(ale, ale_entry, vid, port_mask); in cpsw_ale_vlan_del_modify()
705 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_vlan_del_modify()
710 int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask) in cpsw_ale_del_vlan() argument
715 idx = cpsw_ale_match_vlan(ale, vid); in cpsw_ale_del_vlan()
719 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_del_vlan()
727 members = cpsw_ale_vlan_get_fld(ale, ale_entry, ALE_ENT_VID_MEMBER_LIST); in cpsw_ale_del_vlan()
732 cpsw_ale_set_vlan_untag(ale, ale_entry, vid, 0); in cpsw_ale_del_vlan()
736 cpsw_ale_vlan_del_modify_int(ale, ale_entry, vid, port_mask); in cpsw_ale_del_vlan()
739 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_del_vlan()
744 int cpsw_ale_vlan_add_modify(struct cpsw_ale *ale, u16 vid, int port_mask, in cpsw_ale_vlan_add_modify() argument
752 idx = cpsw_ale_match_vlan(ale, vid); in cpsw_ale_vlan_add_modify()
754 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_vlan_add_modify()
756 vlan_members = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_add_modify()
758 reg_mcast_members = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_add_modify()
761 cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_add_modify()
763 untag_members = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_add_modify()
771 ret = cpsw_ale_add_vlan(ale, vid, vlan_members, untag_members, in cpsw_ale_vlan_add_modify()
774 dev_err(ale->params.dev, "Unable to add vlan\n"); in cpsw_ale_vlan_add_modify()
777 dev_dbg(ale->params.dev, "port mask 0x%x untag 0x%x\n", vlan_members, in cpsw_ale_vlan_add_modify()
783 void cpsw_ale_set_unreg_mcast(struct cpsw_ale *ale, int unreg_mcast_mask, in cpsw_ale_set_unreg_mcast() argument
790 for (idx = 0; idx < ale->params.ale_entries; idx++) { in cpsw_ale_set_unreg_mcast()
791 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_set_unreg_mcast()
797 cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_set_unreg_mcast()
803 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_set_unreg_mcast()
806 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_set_unreg_mcast()
810 static void cpsw_ale_vlan_set_unreg_mcast(struct cpsw_ale *ale, u32 *ale_entry, in cpsw_ale_vlan_set_unreg_mcast() argument
815 unreg_mcast = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_set_unreg_mcast()
822 cpsw_ale_vlan_set_fld(ale, ale_entry, in cpsw_ale_vlan_set_unreg_mcast()
827 cpsw_ale_vlan_set_unreg_mcast_idx(struct cpsw_ale *ale, u32 *ale_entry, in cpsw_ale_vlan_set_unreg_mcast_idx() argument
833 idx = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_vlan_set_unreg_mcast_idx()
836 unreg_mcast = readl(ale->params.ale_regs + ALE_VLAN_MASK_MUX(idx)); in cpsw_ale_vlan_set_unreg_mcast_idx()
843 writel(unreg_mcast, ale->params.ale_regs + ALE_VLAN_MASK_MUX(idx)); in cpsw_ale_vlan_set_unreg_mcast_idx()
846 void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti, int port) in cpsw_ale_set_allmulti() argument
851 for (idx = 0; idx < ale->params.ale_entries; idx++) { in cpsw_ale_set_allmulti()
854 cpsw_ale_read(ale, idx, ale_entry); in cpsw_ale_set_allmulti()
859 vlan_members = cpsw_ale_vlan_get_fld(ale, ale_entry, in cpsw_ale_set_allmulti()
865 if (!ale->params.nu_switch_ale) in cpsw_ale_set_allmulti()
866 cpsw_ale_vlan_set_unreg_mcast(ale, ale_entry, allmulti); in cpsw_ale_set_allmulti()
868 cpsw_ale_vlan_set_unreg_mcast_idx(ale, ale_entry, in cpsw_ale_set_allmulti()
871 cpsw_ale_write(ale, idx, ale_entry); in cpsw_ale_set_allmulti()
1101 int cpsw_ale_control_set(struct cpsw_ale *ale, int port, int control, in cpsw_ale_control_set() argument
1115 if (port < 0 || port >= ale->params.ale_ports) in cpsw_ale_control_set()
1125 tmp = readl_relaxed(ale->params.ale_regs + offset); in cpsw_ale_control_set()
1127 writel_relaxed(tmp, ale->params.ale_regs + offset); in cpsw_ale_control_set()
1132 int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control) in cpsw_ale_control_get() argument
1145 if (port < 0 || port >= ale->params.ale_ports) in cpsw_ale_control_get()
1151 tmp = readl_relaxed(ale->params.ale_regs + offset) >> shift; in cpsw_ale_control_get()
1155 int cpsw_ale_rx_ratelimit_mc(struct cpsw_ale *ale, int port, unsigned int ratelimit_pps) in cpsw_ale_rx_ratelimit_mc() argument
1162 dev_err(ale->params.dev, "ALE MC port:%d ratelimit min value 1000pps\n", port); in cpsw_ale_rx_ratelimit_mc()
1167 dev_info(ale->params.dev, "ALE port:%d MC ratelimit set to %dpps (requested %d)\n", in cpsw_ale_rx_ratelimit_mc()
1170 cpsw_ale_control_set(ale, port, ALE_PORT_MCAST_LIMIT, val); in cpsw_ale_rx_ratelimit_mc()
1172 dev_dbg(ale->params.dev, "ALE port:%d MC ratelimit set %d\n", in cpsw_ale_rx_ratelimit_mc()
1177 int cpsw_ale_rx_ratelimit_bc(struct cpsw_ale *ale, int port, unsigned int ratelimit_pps) in cpsw_ale_rx_ratelimit_bc() argument
1184 dev_err(ale->params.dev, "ALE port:%d BC ratelimit min value 1000pps\n", port); in cpsw_ale_rx_ratelimit_bc()
1189 dev_info(ale->params.dev, "ALE port:%d BC ratelimit set to %dpps (requested %d)\n", in cpsw_ale_rx_ratelimit_bc()
1192 cpsw_ale_control_set(ale, port, ALE_PORT_BCAST_LIMIT, val); in cpsw_ale_rx_ratelimit_bc()
1194 dev_dbg(ale->params.dev, "ALE port:%d BC ratelimit set %d\n", in cpsw_ale_rx_ratelimit_bc()
1201 struct cpsw_ale *ale = from_timer(ale, t, timer); in cpsw_ale_timer() local
1203 cpsw_ale_control_set(ale, 0, ALE_AGEOUT, 1); in cpsw_ale_timer()
1205 if (ale->ageout) { in cpsw_ale_timer()
1206 ale->timer.expires = jiffies + ale->ageout; in cpsw_ale_timer()
1207 add_timer(&ale->timer); in cpsw_ale_timer()
1211 static void cpsw_ale_hw_aging_timer_start(struct cpsw_ale *ale) in cpsw_ale_hw_aging_timer_start() argument
1215 aging_timer = ale->params.bus_freq / 1000000; in cpsw_ale_hw_aging_timer_start()
1216 aging_timer *= ale->params.ale_ageout; in cpsw_ale_hw_aging_timer_start()
1220 dev_warn(ale->params.dev, in cpsw_ale_hw_aging_timer_start()
1224 writel(aging_timer, ale->params.ale_regs + ALE_AGING_TIMER); in cpsw_ale_hw_aging_timer_start()
1227 static void cpsw_ale_hw_aging_timer_stop(struct cpsw_ale *ale) in cpsw_ale_hw_aging_timer_stop() argument
1229 writel(0, ale->params.ale_regs + ALE_AGING_TIMER); in cpsw_ale_hw_aging_timer_stop()
1232 static void cpsw_ale_aging_start(struct cpsw_ale *ale) in cpsw_ale_aging_start() argument
1234 if (!ale->params.ale_ageout) in cpsw_ale_aging_start()
1237 if (ale->features & CPSW_ALE_F_HW_AUTOAGING) { in cpsw_ale_aging_start()
1238 cpsw_ale_hw_aging_timer_start(ale); in cpsw_ale_aging_start()
1242 timer_setup(&ale->timer, cpsw_ale_timer, 0); in cpsw_ale_aging_start()
1243 ale->timer.expires = jiffies + ale->ageout; in cpsw_ale_aging_start()
1244 add_timer(&ale->timer); in cpsw_ale_aging_start()
1247 static void cpsw_ale_aging_stop(struct cpsw_ale *ale) in cpsw_ale_aging_stop() argument
1249 if (!ale->params.ale_ageout) in cpsw_ale_aging_stop()
1252 if (ale->features & CPSW_ALE_F_HW_AUTOAGING) { in cpsw_ale_aging_stop()
1253 cpsw_ale_hw_aging_timer_stop(ale); in cpsw_ale_aging_stop()
1257 del_timer_sync(&ale->timer); in cpsw_ale_aging_stop()
1260 void cpsw_ale_start(struct cpsw_ale *ale) in cpsw_ale_start() argument
1274 ale_prescale = ale->params.bus_freq / ALE_RATE_LIMIT_MIN_PPS; in cpsw_ale_start()
1275 writel((u32)ale_prescale, ale->params.ale_regs + ALE_PRESCALE); in cpsw_ale_start()
1280 cpsw_ale_control_set(ale, 0, ALE_RATE_LIMIT, 1); in cpsw_ale_start()
1282 cpsw_ale_control_set(ale, 0, ALE_ENABLE, 1); in cpsw_ale_start()
1283 cpsw_ale_control_set(ale, 0, ALE_CLEAR, 1); in cpsw_ale_start()
1285 cpsw_ale_aging_start(ale); in cpsw_ale_start()
1288 void cpsw_ale_stop(struct cpsw_ale *ale) in cpsw_ale_stop() argument
1290 cpsw_ale_aging_stop(ale); in cpsw_ale_stop()
1291 cpsw_ale_control_set(ale, 0, ALE_CLEAR, 1); in cpsw_ale_stop()
1292 cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); in cpsw_ale_stop()
1367 struct cpsw_ale *ale; in cpsw_ale_create() local
1378 ale = devm_kzalloc(params->dev, sizeof(*ale), GFP_KERNEL); in cpsw_ale_create()
1379 if (!ale) in cpsw_ale_create()
1382 ale->p0_untag_vid_mask = devm_bitmap_zalloc(params->dev, VLAN_N_VID, in cpsw_ale_create()
1384 if (!ale->p0_untag_vid_mask) in cpsw_ale_create()
1387 ale->params = *params; in cpsw_ale_create()
1388 ale->ageout = ale->params.ale_ageout * HZ; in cpsw_ale_create()
1389 ale->features = ale_dev_id->features; in cpsw_ale_create()
1390 ale->vlan_entry_tbl = ale_dev_id->vlan_entry_tbl; in cpsw_ale_create()
1392 rev = readl_relaxed(ale->params.ale_regs + ALE_IDVER); in cpsw_ale_create()
1393 ale->version = in cpsw_ale_create()
1394 (ALE_VERSION_MAJOR(rev, ale->params.major_ver_mask) << 8) | in cpsw_ale_create()
1396 dev_info(ale->params.dev, "initialized cpsw ale version %d.%d\n", in cpsw_ale_create()
1397 ALE_VERSION_MAJOR(rev, ale->params.major_ver_mask), in cpsw_ale_create()
1400 if (ale->features & CPSW_ALE_F_STATUS_REG && in cpsw_ale_create()
1401 !ale->params.ale_entries) { in cpsw_ale_create()
1403 readl_relaxed(ale->params.ale_regs + ALE_STATUS) & in cpsw_ale_create()
1416 ale->params.ale_entries = ale_entries; in cpsw_ale_create()
1418 dev_info(ale->params.dev, in cpsw_ale_create()
1419 "ALE Table size %ld\n", ale->params.ale_entries); in cpsw_ale_create()
1422 ale->port_mask_bits = ale->params.ale_ports; in cpsw_ale_create()
1423 ale->port_num_bits = order_base_2(ale->params.ale_ports); in cpsw_ale_create()
1424 ale->vlan_field_bits = ale->params.ale_ports; in cpsw_ale_create()
1429 if (ale->params.nu_switch_ale) { in cpsw_ale_create()
1435 ale->params.ale_ports; in cpsw_ale_create()
1439 ale->params.ale_ports; in cpsw_ale_create()
1444 ale->params.ale_ports; in cpsw_ale_create()
1449 ale->params.ale_ports; in cpsw_ale_create()
1455 cpsw_ale_control_set(ale, 0, ALE_CLEAR, 1); in cpsw_ale_create()
1456 return ale; in cpsw_ale_create()
1459 void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data) in cpsw_ale_dump() argument
1463 for (i = 0; i < ale->params.ale_entries; i++) { in cpsw_ale_dump()
1464 cpsw_ale_read(ale, i, data); in cpsw_ale_dump()
1469 void cpsw_ale_restore(struct cpsw_ale *ale, u32 *data) in cpsw_ale_restore() argument
1473 for (i = 0; i < ale->params.ale_entries; i++) { in cpsw_ale_restore()
1474 cpsw_ale_write(ale, i, data); in cpsw_ale_restore()
1479 u32 cpsw_ale_get_num_entries(struct cpsw_ale *ale) in cpsw_ale_get_num_entries() argument
1481 return ale ? ale->params.ale_entries : 0; in cpsw_ale_get_num_entries()