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

net/ncsi: Don't mark configured channels inactive

The concepts of a channel being 'active' and it having link are slightly
muddled in the NCSI driver. Tweak this slightly so that
NCSI_CHANNEL_ACTIVE represents a channel that has been configured and
enabled, and NCSI_CHANNEL_INACTIVE represents a de-configured channel.
This distinction is important because a channel can be 'active' but have
its link down; in this case the channel may still need to be configured
so that it may receive AEN link-state-change packets.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Samuel Mendoza-Jonas and committed by
David S. Miller
0b970e1b cd09ab09

+12 -8
+11 -6
net/ncsi/ncsi-aen.c
··· 57 57 int state; 58 58 unsigned long old_data, data; 59 59 unsigned long flags; 60 + bool had_link, has_link; 60 61 61 62 /* Find the NCSI channel */ 62 63 ncsi_find_package_and_channel(ndp, h->common.channel, NULL, &nc); ··· 74 73 ncm->data[2] = data; 75 74 ncm->data[4] = ntohl(lsc->oem_status); 76 75 76 + had_link = !!(old_data & 0x1); 77 + has_link = !!(data & 0x1); 78 + 77 79 netdev_dbg(ndp->ndev.dev, "NCSI: LSC AEN - channel %u state %s\n", 78 80 nc->id, data & 0x1 ? "up" : "down"); 79 81 ··· 84 80 state = nc->state; 85 81 spin_unlock_irqrestore(&nc->lock, flags); 86 82 87 - if (!((old_data ^ data) & 0x1) || chained) 88 - return 0; 89 - if (!(state == NCSI_CHANNEL_INACTIVE && (data & 0x1)) && 90 - !(state == NCSI_CHANNEL_ACTIVE && !(data & 0x1))) 83 + if (state == NCSI_CHANNEL_INACTIVE) 84 + netdev_warn(ndp->ndev.dev, 85 + "NCSI: Inactive channel %u received AEN!\n", 86 + nc->id); 87 + 88 + if ((had_link == has_link) || chained) 91 89 return 0; 92 90 93 - if (state == NCSI_CHANNEL_ACTIVE) 91 + if (had_link) 94 92 ndp->flags |= NCSI_DEV_RESHUFFLE; 95 - 96 93 ncsi_stop_channel_monitor(nc); 97 94 spin_lock_irqsave(&ndp->lock, flags); 98 95 list_add_tail_rcu(&nc->link, &ndp->channel_queue);
+1 -2
net/ncsi/ncsi-manage.c
··· 916 916 break; 917 917 } 918 918 919 + nc->state = NCSI_CHANNEL_ACTIVE; 919 920 if (nc->modes[NCSI_MODE_LINK].data[2] & 0x1) { 920 921 hot_nc = nc; 921 - nc->state = NCSI_CHANNEL_ACTIVE; 922 922 } else { 923 923 hot_nc = NULL; 924 - nc->state = NCSI_CHANNEL_INACTIVE; 925 924 netdev_dbg(ndp->ndev.dev, 926 925 "NCSI: channel %u link down after config\n", 927 926 nc->id);