target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
static int rtl83xx_find_l2_cam_entry(struct rtl838x_switch_priv *priv, u64 seed,
				     bool must_exist, struct rtl838x_l2_entry *e)
{
	int i, idx = -1;
	u64 entry;

	for (i = 0; i < 64; i++) {
		entry = priv->r->read_cam(i, e);
		if (!must_exist && !e->valid) {
			if (idx < 0) /* First empty entry? */
				idx = i;
			break;
		} else if ((entry & 0x0fffffffffffffffULL) == seed) {
			pr_debug("Found entry in CAM\n");
			idx = i;
			break;
		}
	}
	return idx;
}
/*
 * Uses the seed to identify an entry in the CAM by looping over all its entries
 * Returns the filled in rtl838x_l2_entry and the index in the CAM when an entry was found
 * when an empty slot was found the index of the slot is returned
 * when no slots are available returns -1
 */
Uses the seed to identify an entry in the CAM by looping over all its entries
Returns the filled in rtl838x_l2_entry and the index in the CAM when an entry was found
when an empty slot was found the index of the slot is returned
when no slots are available returns -1
Uses the seed to identify an entry in the CAM by looping over all its entries Returns the filled in rtl838x_l2_entry and the index in the CAM when an entry was found when an empty slot was found the index of the slot is returned when no slots are available returns - 1
static int rtl83xx_find_l2_cam_entry(struct rtl838x_switch_priv *priv, u64 seed,
				     bool must_exist, struct rtl838x_l2_entry *e)
{
	int i, idx = -1;
	u64 entry;
	for (i = 0; i < 64; i++) {
		entry = priv->r->read_cam(i, e);
		if (!must_exist && !e->valid) {
			if (idx < 0) 
				idx = i;
			break;
		} else if ((entry & 0x0fffffffffffffffULL) == seed) {
			pr_debug("Found entry in CAM\n");
			idx = i;
			break;
		}
	}
	return idx;
}
static int rtl83xx_find_l2_cam_entry ( struct rtl838x_switch_priv * priv , u64 seed , bool must_exist , struct rtl838x_l2_entry * e ) { int i , idx = -1 ; u64 entry ; for ( i = 0 ; i < 64 ; i ++ ) { entry = priv -> r -> read_cam ( i , e ) ; if ( ! must_exist && ! e -> valid ) { if ( idx < 0 ) idx = i ; break ; } else if ( ( entry & 0x0fffffffffffffffULL ) == seed ) { pr_debug ( " \n " ) ; idx = i ; break ; } } return idx ; }
Uses the seed to identify an entry in the CAM by looping over all its entries
 Returns the filled in rtl838x_l2_entry and the index in the CAM when an entry was found
 when an empty slot was found the index of the slot is returned
 when no slots are available returns -1
Uses the seed to identify an entry in the CAM by looping over all its entries Returns the filled in rtl838x_l2_entry and the index in the CAM when an entry was found when an empty slot was found the index of the slot is returned when no slots are available returns - 1
/* First empty entry? */