Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: Ira Weiny <ira.weiny@intel.com>,
	"Fabio M . De Francesco" <fmdefrancesco@gmail.com>,
	intel-wired-lan@lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH net-next] ixgbe: Remove unnecessary use of kmap()
Date: Wed, 28 Sep 2022 15:22:54 -0700	[thread overview]
Message-ID: <2c389697-0c85-26b5-d006-935aa5c1e0ea@intel.com> (raw)
In-Reply-To: <CAKgT0UdptMUmZhTg04BgiMaAPnfHCuKJYRPSG9Zr6oAykFZwMw@mail.gmail.com>

On 9/28/2022 1:40 PM, Alexander Duyck wrote:
> On Wed, Sep 28, 2022 at 12:26 PM Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com> wrote:
>>
>> Pages for Rx are allocated in ixgbe_alloc_mapped_page() using
>> dev_alloc_pages(), which does the allocation using flags GFP_ATOMIC |
>> __GFP_NOWARN. Pages allocated thus can't come from highmem, so remove
>> calls to kmap() and kunmap().
>>
>> While here, also remove the local variable "match", and just return
>> true/false.
>>
>> I wasn't able to get a hold of a system with an ixgbe NIC to test this
>> change. This is a pretty trivial change and I don't expect anything to
>> break, but a "Tested-by" from someone who has the hardware would be nice.
>>
>> Cc: Alexander Duyck <alexander.duyck@gmail.com>
>> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
>> Cc: Ira Weiny <ira.weiny@intel.com>
>> Cc: Fabio M. De Francesco <fmdefrancesco@gmail.com>
>> Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
>> Suggested-by: Ira Weiny <ira.weiny@intel.com>
>> Suggested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
>> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
>> ---
>>   drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 9 +++------
>>   1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
>> index 04f453e..90c0e0b 100644
>> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
>> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
>> @@ -1960,20 +1960,17 @@ static bool ixgbe_check_lbtest_frame(struct ixgbe_rx_buffer *rx_buffer,
>>                                       unsigned int frame_size)
>>   {
>>          unsigned char *data;
>> -       bool match = true;
>>
>>          frame_size >>= 1;
>>
>> -       data = kmap(rx_buffer->page) + rx_buffer->page_offset;
>> +       data = page_address(rx_buffer->page) + rx_buffer->page_offset;

Okay, Fabio has already made this exact change and it's currently in 
Tony's kernel tree (next-queue:dev-queue). I missed it because I was 
barking up the wrong (kernel) tree. My apologies for the thrash.

>>
>>          if (data[3] != 0xFF ||
>>              data[frame_size + 10] != 0xBE ||
>>              data[frame_size + 12] != 0xAF)
>> -               match = false;
>> -
>> -       kunmap(rx_buffer->page);
>> +               return false;
>>
>> -       return match;
>> +       return true;
>>   }
>>
>>   static u16 ixgbe_clean_test_rings(struct ixgbe_ring *rx_ring,
> 
> Rather than bothering with the return true/false why not just return
> the compare value? So it would be:
>          return data[3] == 0xFF && data[frame_size + 10] == 0xBE &&
> data[frame_size + 12] == 0xAF;

Sure, I can do a standalone patch for this.

Ani


_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

      reply	other threads:[~2022-09-28 22:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 19:27 [Intel-wired-lan] [PATCH net-next] ixgbe: Remove unnecessary use of kmap() Anirudh Venkataramanan
2022-09-28 20:40 ` Alexander Duyck
2022-09-28 22:22   ` Anirudh Venkataramanan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c389697-0c85-26b5-d006-935aa5c1e0ea@intel.com \
    --to=anirudh.venkataramanan@intel.com \
    --cc=alexander.duyck@gmail.com \
    --cc=fmdefrancesco@gmail.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=ira.weiny@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox