drivers: remove __rte_used from functions for compatibility with MSVC
PATCH 1/1 drivers: remove __rte_used from functions for compatibility with MSVC
With gcc, the macro __rte_used translates to __attribute__((used)). MSVC has something to the same effect, but harder to use and with some limitations (one being that it cannot be used with "static"). Therefore, it makes sense to avoid __rte_used in some cases.
The functions modified in this patch don't really need to use __rte_used. Instead, these functions can be involved in same ifdefs used in the callers. That way, they are only defined when needed (when someone is actually calling the function). Doing so makes the code compatible with MSVC and avoids compiler warnings about functions being defined but not used.
--- drivers/net/cnxk/cn10k_rx_select.c | 6 +++++- drivers/net/cnxk/cn10k_tx_select.c | 6 ++++-- drivers/net/cnxk/cn20k_rx_select.c | 6 +++++- drivers/net/cnxk/cn20k_tx_select.c | 6 ++++-- drivers/net/cnxk/cn9k_rx_select.c | 6 ++++-- drivers/net/cnxk/cn9k_tx_select.c | 6 ++++-- 6 files changed, 26 insertions(+), 10 deletions(-)
drivers/net/cnxk/cn10k_rx_select.c +5 -1
@@ -5,7 +5,9 @@#include "cn10k_ethdev.h" #include "cn10k_rx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static void pick_rx_func(struct rte_eth_dev *eth_dev, const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX]) {
@@ -21,6 +23,8 @@ pick_rx_func(struct rte_eth_dev *eth_dev,rte_atomic_thread_fence (rte_memory_order_release); } +#endif +#endif static uint16_t __rte_noinline __rte_hot __rte_unusedcn10k_nix_flush_rx (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t pkts)
drivers/net/cnxk/cn10k_tx_select.c +4 -2
@@ -5,7 +5,9 @@#include "cn10k_ethdev.h" #include "cn10k_tx.h" -static __rte_used inline void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static inline void pick_tx_func(struct rte_eth_dev *eth_dev, const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX]) {
@@ -19,8 +21,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev, rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = eth_dev->tx_pkt_burst; } +#endif -#if defined(RTE_ARCH_ARM64 )static int cn10k_nix_tx_queue_count (void *tx_queue) {
drivers/net/cnxk/cn20k_rx_select.c +5 -1
@@ -5,7 +5,9 @@#include "cn20k_ethdev.h" #include "cn20k_rx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static void pick_rx_func(struct rte_eth_dev *eth_dev, const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX]) { struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -18,6 +20,8 @@ pick_rx_func(struct rte_eth_dev *eth_dev, const eth_rx_burst_t rx_burst[NIX_RX_Orte_atomic_thread_fence (rte_memory_order_release); } +#endif +#endif static uint16_t __rte_noinline __rte_hot __rte_unusedcn20k_nix_flush_rx (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t pkts)
drivers/net/cnxk/cn20k_tx_select.c +4 -2
@@ -5,7 +5,9 @@#include "cn20k_ethdev.h" #include "cn20k_tx.h" -static __rte_used inline void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static inline void pick_tx_func(struct rte_eth_dev *eth_dev, const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX]) { struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -16,8 +18,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev, const eth_tx_burst_t tx_burst[NIX_TX_Oif (eth_dev->data->dev_started) rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = eth_dev->tx_pkt_burst; } +#endif -#if defined(RTE_ARCH_ARM64 )static int cn20k_nix_tx_queue_count (void *tx_queue) {
drivers/net/cnxk/cn9k_rx_select.c +4 -2
@@ -5,7 +5,9 @@#include "cn9k_ethdev.h" #include "cn9k_rx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static void pick_rx_func(struct rte_eth_dev *eth_dev, const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX]) {
@@ -19,8 +21,8 @@ pick_rx_func(struct rte_eth_dev *eth_dev, rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst = eth_dev->rx_pkt_burst; } +#endif -#if defined(RTE_ARCH_ARM64 )static void cn9k_eth_set_rx_tmplt_func (struct rte_eth_dev *eth_dev) {
drivers/net/cnxk/cn9k_tx_select.c +4 -2
@@ -5,7 +5,9 @@#include "cn9k_ethdev.h" #include "cn9k_tx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static void pick_tx_func(struct rte_eth_dev *eth_dev, const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX]) {
@@ -19,8 +21,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev, rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = eth_dev->tx_pkt_burst; } +#endif -#if defined(RTE_ARCH_ARM64 )static int cn9k_nix_tx_queue_count (void *tx_queue) {
Signature · 1 line
2.49.0.vfs.0.0
Quoted 1 line
-----Original Message----- > From: Andre Muezerie <andremue@ linux. microsoft. com> > Sent: Friday, April 4, 2025 7: 18 AM > To: Nithin Kumar Dabilpuram <ndabilpuram@ marvell. com>; Kiran Kumar > Kokkilagadda <kirankumark@ marvell. com>; ZjQcmQRYFpfptBannerStart Prioritize security for external emails: Confirm sender and content safety before clicking links or opening attachments Report Suspicious ZjQcmQRYFpfptBannerEnd > -----Original Message----- > From: Andre Muezerie <[email protected]> > Sent: Friday, April 4, 2025 7:18 AM > To: Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar > Kokkilagadda <[email protected]>; Sunil Kumar Kori > <[email protected]>; Satha Koteswara Rao Kottidi > <[email protected]>; Harman Kalra <[email protected]> > Cc: [email protected]; Andre Muezerie <[email protected]> > Subject: [EXTERNAL] [PATCH] drivers: remove
__rte_usedfrom functions for > compatibility with MSVC > > With gcc, the macro__rte_usedtranslates to __attribute__((used)). MSVC has > something to the same effect, but harder to use and with some limitations (one > being that it cannot be used with "static"). Therefore, it makes sense to avoid >__rte_usedZjQcmQRYFpfptBannerStart Prioritize security for external emails: > Confirm sender and content safety before clicking links or opening attachments > <https://us-phishalarm- > ewt.proofpoint.com/EWT/v1/CRVmXkqW!t83ZtR_UwpW61E99mn37ThGThaB6 > gt7spCdfZvP9Yz5DLa-AKWhfbPLLmgyDnTM_FczAEE3KDso8- > QC5MEstA0f8Xb8gLd9dJN3BVWrFMpv9DT2-yl2l$> > Report Suspicious > > ZjQcmQRYFpfptBannerEnd > With gcc, the macro__rte_usedtranslates to __attribute__((used)). > MSVC has something to the same effect, but harder to use and with some > limitations (one being that it cannot be used with "static"). Therefore, it makes > sense to avoid__rte_usedin some cases. > > The functions modified in this patch don't really need to use__rte_used. > Instead, these functions can be involved in same ifdefs used in the callers. That > way, they are only defined when needed (when someone is actually calling the > function). Doing so makes the code compatible with MSVC and avoids compiler > warnings about functions being defined but not used. > > Signed-off-by: Andre Muezerie <[email protected]> > --- >drivers/net/cnxk/cn10k_rx_select.c| 6 +++++- >drivers/net/cnxk/cn10k_tx_select.c| 6 ++++-- >drivers/net/cnxk/cn20k_rx_select.c| 6 +++++- >drivers/net/cnxk/cn20k_tx_select.c| 6 ++++-- >drivers/net/cnxk/cn9k_rx_select.c| 6 ++++-- >drivers/net/cnxk/cn9k_tx_select.c| 6 ++++-- > 6 files changed, 26 insertions(+), 10 deletions(-) > > diff --gita/drivers/net/cnxk/cn10k_rx_select.c>b/drivers/net/cnxk/cn10k_rx_select.c> indexfe1f0dda73..658a434d75100644 > ---a/drivers/net/cnxk/cn10k_rx_select.c> +++b/drivers/net/cnxk/cn10k_rx_select.c> @@ -5,7 +5,9 @@ > #include "cn10k_ethdev.h" > #include "cn10k_rx.h" > > -static__rte_usedvoid > +#ifdefined(RTE_ARCH_ARM64)> +#if !defined(CNXK_DIS_TMPLT_FUNC) Please change to #ifdefined(RTE_ARCH_ARM64)&& !defined(CNXK_DIS_TMPLT_FUNC)
Quoted 1 line
Quoted 1 line
From: Andre Muezerie <andremue@ linux. microsoft. com> > > Sent: Friday, April 4, 2025 7: 18 AM > > To: Nithin Kumar Dabilpuram <ndabilpuram@ marvell. com>; Kiran Kumar > > Kokkilagadda <kirankumark@ marvell. com>; ZjQcmQRYFpfptBannerStart Prioritize security for external emails: Confirm sender and content safety before clicking links or opening attachments Report Suspicious ZjQcmQRYFpfptBannerEnd > > From: Andre Muezerie <[email protected]> > > Sent: Friday, April 4, 2025 7:18 AM > > To: Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar > > Kokkilagadda <[email protected]>; Sunil Kumar Kori > > <[email protected]>; Satha Koteswara Rao Kottidi > > <[email protected]>; Harman Kalra <[email protected]> > > Cc: [email protected]; Andre Muezerie <[email protected]> > > Subject: [EXTERNAL] [PATCH] drivers: remove
__rte_usedfrom functions for > > compatibility with MSVC > > > > With gcc, the macro__rte_usedtranslates to __attribute__((used)). MSVC > has > > something to the same effect, but harder to use and with some limitations > (one > > being that it cannot be used with "static"). Therefore, it makes sense to > avoid > >__rte_usedZjQcmQRYFpfptBannerStart Prioritize security for external > emails: > > Confirm sender and content safety before clicking links or opening > attachments > > <https://us-phishalarm- > <https://urldefense.proofpoint.com/v2/url?u=https-3A__us-2Dphishalarm- >2D&d=DwQFAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=E3SgYMjtKCMVsB- > fmvgGV3o- > g_fjLhk5Pupi9ijohpc&m=1VjiJp6BZRZ004EEbRgDWdnwVSxocf7eebwvsLHsSba > GED02QuAMX--cepxiabet&s=Xp1219TuPNnfOJWQk6-Il7LikxCZOexBfkdSm- > kmbuI&e=> > > > ewt.proofpoint.com/EWT/v1/CRVmXkqW!t83ZtR_UwpW61E99mn37ThGThaB > 6 > > gt7spCdfZvP9Yz5DLa-AKWhfbPLLmgyDnTM_FczAEE3KDso8- > > QC5MEstA0f8Xb8gLd9dJN3BVWrFMpv9DT2-yl2l$> > > Report Suspicious > > > > ZjQcmQRYFpfptBannerEnd > > With gcc, the macro__rte_usedtranslates to __attribute__((used)). > > MSVC has something to the same effect, but harder to use and with some > > limitations (one being that it cannot be used with "static"). Therefore, it > makes > > sense to avoid__rte_usedin some cases. > > > > The functions modified in this patch don't really need to use__rte_used. > > Instead, these functions can be involved in same ifdefs used in the callers. > That > > way, they are only defined when needed (when someone is actually calling > the > > function). Doing so makes the code compatible with MSVC and avoids > compiler > > warnings about functions being defined but not used. > > > > Signed-off-by: Andre Muezerie <[email protected]> > > --- > >drivers/net/cnxk/cn10k_rx_select.c| 6 +++++- > >drivers/net/cnxk/cn10k_tx_select.c| 6 ++++-- > >drivers/net/cnxk/cn20k_rx_select.c| 6 +++++- > >drivers/net/cnxk/cn20k_tx_select.c| 6 ++++-- > >drivers/net/cnxk/cn9k_rx_select.c| 6 ++++-- > >drivers/net/cnxk/cn9k_tx_select.c| 6 ++++-- > > 6 files changed, 26 insertions(+), 10 deletions(-) > > > > diff --gita/drivers/net/cnxk/cn10k_rx_select.c> >b/drivers/net/cnxk/cn10k_rx_select.c> > indexfe1f0dda73..658a434d75100644 > > ---a/drivers/net/cnxk/cn10k_rx_select.c> > +++b/drivers/net/cnxk/cn10k_rx_select.c> > @@ -5,7 +5,9 @@ > > #include "cn10k_ethdev.h" > > #include "cn10k_rx.h" > > > > -static__rte_usedvoid > > +#ifdefined(RTE_ARCH_ARM64)> > +#if !defined(CNXK_DIS_TMPLT_FUNC) > > Please change to #ifdefined(RTE_ARCH_ARM64)&& > !defined(CNXK_DIS_TMPLT_FUNC) With the above change Acked-by: Pavan Nikhilesh <[email protected]>
PATCH v2 1/1 drivers: remove __rte_used from functions for compatibility with MSVC
In reply to Andre MuezerieWith gcc, the macro __rte_used translates to __attribute__((used)). MSVC has something to the same effect, but harder to use and with some limitations (one being that it cannot be used with "static"). Therefore, it makes sense to avoid __rte_used in some cases.
The functions modified in this patch don't really need to use __rte_used. Instead, these functions can be involved in same ifdefs used in the callers. That way, they are only defined when needed (when someone is actually calling the function). Doing so makes the code compatible with MSVC and avoids compiler warnings about functions being defined but not used.
--- drivers/net/cnxk/cn10k_rx_select.c | 4 +++- drivers/net/cnxk/cn10k_tx_select.c | 6 ++++-- drivers/net/cnxk/cn20k_rx_select.c | 4 +++- drivers/net/cnxk/cn20k_tx_select.c | 6 ++++-- drivers/net/cnxk/cn9k_rx_select.c | 6 ++++-- drivers/net/cnxk/cn9k_tx_select.c | 6 ++++-- 6 files changed, 22 insertions(+), 10 deletions(-)
drivers/net/cnxk/cn10k_rx_select.c +3 -1
@@ -5,7 +5,8 @@#include "cn10k_ethdev.h" #include "cn10k_rx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64 ) && !defined(CNXK_DIS_TMPLT_FUNC ) +static void pick_rx_func (struct rte_eth_dev *eth_dev,const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX ]) {
@@ -21,6 +22,7 @@ pick_rx_func(struct rte_eth_dev *eth_dev,rte_atomic_thread_fence (rte_memory_order_release); } +#endif static uint16_t __rte_noinline __rte_hot __rte_unusedcn10k_nix_flush_rx (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t pkts)
drivers/net/cnxk/cn10k_tx_select.c +4 -2
@@ -5,7 +5,9 @@#include "cn10k_ethdev.h" #include "cn10k_tx.h" -static __rte_used inline void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static inline void pick_tx_func(struct rte_eth_dev *eth_dev, const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX]) {
@@ -19,8 +21,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev, rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = eth_dev->tx_pkt_burst; } +#endif -#if defined(RTE_ARCH_ARM64 )static int cn10k_nix_tx_queue_count (void *tx_queue) {
drivers/net/cnxk/cn20k_rx_select.c +3 -1
@@ -5,7 +5,8 @@#include "cn20k_ethdev.h" #include "cn20k_rx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64 ) && !defined(CNXK_DIS_TMPLT_FUNC ) +static void pick_rx_func (struct rte_eth_dev *eth_dev,const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX ]) {struct cnxk_eth_dev *dev =cnxk_eth_pmd_priv (eth_dev);
@@ -18,6 +19,7 @@ pick_rx_func(struct rte_eth_dev *eth_dev, const eth_rx_burst_t rx_burst[NIX_RX_Orte_atomic_thread_fence (rte_memory_order_release); } +#endif static uint16_t __rte_noinline __rte_hot __rte_unusedcn20k_nix_flush_rx (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t pkts)
drivers/net/cnxk/cn20k_tx_select.c +4 -2
@@ -5,7 +5,9 @@#include "cn20k_ethdev.h" #include "cn20k_tx.h" -static __rte_used inline void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static inline void pick_tx_func(struct rte_eth_dev *eth_dev, const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX]) { struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -16,8 +18,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev, const eth_tx_burst_t tx_burst[NIX_TX_Oif (eth_dev->data->dev_started) rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = eth_dev->tx_pkt_burst; } +#endif -#if defined(RTE_ARCH_ARM64 )static int cn20k_nix_tx_queue_count (void *tx_queue) {
drivers/net/cnxk/cn9k_rx_select.c +4 -2
@@ -5,7 +5,9 @@#include "cn9k_ethdev.h" #include "cn9k_rx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static void pick_rx_func(struct rte_eth_dev *eth_dev, const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX]) {
@@ -19,8 +21,8 @@ pick_rx_func(struct rte_eth_dev *eth_dev, rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst = eth_dev->rx_pkt_burst; } +#endif -#if defined(RTE_ARCH_ARM64 )static void cn9k_eth_set_rx_tmplt_func (struct rte_eth_dev *eth_dev) {
drivers/net/cnxk/cn9k_tx_select.c +4 -2
@@ -5,7 +5,9 @@#include "cn9k_ethdev.h" #include "cn9k_tx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64) +#if !defined(CNXK_DIS_TMPLT_FUNC) +static void pick_tx_func(struct rte_eth_dev *eth_dev, const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX]) {
@@ -19,8 +21,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev, rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = eth_dev->tx_pkt_burst; } +#endif -#if defined(RTE_ARCH_ARM64 )static int cn9k_nix_tx_queue_count (void *tx_queue) {
Signature · 1 line
2.49.0.vfs.0.3
Quoted 18 lines · Andre Muezerie
With gcc, the macro
__rte_usedtranslates to __attribute__((used)). MSVC has something to the same effect, but harder to use and with some limitations (one being that it cannot be used with "static"). Therefore, it makes sense to avoid__rte_usedin some cases.The functions modified in this patch don't really need to use
__rte_used. Instead, these functions can be involved in same ifdefs used in the callers. That way, they are only defined when needed (when someone is actually calling the function). Doing so makes the code compatible with MSVC and avoids compiler warnings about functions being defined but not used.Signed-off-by Andre Muezerie <[email protected]>Acked-by Pavan Nikhilesh <[email protected]>---
drivers/net/cnxk/cn10k_tx_select.c line 9
Quoted 3 lines
drivers/net/cnxk/cn10k_tx_select.c +2
-1-static __rte_used inline void +#if defined(RTE_ARCH_ARM64 ) +#if !defined(CNXK_DIS_TMPLT_FUNC )
Please change to #if defined(RTE_ARCH_ARM64) &&
!defined(CNXK_DIS_TMPLT_FUNC) in all instances.
PATCH v3 1/1 drivers: remove __rte_used from functions for compatibility with MSVC
In reply to Andre MuezerieWith gcc, the macro __rte_used translates to __attribute__((used)). MSVC has something to the same effect, but harder to use and with some limitations (one being that it cannot be used with "static"). Therefore, it makes sense to avoid __rte_used in some cases.
The functions modified in this patch don't really need to use __rte_used. Instead, these functions can be involved in same ifdefs used in the callers. That way, they are only defined when needed (when someone is actually calling the function). Doing so makes the code compatible with MSVC and avoids compiler warnings about functions being defined but not used.
--- drivers/net/cnxk/cn10k_rx_select.c | 4 +++- drivers/net/cnxk/cn10k_tx_select.c | 4 +++- drivers/net/cnxk/cn20k_rx_select.c | 4 +++- drivers/net/cnxk/cn20k_tx_select.c | 4 +++- drivers/net/cnxk/cn9k_rx_select.c | 4 +++- drivers/net/cnxk/cn9k_tx_select.c | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-)
drivers/net/cnxk/cn10k_rx_select.c +3 -1
@@ -5,7 +5,8 @@#include "cn10k_ethdev.h" #include "cn10k_rx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64 ) && !defined(CNXK_DIS_TMPLT_FUNC ) +static void pick_rx_func (struct rte_eth_dev *eth_dev,const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX ]) {
@@ -21,6 +22,7 @@ pick_rx_func(struct rte_eth_dev *eth_dev,rte_atomic_thread_fence (rte_memory_order_release); } +#endif static uint16_t __rte_noinline __rte_hot __rte_unusedcn10k_nix_flush_rx (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t pkts)
drivers/net/cnxk/cn10k_tx_select.c +3 -1
@@ -5,7 +5,8 @@#include "cn10k_ethdev.h" #include "cn10k_tx.h" -static __rte_used inline void +#if defined(RTE_ARCH_ARM64 ) && !defined(CNXK_DIS_TMPLT_FUNC ) +static inline void pick_tx_func (struct rte_eth_dev *eth_dev,const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX ]) {
@@ -19,6 +20,7 @@ pick_tx_func(struct rte_eth_dev *eth_dev, rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = eth_dev->tx_pkt_burst; } +#endif #if defined(RTE_ARCH_ARM64 ) static int
drivers/net/cnxk/cn20k_rx_select.c +3 -1
@@ -5,7 +5,8 @@#include "cn20k_ethdev.h" #include "cn20k_rx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64 ) && !defined(CNXK_DIS_TMPLT_FUNC ) +static void pick_rx_func (struct rte_eth_dev *eth_dev,const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX ]) {struct cnxk_eth_dev *dev =cnxk_eth_pmd_priv (eth_dev);
@@ -18,6 +19,7 @@ pick_rx_func(struct rte_eth_dev *eth_dev, const eth_rx_burst_t rx_burst[NIX_RX_Orte_atomic_thread_fence (rte_memory_order_release); } +#endif static uint16_t __rte_noinline __rte_hot __rte_unusedcn20k_nix_flush_rx (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t pkts)
drivers/net/cnxk/cn20k_tx_select.c +3 -1
@@ -5,7 +5,8 @@#include "cn20k_ethdev.h" #include "cn20k_tx.h" -static __rte_used inline void +#if defined(RTE_ARCH_ARM64 ) && !defined(CNXK_DIS_TMPLT_FUNC ) +static inline void pick_tx_func (struct rte_eth_dev *eth_dev,const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX ]) {struct cnxk_eth_dev *dev =cnxk_eth_pmd_priv (eth_dev);
@@ -16,6 +17,7 @@ pick_tx_func(struct rte_eth_dev *eth_dev, const eth_tx_burst_t tx_burst[NIX_TX_Oif (eth_dev->data->dev_started) rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = eth_dev->tx_pkt_burst; } +#endif #if defined(RTE_ARCH_ARM64 ) static int
drivers/net/cnxk/cn9k_rx_select.c +3 -1
@@ -5,7 +5,8 @@#include "cn9k_ethdev.h" #include "cn9k_rx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64 ) && !defined(CNXK_DIS_TMPLT_FUNC ) +static void pick_rx_func (struct rte_eth_dev *eth_dev,const eth_rx_burst_t rx_burst[NIX_RX_OFFLOAD_MAX ]) {
@@ -19,6 +20,7 @@ pick_rx_func(struct rte_eth_dev *eth_dev, rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst = eth_dev->rx_pkt_burst; } +#endif #if defined(RTE_ARCH_ARM64 ) static void
drivers/net/cnxk/cn9k_tx_select.c +3 -1
@@ -5,7 +5,8 @@#include "cn9k_ethdev.h" #include "cn9k_tx.h" -static __rte_used void +#if defined(RTE_ARCH_ARM64 ) && !defined(CNXK_DIS_TMPLT_FUNC ) +static void pick_tx_func (struct rte_eth_dev *eth_dev,const eth_tx_burst_t tx_burst[NIX_TX_OFFLOAD_MAX ]) {
@@ -19,6 +20,7 @@ pick_tx_func(struct rte_eth_dev *eth_dev, rte_eth_fp_ops[eth_dev->data->port_id].tx_pkt_burst = eth_dev->tx_pkt_burst; } +#endif #if defined(RTE_ARCH_ARM64 ) static int
Signature · 1 line
2.49.0.vfs.0.3
Quoted 13 lines · Andre Muezerie
With gcc, the macro
__rte_usedtranslates to __attribute__((used)). MSVC has something to the same effect, but harder to use and with some limitations (one being that it cannot be used with "static"). Therefore, it makes sense to avoid__rte_usedin some cases.The functions modified in this patch don't really need to use
__rte_used. Instead, these functions can be involved in same ifdefs used in the callers. That way, they are only defined when needed (when someone is actually calling the function). Doing so makes the code compatible with MSVC and avoids compiler warnings about functions being defined but not used.
Quoted 2 lines
Signed-off-by Andre Muezerie <[email protected]>Acked-by Pavan Nikhilesh <[email protected]>
Updated the git commit as follows and applied to
dpdk-next-net-mrvl/for-main. Thanks
net/cnxk: improve MSVC compatibility
With gcc, the macro __rte_used translates to __attribute__((used)). MSVC has something to the same effect, but harder to use and with some limitations (one being that it cannot be used with "static"). Therefore, it makes sense to avoid __rte_used in some cases.
The functions modified in this patch don't really need to use __rte_used. Instead, these functions can be involved in same ifdefs used in the callers. That way, they are only defined when needed (when someone is actually calling the function). Doing so makes the code compatible with MSVC and avoids compiler warnings about functions being defined but not used.