diff mbox series

[2/2] net/tap: fix tap interrupt vector array size

Message ID 1619090834-14643-3-git-send-email-humin29@huawei.com (mailing list archive)
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series bugfix for tap device | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot success github build: passed
ci/checkpatch success coding style OK

Commit Message

Min Hu (Connor) April 22, 2021, 11:27 a.m. UTC
From: Chengchang Tang <tangchengchang@huawei.com>

The size of the current interrupt vector array is fixed to an integer.

This patch will create an interrupt vector array based on the number
of rxqs.

Fixes: 4870a8cdd968 ("net/tap: support Rx interrupt")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/tap/tap_intr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Hemminger April 22, 2021, 3:20 p.m. UTC | #1
On Thu, 22 Apr 2021 19:27:14 +0800
"Min Hu (Connor)" <humin29@huawei.com> wrote:

> diff --git a/drivers/net/tap/tap_intr.c b/drivers/net/tap/tap_intr.c
> index 5cf4f17..1cacc15 100644
> --- a/drivers/net/tap/tap_intr.c
> +++ b/drivers/net/tap/tap_intr.c
> @@ -59,7 +59,7 @@ tap_rx_intr_vec_install(struct rte_eth_dev *dev)
>  
>  	if (!dev->data->dev_conf.intr_conf.rxq)
>  		return 0;
> -	intr_handle->intr_vec = malloc(sizeof(intr_handle->intr_vec[rxqs_n]));
> +	intr_handle->intr_vec = malloc(sizeof(int) * rxqs_n);

Maybe calloc() here would be good idea?
Min Hu (Connor) April 23, 2021, 9:34 a.m. UTC | #2
在 2021/4/22 23:20, Stephen Hemminger 写道:
> On Thu, 22 Apr 2021 19:27:14 +0800
> "Min Hu (Connor)" <humin29@huawei.com> wrote:
> 
>> diff --git a/drivers/net/tap/tap_intr.c b/drivers/net/tap/tap_intr.c
>> index 5cf4f17..1cacc15 100644
>> --- a/drivers/net/tap/tap_intr.c
>> +++ b/drivers/net/tap/tap_intr.c
>> @@ -59,7 +59,7 @@ tap_rx_intr_vec_install(struct rte_eth_dev *dev)
>>   
>>   	if (!dev->data->dev_conf.intr_conf.rxq)
>>   		return 0;
>> -	intr_handle->intr_vec = malloc(sizeof(intr_handle->intr_vec[rxqs_n]));
>> +	intr_handle->intr_vec = malloc(sizeof(int) * rxqs_n);
> 
> Maybe calloc() here would be good idea?
> 
Hi, Stephen,
	No need to use calloc, because members of
  'intr_handle->intr_vec' array will be set new
value.
>
Ferruh Yigit April 26, 2021, 3:31 p.m. UTC | #3
On 4/22/2021 12:27 PM, Min Hu (Connor) wrote:
> From: Chengchang Tang <tangchengchang@huawei.com>
> 
> The size of the current interrupt vector array is fixed to an integer.
> 
> This patch will create an interrupt vector array based on the number
> of rxqs.
> 
> Fixes: 4870a8cdd968 ("net/tap: support Rx interrupt")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/main, thanks.
diff mbox series

Patch

diff --git a/drivers/net/tap/tap_intr.c b/drivers/net/tap/tap_intr.c
index 5cf4f17..1cacc15 100644
--- a/drivers/net/tap/tap_intr.c
+++ b/drivers/net/tap/tap_intr.c
@@ -59,7 +59,7 @@  tap_rx_intr_vec_install(struct rte_eth_dev *dev)
 
 	if (!dev->data->dev_conf.intr_conf.rxq)
 		return 0;
-	intr_handle->intr_vec = malloc(sizeof(intr_handle->intr_vec[rxqs_n]));
+	intr_handle->intr_vec = malloc(sizeof(int) * rxqs_n);
 	if (intr_handle->intr_vec == NULL) {
 		rte_errno = ENOMEM;
 		TAP_LOG(ERR,