[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <638b1c74-3718-441c-bfee-7d00af833e36@gmail.com>
Date: Mon, 4 Nov 2024 18:20:35 -0800
From: Mohsin Bashir <mohsin.bashr@...il.com>
To: Joe Damato <jdamato@...tly.com>
Cc: netdev@...r.kernel.org, alexanderduyck@...com, kuba@...nel.org,
andrew@...n.ch, andrew+netdev@...n.ch, davem@...emloft.net,
edumazet@...gle.com, pabeni@...hat.com, kernel-team@...a.com,
sanmanpradhan@...a.com, sdf@...ichev.me, vadim.fedorenko@...ux.dev,
horms@...nel.org
Subject: Re: [PATCH net-next v5] eth: fbnic: Add support to write TCE TCAM
entries
Hi Joe,
> Does the macro need to be on its own line? Maybe it does due to line
> length, not sure.
>
Yes, this is because of the line length.
>> + if (!tcam_idx) {
>> + dev_err(fbd->dev, "TCE TCAM overflow\n");
>
> In the error case does fbd->tce_tcam_last need to be set ?
>
>> + return;
>> + }
>> +
Basically, we have 4 unicast and 1 multicast/broadcast entry for BMC
(see fbnic_bmc_rpc_init() in fbnic_rpc.c for reference), making overflow
really unlikely. If an overflow does occur, we currently report it for
debugging purposes. A more comprehensive solution to handle when it does
occur, will be added later.
>> + while (tcam_idx)
>> + fbnic_clear_tce_tcam_entry(fbd, --tcam_idx);
>> +
>> + fbd->tce_tcam_last = tcam_idx;
>
> Wouldn't this end up setting tce_tcam_last to zero every time or am
> I missing something?
>
>> +}
Yes, that is true. The role of tce_tcam_last is to track the direction
of the next pass. Since FBNIC_TCE_TCAM_NUM_ENTRIES is 8, while the BMC
entries are less than 8, we clear the remaining entries (which would
have already been written by this point). At this point, the value of
tcam_idx should be 0, guiding the direction of next pass to be in
forward direction.
>> + if (tcam_idx == FBNIC_TCE_TCAM_NUM_ENTRIES) {
>> + dev_err(fbd->dev, "TCE TCAM overflow\n");
>
> As above, in the error case does fbd->tce_tcam_last need to be set ?
>
>> + return;
>> + }
As discussed above.
>> + while (tcam_idx < FBNIC_TCE_TCAM_NUM_ENTRIES)
>> + fbnic_clear_tce_tcam_entry(fbd, tcam_idx++);
>> +
>> + fbd->tce_tcam_last = tcam_idx;
>
> As above, wouldn't this always set tce_tcam_last to
> FBNIC_TCE_TCAM_NUM_ENTRIES every time?
Yes, similar to above, this will ensure next pass to be in reverse
direction.
Hope this clarifies things.
Powered by blists - more mailing lists