bnx2: Fix unused data compilation warning
PATCH 1/1 bnx2: Fix unused data compilation warning
In some configuration, compilation raises warnings related to unused data. Indeed, depending on configuration, those data can be unused.
Mark those data as __maybe_unused to avoid compilation warnings.
--- drivers/net/ethernet/broadcom/bnx2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2.c +2 -2
@@ -2887,7 +2887,7 @@ bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) last = tx_buf->nr_frags;for (i =0 ; i < last; i++) { -struct bnx2_sw_tx_bd *tx_buf; +struct bnx2_sw_tx_bd *tx_buf__maybe_unused ; sw_cons =BNX2_NEXT_TX_BD (sw_cons);
@@ -2994,7 +2994,7 @@ static inline void bnx2_reuse_rx_data(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, u8 *data, u16 cons, u16 prod) { - struct bnx2_sw_bd *cons_rx_buf, *prod_rx_buf; + struct bnx2_sw_bd *cons_rx_buf __maybe_unused, *prod_rx_buf;struct bnx2_rx_bd *cons_bd, *prod_bd; cons_rx_buf = &rxr->rx_buf_ring[cons];
Signature · 1 line
2.47.2
Jakub Kicinski
maintainerQuoted 4 lines · On Fri, 28 Feb 2025 12:05:37 +0200 Andy Shevchenko wrote:
In some configuration, compilation raises warnings related to unused data. Indeed, depending on configuration, those data can be unused.
Mark those data as
__maybe_unusedto avoid compilation warnings.
Will making dma_unmap_addr access the first argument instead of pre-processing down to nothing not work?
Quoted 8 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 28 Feb 2025 12:05:37 +0200 Andy Shevchenko wrote:
In some configuration, compilation raises warnings related to unused data. Indeed, depending on configuration, those data can be unused.
Mark those data as
__maybe_unusedto avoid compilation warnings.Will making
dma_unmap_addraccess the first argument instead of pre-processing down to nothing not work?
I looked at the implementation of those macros and I have no clue how to do that in a least intrusive way. Otherwise it sounds to me quite far from the scope of the small compilation error fix that I presented here.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Paolo Abeni
maintainerQuoted 7 lines · Andy Shevchenko
Quoted 6 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 28 Feb 2025 12:05:37 +0200 Andy Shevchenko wrote:
In some configuration, compilation raises warnings related to unused data. Indeed, depending on configuration, those data can be unused.
Mark those data as
__maybe_unusedto avoid compilation warnings.
Quoted 7 lines
Quoted 2 lines
Will making
dma_unmap_addraccess the first argument instead of pre-processing down to nothing not work?I looked at the implementation of those macros and I have no clue how to do that in a least intrusive way. Otherwise it sounds to me quite far from the scope of the small compilation error fix that I presented here.
I *think* Jakub is suggesting something alike:
---
include/linux/dma-mapping.h +1 -1
@@ -629,7 +629,7 @@ static inline int dma_mmap_wc(struct device *dev,#else #define DEFINE_DMA_UNMAP_ADDR (ADDR_NAME )#define DEFINE_DMA_UNMAP_LEN (LEN_NAME ) -#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) (((PTR)->ADDR_NAME), 0)#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0)#define dma_unmap_len (PTR ,LEN_NAME ) (0)#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0)
---
Would that work?
Thanks,
Paolo
+ Marek/Christoph (for the clarification/commenting on the below)
Quoted 11 lines · Paolo Abeni
Quoted 10 lines · Andy Shevchenko
Quoted 8 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 28 Feb 2025 12:05:37 +0200 Andy Shevchenko wrote:
In some configuration, compilation raises warnings related to unused data. Indeed, depending on configuration, those data can be unused.
Mark those data as
__maybe_unusedto avoid compilation warnings.Will making
dma_unmap_addraccess the first argument instead of pre-processing down to nothing not work?
Quoted 6 lines
Quoted 4 lines
I looked at the implementation of those macros and I have no clue how to do that in a least intrusive way. Otherwise it sounds to me quite far from the scope of the small compilation error fix that I presented here.
I *think* Jakub is suggesting something alike:
I see. Perhpas we need Marek's/Christoph's opinion on this...
Quoted 16 lines
---
include/linux/dma-mapping.h +1
-2@@ -629,7 +629,7 @@ static inline int dma_mmap_wc(struct device *dev,#else #define DEFINE_DMA_UNMAP_ADDR (ADDR_NAME )#define DEFINE_DMA_UNMAP_LEN (LEN_NAME ) -#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) (((PTR)->ADDR_NAME), 0)#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0)#define dma_unmap_len (PTR ,LEN_NAME ) (0)#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0) ---
Quoted 1 line
Would that work?
I do not know. Not my area of expertise.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 39 lines · Andy Shevchenko
+ Marek/Christoph (for the clarification/commenting on the below)
Quoted 11 lines · Paolo Abeni
Quoted 10 lines · Andy Shevchenko
Quoted 8 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 28 Feb 2025 12:05:37 +0200 Andy Shevchenko wrote:
In some configuration, compilation raises warnings related to unused data. Indeed, depending on configuration, those data can be unused.
Mark those data as
__maybe_unusedto avoid compilation warnings.Will making
dma_unmap_addraccess the first argument instead of pre-processing down to nothing not work?Quoted 6 lines
Quoted 4 lines
I looked at the implementation of those macros and I have no clue how to do that in a least intrusive way. Otherwise it sounds to me quite far from the scope of the small compilation error fix that I presented here.
I *think* Jakub is suggesting something alike:
I see. Perhpas we need Marek's/Christoph's opinion on this...
Quoted 16 lines
---
include/linux/dma-mapping.h +1
-2@@ -629,7 +629,7 @@ static inline int dma_mmap_wc(struct device *dev,#else #define DEFINE_DMA_UNMAP_ADDR (ADDR_NAME )#define DEFINE_DMA_UNMAP_LEN (LEN_NAME ) -#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) (((PTR)->ADDR_NAME), 0)#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0)#define dma_unmap_len (PTR ,LEN_NAME ) (0)#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0) ---
Quoted 1 line
Quoted 1 line
Would that work?
Actually it won't work because the variable is under the same ifdeffery. What will work is to spreading the ifdeffery to the users, but it doesn't any better than __maybe_unsused, which is compact hack (yes, I admit that it is not the nicest solution, but it's spread enough in the kernel).
Quoted 1 line
I do not know. Not my area of expertise.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jakub Kicinski
maintainerQuoted 15 lines · On Tue, 4 Mar 2025 15:41:19 +0200 Andy Shevchenko wrote:
Quoted 15 lines
Quoted 15 lines
include/linux/dma-mapping.h +1
-2@@ -629,7 +629,7 @@ static inline int dma_mmap_wc(struct device *dev,#else #define DEFINE_DMA_UNMAP_ADDR (ADDR_NAME )#define DEFINE_DMA_UNMAP_LEN (LEN_NAME ) -#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) (((PTR)->ADDR_NAME), 0)#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0)#define dma_unmap_len (PTR ,LEN_NAME ) (0)#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0) ---
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Would that work?
Actually it won't work because the variable is under the same ifdeffery. What will work is to spreading the ifdeffery to the users, but it doesn't any better than
__maybe_unsused, which is compact hack (yes, I admit that it is not the nicest solution, but it's spread enough in the kernel).
I meant something more like (untested):
include/linux/dma-mapping.h +4 -4
@@ -629,10 +629,10 @@ static inline int dma_mmap_wc(struct device *dev,#else #define DEFINE_DMA_UNMAP_ADDR (ADDR_NAME )#define DEFINE_DMA_UNMAP_LEN (LEN_NAME ) -#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) -#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0) -#define dma_unmap_len (PTR ,LEN_NAME ) (0) -#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0) +#define dma_unmap_len (PTR ,LEN_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0)#endif #endif /* _LINUX_DMA_MAPPING_H */
I just don't know how much code out there depends on PTR not existing if !CONFIG_NEED_DMA_MAP_STATE
Quoted 1 line · Jakub Kicinski
On Tue, 4 Mar 2025 15:41:19 +0200 Andy Shevchenko wrote:
...
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Would that work?
Actually it won't work because the variable is under the same ifdeffery. What will work is to spreading the ifdeffery to the users, but it doesn't any better than
__maybe_unsused, which is compact hack (yes, I admit that it is not the nicest solution, but it's spread enough in the kernel).I meant something more like (untested):
We are starving for the comment from the DMA mapping people.
Quoted 20 lines
include/linux/dma-mapping.h +4
-4@@ -629,10 +629,10 @@ static inline int dma_mmap_wc(struct device *dev,#else #define DEFINE_DMA_UNMAP_ADDR (ADDR_NAME )#define DEFINE_DMA_UNMAP_LEN (LEN_NAME ) -#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) -#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0) -#define dma_unmap_len (PTR ,LEN_NAME ) (0) -#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0) +#define dma_unmap_len (PTR ,LEN_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0)#endif #endif /* _LINUX_DMA_MAPPING_H */
Quoted 2 lines
I just don't know how much code out there depends on PTR not existing if !CONFIG_NEED_DMA_MAP_STATE
Brief checking shows that only drivers/net/ethernet/chelsio/* comes with ifdeffery, the rest most likely will fail in the same way (note, overwhelming majority of the users is under the network realm):
$ git grep -lw dma_unmap_[al][de].*
drivers/infiniband/hw/cxgb4/cq.c drivers/infiniband/hw/cxgb4/qp.c drivers/infiniband/hw/mthca/mthca_allocator.c drivers/infiniband/hw/mthca/mthca_eq.c drivers/net/ethernet/alacritech/slicoss.c drivers/net/ethernet/alteon/acenic.c drivers/net/ethernet/amazon/ena/ena_netdev.c drivers/net/ethernet/arc/emac_main.c drivers/net/ethernet/atheros/alx/main.c drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c drivers/net/ethernet/broadcom/bcmsysport.c drivers/net/ethernet/broadcom/bnx2.c drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c drivers/net/ethernet/broadcom/bnxt/bnxt.c drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c drivers/net/ethernet/broadcom/genet/bcmgenet.c drivers/net/ethernet/broadcom/tg3.c drivers/net/ethernet/brocade/bna/bnad.c drivers/net/ethernet/chelsio/cxgb/sge.c drivers/net/ethernet/chelsio/cxgb3/sge.c drivers/net/ethernet/emulex/benet/be_main.c drivers/net/ethernet/engleder/tsnep_main.c drivers/net/ethernet/google/gve/gve_tx.c drivers/net/ethernet/google/gve/gve_tx_dqo.c drivers/net/ethernet/intel/fm10k/fm10k_main.c drivers/net/ethernet/intel/fm10k/fm10k_netdev.c drivers/net/ethernet/intel/i40e/i40e_main.c drivers/net/ethernet/intel/i40e/i40e_txrx.c drivers/net/ethernet/intel/i40e/i40e_xsk.c drivers/net/ethernet/intel/iavf/iavf_txrx.c drivers/net/ethernet/intel/ice/ice_txrx.c drivers/net/ethernet/intel/ice/ice_txrx_lib.c drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c drivers/net/ethernet/intel/idpf/idpf_txrx.c drivers/net/ethernet/intel/igb/igb_ethtool.c drivers/net/ethernet/intel/igb/igb_main.c drivers/net/ethernet/intel/igc/igc_dump.c drivers/net/ethernet/intel/igc/igc_main.c drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c drivers/net/ethernet/intel/ixgbe/ixgbe_main.c drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c drivers/net/ethernet/marvell/skge.c drivers/net/ethernet/marvell/sky2.c drivers/net/ethernet/mediatek/mtk_eth_soc.c drivers/net/ethernet/mscc/ocelot_fdma.c drivers/net/ethernet/myricom/myri10ge/myri10ge.c drivers/net/ethernet/qlogic/qla3xxx.c drivers/net/ethernet/rocker/rocker_main.c drivers/net/ethernet/wangxun/libwx/wx_lib.c drivers/net/wireless/intel/iwlegacy/3945-mac.c drivers/net/wireless/intel/iwlegacy/3945.c drivers/net/wireless/intel/iwlegacy/4965-mac.c drivers/net/wireless/intel/iwlegacy/common.c drivers/net/wireless/marvell/mwl8k.c
include/net/libeth/tx.h
Signature · 2 lines
With Best Regards, Andy Shevchenko
Marek Szyprowski
maintainerHi Andy,
Quoted 11 lines · Andy Shevchenko
Quoted 1 line · Jakub Kicinski
On Tue, 4 Mar 2025 15:41:19 +0200 Andy Shevchenko wrote:
...
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Would that work?
Actually it won't work because the variable is under the same ifdeffery. What will work is to spreading the ifdeffery to the users, but it doesn't any better than
__maybe_unsused, which is compact hack (yes, I admit that it is not the nicest solution, but it's spread enough in the kernel).I meant something more like (untested):
We are starving for the comment from the DMA mapping people.
I'm really sorry for this delay. Just got back to the everyday stuff after spending a week in bed recovering from flu...
Quoted 18 lines
Quoted 18 lines
include/linux/dma-mapping.h +4
-4@@ -629,10 +629,10 @@ static inline int dma_mmap_wc(struct device *dev,#else #define DEFINE_DMA_UNMAP_ADDR (ADDR_NAME )#define DEFINE_DMA_UNMAP_LEN (LEN_NAME ) -#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) -#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0) -#define dma_unmap_len (PTR ,LEN_NAME ) (0) -#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0) +#define dma_unmap_len (PTR ,LEN_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0)#endif
Quoted 7 lines
Quoted 4 lines
include/linux/dma-mapping.h +0
-0#endif /* _LINUX_DMA_MAPPING_H */ I just don't know how much code out there depends on PTR not existing if !CONFIG_NEED_DMA_MAP_STATE
Brief checking shows that only
drivers/net/ethernet/chelsio/*comes with ifdeffery, the rest most likely will fail in the same way (note, overwhelming majority of the users is under the network realm):
Frankly speaking I wasn't aware of this API till now.
If got it right the above proposal should work fine. The addr/len names can be optimized out, but the pointer to the container should exist.
Quoted 60 lines
$ git grep -lw dma_unmap_[al][de].*
drivers/infiniband/hw/cxgb4/cq.cdrivers/infiniband/hw/cxgb4/qp.cdrivers/infiniband/hw/mthca/mthca_allocator.cdrivers/infiniband/hw/mthca/mthca_eq.cdrivers/net/ethernet/alacritech/slicoss.cdrivers/net/ethernet/alteon/acenic.cdrivers/net/ethernet/amazon/ena/ena_netdev.cdrivers/net/ethernet/arc/emac_main.cdrivers/net/ethernet/atheros/alx/main.cdrivers/net/ethernet/broadcom/asp2/bcmasp_intf.cdrivers/net/ethernet/broadcom/bcmsysport.cdrivers/net/ethernet/broadcom/bnx2.cdrivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.cdrivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.hdrivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.cdrivers/net/ethernet/broadcom/bnxt/bnxt.cdrivers/net/ethernet/broadcom/bnxt/bnxt_xdp.cdrivers/net/ethernet/broadcom/genet/bcmgenet.cdrivers/net/ethernet/broadcom/tg3.cdrivers/net/ethernet/brocade/bna/bnad.cdrivers/net/ethernet/chelsio/cxgb/sge.cdrivers/net/ethernet/chelsio/cxgb3/sge.cdrivers/net/ethernet/emulex/benet/be_main.cdrivers/net/ethernet/engleder/tsnep_main.cdrivers/net/ethernet/google/gve/gve_tx.cdrivers/net/ethernet/google/gve/gve_tx_dqo.cdrivers/net/ethernet/intel/fm10k/fm10k_main.cdrivers/net/ethernet/intel/fm10k/fm10k_netdev.cdrivers/net/ethernet/intel/i40e/i40e_main.cdrivers/net/ethernet/intel/i40e/i40e_txrx.cdrivers/net/ethernet/intel/i40e/i40e_xsk.cdrivers/net/ethernet/intel/iavf/iavf_txrx.cdrivers/net/ethernet/intel/ice/ice_txrx.cdrivers/net/ethernet/intel/ice/ice_txrx_lib.cdrivers/net/ethernet/intel/idpf/idpf_singleq_txrx.cdrivers/net/ethernet/intel/idpf/idpf_txrx.cdrivers/net/ethernet/intel/igb/igb_ethtool.cdrivers/net/ethernet/intel/igb/igb_main.cdrivers/net/ethernet/intel/igc/igc_dump.cdrivers/net/ethernet/intel/igc/igc_main.cdrivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.cdrivers/net/ethernet/intel/ixgbe/ixgbe_main.cdrivers/net/ethernet/intel/ixgbe/ixgbe_xsk.cdrivers/net/ethernet/intel/ixgbevf/ixgbevf_main.cdrivers/net/ethernet/marvell/skge.cdrivers/net/ethernet/marvell/sky2.cdrivers/net/ethernet/mediatek/mtk_eth_soc.cdrivers/net/ethernet/mscc/ocelot_fdma.cdrivers/net/ethernet/myricom/myri10ge/myri10ge.cdrivers/net/ethernet/qlogic/qla3xxx.cdrivers/net/ethernet/rocker/rocker_main.cdrivers/net/ethernet/wangxun/libwx/wx_lib.cdrivers/net/wireless/intel/iwlegacy/3945-mac.cdrivers/net/wireless/intel/iwlegacy/3945.cdrivers/net/wireless/intel/iwlegacy/4965-mac.cdrivers/net/wireless/intel/iwlegacy/common.cdrivers/net/wireless/marvell/mwl8k.c
Quoted 2 lines
include/net/libeth/tx.h
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Quoted 3 lines · Marek Szyprowski
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Jakub Kicinski
On Tue, 4 Mar 2025 15:41:19 +0200 Andy Shevchenko wrote:
...
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
I meant something more like (untested):
We are starving for the comment from the DMA mapping people.
I'm really sorry for this delay. Just got back to the everyday stuff after spending a week in bed recovering from flu...
Oh, I hope you feel much better now!
...
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) #define DEFINE_DMA_UNMAP_LEN(LEN_NAME)include/linux/dma-mapping.h +4
-4-#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) -#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0) -#define dma_unmap_len (PTR ,LEN_NAME ) (0) -#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0) +#define dma_unmap_len (PTR ,LEN_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0)I just don't know how much code out there depends on PTR not existing if !CONFIG_NEED_DMA_MAP_STATE
Quoted 8 lines
Quoted 3 lines
Brief checking shows that only
drivers/net/ethernet/chelsio/*comes with ifdeffery, the rest most likely will fail in the same way (note, overwhelming majority of the users is under the network realm):Frankly speaking I wasn't aware of this API till now.
If got it right the above proposal should work fine. The addr/len names can be optimized out, but the pointer to the container should exist.
Thanks for the reply, would you or Jakub will to send a formal patch? I can test it on my configuration and build.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Marek Szyprowski
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Jakub Kicinski
On Tue, 4 Mar 2025 15:41:19 +0200 Andy Shevchenko wrote:
...
Quoted 27 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
I meant something more like (untested):
We are starving for the comment from the DMA mapping people.
I'm really sorry for this delay. Just got back to the everyday stuff after spending a week in bed recovering from flu...
Oh, I hope you feel much better now!
...
Quoted 17 lines
Quoted 16 lines
Quoted 11 lines
#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) #define DEFINE_DMA_UNMAP_LEN(LEN_NAME)include/linux/dma-mapping.h +4
-4-#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) -#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0) -#define dma_unmap_len (PTR ,LEN_NAME ) (0) -#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0) +#define dma_unmap_len (PTR ,LEN_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0)Quoted 2 lines
I just don't know how much code out there depends on PTR not existing if !CONFIG_NEED_DMA_MAP_STATE
Brief checking shows that only
drivers/net/ethernet/chelsio/*comes with ifdeffery, the rest most likely will fail in the same way (note, overwhelming majority of the users is under the network realm):
Quoted 7 lines
Quoted 4 lines
Frankly speaking I wasn't aware of this API till now.
If got it right the above proposal should work fine. The addr/len names can be optimized out, but the pointer to the container should exist.
Thanks for the reply, would you or Jakub will to send a formal patch? I can test it on my configuration and build.
Any news here? The problem still persist AFAICT.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Marek Szyprowski
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Jakub Kicinski
On Tue, 4 Mar 2025 15:41:19 +0200 Andy Shevchenko wrote:
...
Quoted 29 lines
Quoted 29 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
I meant something more like (untested):
We are starving for the comment from the DMA mapping people.
I'm really sorry for this delay. Just got back to the everyday stuff after spending a week in bed recovering from flu...
Oh, I hope you feel much better now!
...
Quoted 19 lines
Quoted 11 lines
Quoted 10 lines
#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) #define DEFINE_DMA_UNMAP_LEN(LEN_NAME)include/linux/dma-mapping.h +4
-4-#define dma_unmap_addr (PTR ,ADDR_NAME ) (0) -#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { } while (0) -#define dma_unmap_len (PTR ,LEN_NAME ) (0) -#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { } while (0) +#define dma_unmap_addr (PTR ,ADDR_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_addr_set (PTR ,ADDR_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0) +#define dma_unmap_len (PTR ,LEN_NAME ) ({ typeof(PTR) __p __maybe_unused = PTR; 0; )} +#define dma_unmap_len_set (PTR ,LEN_NAME ,VAL ) do { typeof(PTR) __p __maybe_unused = PTR; } while (0)Quoted 5 lines
Quoted 2 lines
I just don't know how much code out there depends on PTR not existing if !CONFIG_NEED_DMA_MAP_STATE
Brief checking shows that only
drivers/net/ethernet/chelsio/*comes with ifdeffery, the rest most likely will fail in the same way (note, overwhelming majority of the users is under the network realm):Frankly speaking I wasn't aware of this API till now.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
If got it right the above proposal should work fine. The addr/len names can be optimized out, but the pointer to the container should exist.
Thanks for the reply, would you or Jakub will to send a formal patch? I can test it on my configuration and build.
Any news here? The problem still persist AFAICT.
Thank you, Marek, for the patch, I just have tested it, and it works as expected to me.
Signature · 2 lines
With Best Regards, Andy Shevchenko