Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <govind.varadar@gmail.com>
Link: https://lore.kernel.org/r/20221018005804.188643-1-govind.varadar@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Govindarajulu Varadarajan and committed by
Jakub Kicinski
e2ac2a00 f3d27ae0

+11 -23
+6 -17
drivers/net/ethernet/cisco/enic/enic.h
··· 226 226 return enic->rq_count + wq; 227 227 } 228 228 229 - static inline unsigned int enic_legacy_io_intr(void) 230 - { 231 - return 0; 232 - } 233 - 234 - static inline unsigned int enic_legacy_err_intr(void) 235 - { 236 - return 1; 237 - } 238 - 239 - static inline unsigned int enic_legacy_notify_intr(void) 240 - { 241 - return 2; 242 - } 243 - 244 229 static inline unsigned int enic_msix_rq_intr(struct enic *enic, 245 230 unsigned int rq) 246 231 { ··· 243 258 return enic->rq_count + enic->wq_count; 244 259 } 245 260 261 + #define ENIC_LEGACY_IO_INTR 0 262 + #define ENIC_LEGACY_ERR_INTR 1 263 + #define ENIC_LEGACY_NOTIFY_INTR 2 264 + 246 265 static inline unsigned int enic_msix_notify_intr(struct enic *enic) 247 266 { 248 267 return enic->rq_count + enic->wq_count + 1; ··· 256 267 { 257 268 switch (vnic_dev_get_intr_mode(enic->vdev)) { 258 269 case VNIC_DEV_INTR_MODE_INTX: 259 - return intr == enic_legacy_err_intr(); 270 + return intr == ENIC_LEGACY_ERR_INTR; 260 271 case VNIC_DEV_INTR_MODE_MSIX: 261 272 return intr == enic_msix_err_intr(enic); 262 273 case VNIC_DEV_INTR_MODE_MSI: ··· 269 280 { 270 281 switch (vnic_dev_get_intr_mode(enic->vdev)) { 271 282 case VNIC_DEV_INTR_MODE_INTX: 272 - return intr == enic_legacy_notify_intr(); 283 + return intr == ENIC_LEGACY_NOTIFY_INTR; 273 284 case VNIC_DEV_INTR_MODE_MSIX: 274 285 return intr == enic_msix_notify_intr(enic); 275 286 case VNIC_DEV_INTR_MODE_MSI:
+5 -6
drivers/net/ethernet/cisco/enic/enic_main.c
··· 448 448 { 449 449 struct net_device *netdev = data; 450 450 struct enic *enic = netdev_priv(netdev); 451 - unsigned int io_intr = enic_legacy_io_intr(); 452 - unsigned int err_intr = enic_legacy_err_intr(); 453 - unsigned int notify_intr = enic_legacy_notify_intr(); 451 + unsigned int io_intr = ENIC_LEGACY_IO_INTR; 452 + unsigned int err_intr = ENIC_LEGACY_ERR_INTR; 453 + unsigned int notify_intr = ENIC_LEGACY_NOTIFY_INTR; 454 454 u32 pba; 455 455 456 456 vnic_intr_mask(&enic->intr[io_intr]); ··· 1507 1507 struct enic *enic = netdev_priv(netdev); 1508 1508 unsigned int cq_rq = enic_cq_rq(enic, 0); 1509 1509 unsigned int cq_wq = enic_cq_wq(enic, 0); 1510 - unsigned int intr = enic_legacy_io_intr(); 1510 + unsigned int intr = ENIC_LEGACY_IO_INTR; 1511 1511 unsigned int rq_work_to_do = budget; 1512 1512 unsigned int wq_work_to_do = ENIC_WQ_NAPI_BUDGET; 1513 1513 unsigned int work_done, rq_work_done = 0, wq_work_done; ··· 1856 1856 spin_lock_bh(&enic->devcmd_lock); 1857 1857 switch (vnic_dev_get_intr_mode(enic->vdev)) { 1858 1858 case VNIC_DEV_INTR_MODE_INTX: 1859 - err = vnic_dev_notify_set(enic->vdev, 1860 - enic_legacy_notify_intr()); 1859 + err = vnic_dev_notify_set(enic->vdev, ENIC_LEGACY_NOTIFY_INTR); 1861 1860 break; 1862 1861 case VNIC_DEV_INTR_MODE_MSIX: 1863 1862 err = vnic_dev_notify_set(enic->vdev,