enic: define constants for legacy interrupts offset
Subsystems (3)
PATCH 1/1 enic: define constants for legacy interrupts offset
Use macro instead of function calls. These values are constant and will not change.
Signed-off-by Govindarajulu Varadarajan <[email protected]>
--- drivers/net/ethernet/cisco/enic/enic.h | 23 ++++++--------------- drivers/net/ethernet/cisco/enic/enic_main.c | 11 +++++----- 2 files changed, 11 insertions(+), 23 deletions(-)
drivers/net/ethernet/cisco/enic/enic.h +6 -17
@@ -226,21 +226,6 @@ static inline unsigned int enic_cq_wq(struct enic *enic, unsigned int wq)return enic->rq_count + wq; } -static inline unsigned int enic_legacy_io_intr (void ) -{ -return 0 ; -} - -static inline unsigned int enic_legacy_err_intr (void ) -{ -return 1 ; -} - -static inline unsigned int enic_legacy_notify_intr (void ) -{ -return 2 ; -} -static inline unsigned int enic_msix_rq_intr (struct enic *enic,unsigned int rq) {
@@ -258,6 +243,10 @@ static inline unsigned int enic_msix_err_intr(struct enic *enic)return enic->rq_count + enic->wq_count; } +#define ENIC_LEGACY_IO_INTR 0 +#define ENIC_LEGACY_ERR_INTR 1 +#define ENIC_LEGACY_NOTIFY_INTR 2 +static inline unsigned int enic_msix_notify_intr (struct enic *enic) {return enic->rq_count + enic->wq_count +1 ;
@@ -267,7 +256,7 @@ static inline bool enic_is_err_intr(struct enic *enic, int intr) {switch (vnic_dev_get_intr_mode (enic->vdev)) {case VNIC_DEV_INTR_MODE_INTX : -return intr ==enic_legacy_err_intr (); +return intr ==ENIC_LEGACY_ERR_INTR ;case VNIC_DEV_INTR_MODE_MSIX :return intr ==enic_msix_err_intr (enic);case VNIC_DEV_INTR_MODE_MSI :
@@ -280,7 +269,7 @@ static inline bool enic_is_notify_intr(struct enic *enic, int intr) {switch (vnic_dev_get_intr_mode (enic->vdev)) {case VNIC_DEV_INTR_MODE_INTX : -return intr ==enic_legacy_notify_intr (); +return intr ==ENIC_LEGACY_NOTIFY_INTR ;case VNIC_DEV_INTR_MODE_MSIX :return intr ==enic_msix_notify_intr (enic);case VNIC_DEV_INTR_MODE_MSI :
drivers/net/ethernet/cisco/enic/enic_main.c +5 -6
@@ -448,9 +448,9 @@ static irqreturn_t enic_isr_legacy(int irq, void *data) {struct net_device *netdev = data;struct enic *enic =netdev_priv (netdev); -unsigned int io_intr =enic_legacy_io_intr (); -unsigned int err_intr =enic_legacy_err_intr (); -unsigned int notify_intr =enic_legacy_notify_intr (); +unsigned int io_intr =ENIC_LEGACY_IO_INTR ; +unsigned int err_intr =ENIC_LEGACY_ERR_INTR ; +unsigned int notify_intr =ENIC_LEGACY_NOTIFY_INTR ;u32 pba;vnic_intr_mask (&enic->intr[io_intr]);
@@ -1507,7 +1507,7 @@ static int enic_poll(struct napi_struct *napi, int budget)struct enic *enic =netdev_priv (netdev);unsigned int cq_rq =enic_cq_rq (enic,0 );unsigned int cq_wq =enic_cq_wq (enic,0 ); -unsigned int intr =enic_legacy_io_intr (); +unsigned int intr =ENIC_LEGACY_IO_INTR ;unsigned int rq_work_to_do = budget;unsigned int wq_work_to_do =ENIC_WQ_NAPI_BUDGET ;unsigned int work_done, rq_work_done =0 , wq_work_done;
@@ -1856,8 +1856,7 @@ static int enic_dev_notify_set(struct enic *enic)spin_lock_bh (&enic->devcmd_lock);switch (vnic_dev_get_intr_mode (enic->vdev)) {case VNIC_DEV_INTR_MODE_INTX : - err =vnic_dev_notify_set (enic->vdev, -enic_legacy_notify_intr ()); + err =vnic_dev_notify_set (enic->vdev,ENIC_LEGACY_NOTIFY_INTR );break ;case VNIC_DEV_INTR_MODE_MSIX : err = vnic_dev_notify_set(enic->vdev,
Signature · 1 line
2.37.3
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Mon, 17 Oct 2022 17:58:04 -0700 you wrote:
Use macro instead of function calls. These values are constant and will not change.
Signed-off-by Govindarajulu Varadarajan <[email protected]>--- drivers/net/ethernet/cisco/enic/enic.h | 23 ++++++--------------- drivers/net/ethernet/cisco/enic/enic_main.c | 11 +++++----- 2 files changed, 11 insertions(+), 23 deletions(-)
Here is the summary with links:
- [net-next] enic: define constants for legacy interrupts offset
https://git.kernel.org/netdev/net-next/c/e2ac2a00dae1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html