Message ID | 20241014105912.3207374-28-ryan.roberts@arm.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Boot-time page size selection for arm64 | expand |
+ Przemek Kitszel, Tony Nguyen This was a rather tricky series to get the recipients correct for and my script did not realize that "supporter" was a pseudonym for "maintainer" so you were missed off the original post. Appologies! More context in cover letter: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ On 14/10/2024 11:58, Ryan Roberts wrote: > To prepare for supporting boot-time page size selection, refactor code > to remove assumptions about PAGE_SIZE being compile-time constant. Code > intended to be equivalent when compile-time page size is active. > > Convert CPP conditionals to C conditionals. The compiler will dead code > strip when doing a compile-time page size build, for the same end > effect. But this will also work with boot-time page size builds. > > Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> > --- > > ***NOTE*** > Any confused maintainers may want to read the cover note here for context: > https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ > > drivers/net/ethernet/intel/igbvf/netdev.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c > index 925d7286a8ee4..2e11d999168de 100644 > --- a/drivers/net/ethernet/intel/igbvf/netdev.c > +++ b/drivers/net/ethernet/intel/igbvf/netdev.c > @@ -2419,12 +2419,10 @@ static int igbvf_change_mtu(struct net_device *netdev, int new_mtu) > adapter->rx_buffer_len = 1024; > else if (max_frame <= 2048) > adapter->rx_buffer_len = 2048; > - else > -#if (PAGE_SIZE / 2) > 16384 > + else if ((PAGE_SIZE / 2) > 16384) > adapter->rx_buffer_len = 16384; > -#else > + else > adapter->rx_buffer_len = PAGE_SIZE / 2; > -#endif > > /* adjust allocation if LPE protects us, and we aren't using SBP */ > if ((max_frame == ETH_FRAME_LEN + ETH_FCS_LEN) ||
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 925d7286a8ee4..2e11d999168de 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c @@ -2419,12 +2419,10 @@ static int igbvf_change_mtu(struct net_device *netdev, int new_mtu) adapter->rx_buffer_len = 1024; else if (max_frame <= 2048) adapter->rx_buffer_len = 2048; - else -#if (PAGE_SIZE / 2) > 16384 + else if ((PAGE_SIZE / 2) > 16384) adapter->rx_buffer_len = 16384; -#else + else adapter->rx_buffer_len = PAGE_SIZE / 2; -#endif /* adjust allocation if LPE protects us, and we aren't using SBP */ if ((max_frame == ETH_FRAME_LEN + ETH_FCS_LEN) ||
To prepare for supporting boot-time page size selection, refactor code to remove assumptions about PAGE_SIZE being compile-time constant. Code intended to be equivalent when compile-time page size is active. Convert CPP conditionals to C conditionals. The compiler will dead code strip when doing a compile-time page size build, for the same end effect. But this will also work with boot-time page size builds. Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> --- ***NOTE*** Any confused maintainers may want to read the cover note here for context: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ drivers/net/ethernet/intel/igbvf/netdev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)