diff mbox series

[net,3/6] ionic: add check for NULL t/rxqcqs in reconfig

Message ID 20230202013002.34358-4-shannon.nelson@amd.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series ionic: code maintenance | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 4 maintainers not CCed: mohamed@pensando.io edumazet@google.com pabeni@redhat.com brett.creeley@amd.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: line length of 81 exceeds 80 columns WARNING: line length of 86 exceeds 80 columns WARNING: line length of 91 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Nelson, Shannon Feb. 2, 2023, 1:29 a.m. UTC
Make sure there are qcqs to clean before trying to swap resources
or clean their interrupt assignments.

Fixes: 101b40a0171f ("ionic: change queue count with no reset")
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
---
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 27 ++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

Comments

Leon Romanovsky Feb. 2, 2023, 8:44 a.m. UTC | #1
On Wed, Feb 01, 2023 at 05:29:59PM -0800, Shannon Nelson wrote:
> Make sure there are qcqs to clean before trying to swap resources
> or clean their interrupt assignments.
> 
> Fixes: 101b40a0171f ("ionic: change queue count with no reset")
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
> ---
>  .../net/ethernet/pensando/ionic/ionic_lif.c   | 27 ++++++++++++++++---
>  1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 8499165b1563..c08d0762212c 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -2741,6 +2741,14 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
>  			sg_desc_sz = sizeof(struct ionic_txq_sg_desc);
>  
>  		for (i = 0; i < qparam->nxqs; i++) {
> +			/* If missing, short placeholder qcq needed for swap */
> +			if (!lif->txqcqs[i]) {
> +				flags = IONIC_QCQ_F_TX_STATS | IONIC_QCQ_F_SG;
> +				err = ionic_qcq_alloc(lif, IONIC_QTYPE_TXQ, i, "tx", flags,
> +						      4, desc_sz, comp_sz, sg_desc_sz,
> +						      lif->kern_pid, &lif->txqcqs[i]);

You are not checking return value, so you don't really need to store
returned value in err variable.

Thanks
Jakub Kicinski Feb. 2, 2023, 6:05 p.m. UTC | #2
On Wed, 1 Feb 2023 17:29:59 -0800 Shannon Nelson wrote:
> Make sure there are qcqs to clean before trying to swap resources
> or clean their interrupt assignments.

... Otherwise $what-may-happen

Bug fixes should come with an explanation of what the user-visible
misbehavior is
Nelson, Shannon Feb. 2, 2023, 8:06 p.m. UTC | #3
On 2/2/23 10:05 AM, Jakub Kicinski wrote:
> On Wed, 1 Feb 2023 17:29:59 -0800 Shannon Nelson wrote:
>> Make sure there are qcqs to clean before trying to swap resources
>> or clean their interrupt assignments.
> 
> ... Otherwise $what-may-happen
> 
> Bug fixes should come with an explanation of what the user-visible
> misbehavior is

I can add some text here and post a v2.

Would you prefer I repost some of these as net-next rather than net as 
Leon was suggesting, or keep this patchset together for v2?  I have a 
couple other larger net-next patches getting ready as well...

sln
Jakub Kicinski Feb. 2, 2023, 8:46 p.m. UTC | #4
On Thu, 2 Feb 2023 12:06:52 -0800 Shannon Nelson wrote:
> On 2/2/23 10:05 AM, Jakub Kicinski wrote:
> > On Wed, 1 Feb 2023 17:29:59 -0800 Shannon Nelson wrote:  
> >> Make sure there are qcqs to clean before trying to swap resources
> >> or clean their interrupt assignments.  
> > 
> > ... Otherwise $what-may-happen
> > 
> > Bug fixes should come with an explanation of what the user-visible
> > misbehavior is  
> 
> I can add some text here and post a v2.
> 
> Would you prefer I repost some of these as net-next rather than net as 
> Leon was suggesting, or keep this patchset together for v2?  I have a 
> couple other larger net-next patches getting ready as well...

I'm not sure what the user impact of the fixes is, but at a glance
splitting this into separate series makes most sense. We merge net 
into net-next every Thu, so if there is a dependency the wait should
not be too long.
Nelson, Shannon Feb. 2, 2023, 8:55 p.m. UTC | #5
On 2/2/23 12:46 PM, Jakub Kicinski wrote:
> On Thu, 2 Feb 2023 12:06:52 -0800 Shannon Nelson wrote:
>> On 2/2/23 10:05 AM, Jakub Kicinski wrote:
>>> On Wed, 1 Feb 2023 17:29:59 -0800 Shannon Nelson wrote:
>>>> Make sure there are qcqs to clean before trying to swap resources
>>>> or clean their interrupt assignments.
>>>
>>> ... Otherwise $what-may-happen
>>>
>>> Bug fixes should come with an explanation of what the user-visible
>>> misbehavior is
>>
>> I can add some text here and post a v2.
>>
>> Would you prefer I repost some of these as net-next rather than net as
>> Leon was suggesting, or keep this patchset together for v2?  I have a
>> couple other larger net-next patches getting ready as well...
> 
> I'm not sure what the user impact of the fixes is, but at a glance
> splitting this into separate series makes most sense. We merge net
> into net-next every Thu, so if there is a dependency the wait should
> not be too long.

Thanks.  I'll resubmit 3 of these for net shortly, and pull the others 
into the net-next list and send after I rebase tonight or tomorrow.

sln
diff mbox series

Patch

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 8499165b1563..c08d0762212c 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -2741,6 +2741,14 @@  int ionic_reconfigure_queues(struct ionic_lif *lif,
 			sg_desc_sz = sizeof(struct ionic_txq_sg_desc);
 
 		for (i = 0; i < qparam->nxqs; i++) {
+			/* If missing, short placeholder qcq needed for swap */
+			if (!lif->txqcqs[i]) {
+				flags = IONIC_QCQ_F_TX_STATS | IONIC_QCQ_F_SG;
+				err = ionic_qcq_alloc(lif, IONIC_QTYPE_TXQ, i, "tx", flags,
+						      4, desc_sz, comp_sz, sg_desc_sz,
+						      lif->kern_pid, &lif->txqcqs[i]);
+			}
+
 			flags = lif->txqcqs[i]->flags & ~IONIC_QCQ_F_INTR;
 			err = ionic_qcq_alloc(lif, IONIC_QTYPE_TXQ, i, "tx", flags,
 					      num_desc, desc_sz, comp_sz, sg_desc_sz,
@@ -2760,6 +2768,14 @@  int ionic_reconfigure_queues(struct ionic_lif *lif,
 			comp_sz *= 2;
 
 		for (i = 0; i < qparam->nxqs; i++) {
+			/* If missing, short placeholder qcq needed for swap */
+			if (!lif->rxqcqs[i]) {
+				flags = IONIC_QCQ_F_RX_STATS | IONIC_QCQ_F_SG;
+				err = ionic_qcq_alloc(lif, IONIC_QTYPE_RXQ, i, "rx", flags,
+						      4, desc_sz, comp_sz, sg_desc_sz,
+						      lif->kern_pid, &lif->rxqcqs[i]);
+			}
+
 			flags = lif->rxqcqs[i]->flags & ~IONIC_QCQ_F_INTR;
 			err = ionic_qcq_alloc(lif, IONIC_QTYPE_RXQ, i, "rx", flags,
 					      num_desc, desc_sz, comp_sz, sg_desc_sz,
@@ -2809,10 +2825,15 @@  int ionic_reconfigure_queues(struct ionic_lif *lif,
 			lif->tx_coalesce_hw = lif->rx_coalesce_hw;
 		}
 
-		/* clear existing interrupt assignments */
+		/* Clear existing interrupt assignments.  We check for NULL here
+		 * because we're checking the whole array for potential qcqs, not
+		 * just those qcqs that have just been set up.
+		 */
 		for (i = 0; i < lif->ionic->ntxqs_per_lif; i++) {
-			ionic_qcq_intr_free(lif, lif->txqcqs[i]);
-			ionic_qcq_intr_free(lif, lif->rxqcqs[i]);
+			if (lif->txqcqs[i])
+				ionic_qcq_intr_free(lif, lif->txqcqs[i]);
+			if (lif->rxqcqs[i])
+				ionic_qcq_intr_free(lif, lif->rxqcqs[i]);
 		}
 
 		/* re-assign the interrupts */