]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/net/bnx2x/bnx2x_main.c
bnx2x: do not call link update without HW notification
[mirror_ubuntu-jammy-kernel.git] / drivers / net / bnx2x / bnx2x_main.c
index 4b70311a11ef9f4a3ff5b631585f0d8bded19984..2b4b376a69fb737af2ca72b46e345e6875f7720f 100644 (file)
@@ -1285,10 +1285,6 @@ void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw)
        int msix = (bp->flags & USING_MSIX_FLAG) ? 1 : 0;
        int i, offset;
 
-       /* disable interrupt handling */
-       atomic_inc(&bp->intr_sem);
-       smp_wmb(); /* Ensure that bp->intr_sem update is SMP-safe */
-
        if (disable_hw)
                /* prevent the HW from sending interrupts */
                bnx2x_int_disable(bp);
@@ -1411,12 +1407,6 @@ irqreturn_t bnx2x_interrupt(int irq, void *dev_instance)
        }
        DP(NETIF_MSG_INTR, "got an interrupt  status 0x%x\n", status);
 
-       /* Return here if interrupt is disabled */
-       if (unlikely(atomic_read(&bp->intr_sem) != 0)) {
-               DP(NETIF_MSG_INTR, "called but intr_sem not 0, returning\n");
-               return IRQ_HANDLED;
-       }
-
 #ifdef BNX2X_STOP_ON_ERROR
        if (unlikely(bp->panic))
                return IRQ_HANDLED;
@@ -1732,45 +1722,6 @@ static int bnx2x_set_spio(struct bnx2x *bp, int spio_num, u32 mode)
        return 0;
 }
 
-int bnx2x_get_link_cfg_idx(struct bnx2x *bp)
-{
-       u32 sel_phy_idx = 0;
-       if (bp->link_vars.link_up) {
-               sel_phy_idx = EXT_PHY1;
-               /* In case link is SERDES, check if the EXT_PHY2 is the one */
-               if ((bp->link_vars.link_status & LINK_STATUS_SERDES_LINK) &&
-                   (bp->link_params.phy[EXT_PHY2].supported & SUPPORTED_FIBRE))
-                       sel_phy_idx = EXT_PHY2;
-       } else {
-
-               switch (bnx2x_phy_selection(&bp->link_params)) {
-               case PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT:
-               case PORT_HW_CFG_PHY_SELECTION_FIRST_PHY:
-               case PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY:
-                      sel_phy_idx = EXT_PHY1;
-                      break;
-               case PORT_HW_CFG_PHY_SELECTION_SECOND_PHY:
-               case PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY:
-                      sel_phy_idx = EXT_PHY2;
-                      break;
-               }
-       }
-       /*
-       * The selected actived PHY is always after swapping (in case PHY
-       * swapping is enabled). So when swapping is enabled, we need to reverse
-       * the configuration
-       */
-
-       if (bp->link_params.multi_phy_config &
-           PORT_HW_CFG_PHY_SWAPPED_ENABLED) {
-               if (sel_phy_idx == EXT_PHY1)
-                       sel_phy_idx = EXT_PHY2;
-               else if (sel_phy_idx == EXT_PHY2)
-                       sel_phy_idx = EXT_PHY1;
-       }
-       return LINK_CONFIG_IDX(sel_phy_idx);
-}
-
 void bnx2x_calc_fc_adv(struct bnx2x *bp)
 {
        u8 cfg_idx = bnx2x_get_link_cfg_idx(bp);
@@ -1941,8 +1892,12 @@ static void bnx2x_calc_vn_weight_sum(struct bnx2x *bp)
                bp->vn_weight_sum += vn_min_rate;
        }
 
-       /* ... only if all min rates are zeros - disable fairness */
-       if (all_zero) {
+       /* if ETS or all min rates are zeros - disable fairness */
+       if (BNX2X_IS_ETS_ENABLED(bp)) {
+               bp->cmng.flags.cmng_enables &=
+                                       ~CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
+               DP(NETIF_MSG_IFUP, "Fairness will be disabled due to ETS\n");
+       } else if (all_zero) {
                bp->cmng.flags.cmng_enables &=
                                        ~CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
                DP(NETIF_MSG_IFUP, "All MIN values are zeroes"
@@ -2892,9 +2847,15 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
 
                        /* save nig interrupt mask */
                        nig_mask = REG_RD(bp, nig_int_mask_addr);
-                       REG_WR(bp, nig_int_mask_addr, 0);
 
-                       bnx2x_link_attn(bp);
+                       /* If nig_mask is not set, no need to call the update
+                        * function.
+                        */
+                       if (nig_mask) {
+                               REG_WR(bp, nig_int_mask_addr, 0);
+
+                               bnx2x_link_attn(bp);
+                       }
 
                        /* handle unicore attn? */
                }
@@ -3810,12 +3771,6 @@ static void bnx2x_sp_task(struct work_struct *work)
        struct bnx2x *bp = container_of(work, struct bnx2x, sp_task.work);
        u16 status;
 
-       /* Return here if interrupt is disabled */
-       if (unlikely(atomic_read(&bp->intr_sem) != 0)) {
-               DP(NETIF_MSG_INTR, "called but intr_sem not 0, returning\n");
-               return;
-       }
-
        status = bnx2x_update_dsb_idx(bp);
 /*     if (status == 0)                                     */
 /*             BNX2X_ERR("spurious slowpath interrupt!\n"); */
@@ -3859,12 +3814,6 @@ irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
        struct net_device *dev = dev_instance;
        struct bnx2x *bp = netdev_priv(dev);
 
-       /* Return here if interrupt is disabled */
-       if (unlikely(atomic_read(&bp->intr_sem) != 0)) {
-               DP(NETIF_MSG_INTR, "called but intr_sem not 0, returning\n");
-               return IRQ_HANDLED;
-       }
-
        bnx2x_ack_sb(bp, bp->igu_dsb_id, USTORM_ID, 0,
                     IGU_INT_DISABLE, 0);
 
@@ -3898,9 +3847,6 @@ static void bnx2x_timer(unsigned long data)
        if (!netif_running(bp->dev))
                return;
 
-       if (atomic_read(&bp->intr_sem) != 0)
-               goto timer_restart;
-
        if (poll) {
                struct bnx2x_fastpath *fp = &bp->fp[0];
 
@@ -3935,7 +3881,6 @@ static void bnx2x_timer(unsigned long data)
        if (bp->state == BNX2X_STATE_OPEN)
                bnx2x_stats_handle(bp, STATS_EVENT_UPDATE);
 
-timer_restart:
        mod_timer(&bp->timer, jiffies + bp->current_interval);
 }
 
@@ -4491,6 +4436,10 @@ void bnx2x_nic_init(struct bnx2x *bp, u32 load_code)
 
 #endif
 
+       /* Initialize MOD_ABS interrupts */
+       bnx2x_init_mod_abs_int(bp, &bp->link_vars, bp->common.chip_id,
+                              bp->common.shmem_base, bp->common.shmem2_base,
+                              BP_PORT(bp));
        /* ensure status block indices were read */
        rmb();
 
@@ -4505,9 +4454,6 @@ void bnx2x_nic_init(struct bnx2x *bp, u32 load_code)
        bnx2x_init_ind_table(bp);
        bnx2x_stats_init(bp);
 
-       /* At this point, we are ready for interrupts */
-       atomic_set(&bp->intr_sem, 0);
-
        /* flush all before enabling interrupts */
        mb();
        mmiowb();
@@ -8683,10 +8629,6 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
        int timer_interval;
        int rc;
 
-       /* Disable interrupt handling until HW is initialized */
-       atomic_set(&bp->intr_sem, 1);
-       smp_wmb(); /* Ensure that bp->intr_sem update is SMP-safe */
-
        mutex_init(&bp->port.phy_mutex);
        mutex_init(&bp->fw_mb_mutex);
        spin_lock_init(&bp->stats_lock);
@@ -10204,9 +10146,6 @@ static int bnx2x_register_cnic(struct net_device *dev, struct cnic_ops *ops,
        if (ops == NULL)
                return -EINVAL;
 
-       if (atomic_read(&bp->intr_sem) != 0)
-               return -EBUSY;
-
        bp->cnic_kwq = kzalloc(PAGE_SIZE, GFP_KERNEL);
        if (!bp->cnic_kwq)
                return -ENOMEM;