Re: [PATCH net-next v2 11/12] net: ethernet: aquantia: Fixed memory allocation if AQ_CFG_RX_FRAME_MAX > 1 page.

2017-02-18 Thread Pavel Belous



On 02/18/2017 02:50 PM, Lino Sanfilippo wrote:

Hi,

On 17.02.2017 22:07, Pavel Belous wrote:

From: Pavel Belous 

We should allocate the number of pages based on the config parameter
AQ_CFG_RX_FRAME_MAX.

Signed-off-by: Pavel Belous 



do {
if (spin_trylock(&ring->header.lock)) {
-   frags = aq_nic_map_skb(self, skb, &buffers[0]);
+   frags = aq_nic_map_skb(self, skb, buffers);

-   aq_ring_tx_append_buffs(ring, &buffers[0], frags);
+   aq_ring_tx_append_buffs(ring, buffers, frags);



This change has nothing to do with what the commit message claims that the
patch is about. Please dont mix fixes and totally unrelated cleanups in one
patch.

Regards,
Lino



Sorry, its just small fix for readability.
I will remove it or put in separate patch in v3.

Regards,
Pavel


Re: [PATCH net-next v2 11/12] net: ethernet: aquantia: Fixed memory allocation if AQ_CFG_RX_FRAME_MAX > 1 page.

2017-02-18 Thread Pavel Belous

On 02/18/2017 01:43 AM, Andrew Lunn wrote:

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c 
b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
index 4c40644..0877625 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
@@ -278,6 +278,8 @@ int aq_ring_rx_fill(struct aq_ring_s *self)
struct aq_ring_buff_s *buff = NULL;
int err = 0;
int i = 0;
+   unsigned int pages_order = fls(AQ_CFG_RX_FRAME_MAX / PAGE_SIZE +
+   (AQ_CFG_RX_FRAME_MAX % PAGE_SIZE ? 1 : 0)) - 1;


Reverse Christmas tree?

Andrew



Thank you.
I will fix it in v3.

Regards,
Pavel


Re: [PATCH net-next v2 11/12] net: ethernet: aquantia: Fixed memory allocation if AQ_CFG_RX_FRAME_MAX > 1 page.

2017-02-18 Thread Lino Sanfilippo
Hi,

On 17.02.2017 22:07, Pavel Belous wrote:
> From: Pavel Belous 
> 
> We should allocate the number of pages based on the config parameter
> AQ_CFG_RX_FRAME_MAX.
> 
> Signed-off-by: Pavel Belous 

>   do {
>   if (spin_trylock(&ring->header.lock)) {
> - frags = aq_nic_map_skb(self, skb, &buffers[0]);
> + frags = aq_nic_map_skb(self, skb, buffers);
>  
> - aq_ring_tx_append_buffs(ring, &buffers[0], frags);
> + aq_ring_tx_append_buffs(ring, buffers, frags);
>  

This change has nothing to do with what the commit message claims that the
patch is about. Please dont mix fixes and totally unrelated cleanups in one
patch.

Regards,
Lino



Re: [PATCH net-next v2 11/12] net: ethernet: aquantia: Fixed memory allocation if AQ_CFG_RX_FRAME_MAX > 1 page.

2017-02-17 Thread Andrew Lunn
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c 
> b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> index 4c40644..0877625 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> @@ -278,6 +278,8 @@ int aq_ring_rx_fill(struct aq_ring_s *self)
>   struct aq_ring_buff_s *buff = NULL;
>   int err = 0;
>   int i = 0;
> + unsigned int pages_order = fls(AQ_CFG_RX_FRAME_MAX / PAGE_SIZE +
> + (AQ_CFG_RX_FRAME_MAX % PAGE_SIZE ? 1 : 0)) - 1;

Reverse Christmas tree?

Andrew