cxgbe(4): Save the last reported link parameters and compare them with

the current state to determine whether to generate a link-state change
notification.  This fixes a bug introduced in r321063 that caused the
driver to sometimes skip these notifications.

Reported by:	Jason Eggleston @ LLNW
MFC after:	3 days
Sponsored by:	Chelsio Communications
This commit is contained in:
np 2017-08-12 14:02:19 +00:00
parent f06b4f22e5
commit 2506c0989c
3 changed files with 16 additions and 14 deletions

View File

@ -287,6 +287,7 @@ struct port_info {
uint8_t rx_chan_map; /* rx MPS channel bitmap */
struct link_config link_cfg;
struct link_config old_link_cfg;
struct timeval last_refreshed;
struct port_stats stats;
@ -1124,8 +1125,8 @@ extern device_method_t cxgbe_methods[];
int t4_os_find_pci_capability(struct adapter *, int);
int t4_os_pci_save_state(struct adapter *);
int t4_os_pci_restore_state(struct adapter *);
void t4_os_portmod_changed(struct port_info *, int, int, struct link_config *);
void t4_os_link_changed(struct port_info *, struct link_config *);
void t4_os_portmod_changed(struct port_info *);
void t4_os_link_changed(struct port_info *);
void t4_iterate(void (*)(struct adapter *, void *), void *);
void t4_init_devnames(struct adapter *);
void t4_add_adapter(struct adapter *);

View File

@ -7715,7 +7715,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl)
int i, old_ptype, old_mtype;
int chan = G_FW_PORT_CMD_PORTID(be32_to_cpu(p->op_to_portid));
struct port_info *pi = NULL;
struct link_config *lc, old_lc;
struct link_config *lc, *old_lc;
for_each_port(adap, i) {
pi = adap2pinfo(adap, i);
@ -7724,19 +7724,20 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl)
}
lc = &pi->link_cfg;
old_lc = *lc;
old_lc = &pi->old_link_cfg;
old_ptype = pi->port_type;
old_mtype = pi->mod_type;
handle_port_info(pi, &p->u.info);
if (old_ptype != pi->port_type || old_mtype != pi->mod_type) {
t4_os_portmod_changed(pi, old_ptype, old_mtype,
&old_lc);
t4_os_portmod_changed(pi);
}
if (old_lc.link_ok != lc->link_ok ||
old_lc.speed != lc->speed ||
old_lc.fc != lc->fc) {
t4_os_link_changed(pi, &old_lc);
if (old_lc->link_ok != lc->link_ok ||
old_lc->speed != lc->speed ||
old_lc->fec != lc->fec ||
old_lc->fc != lc->fc) {
t4_os_link_changed(pi);
*old_lc = *lc;
}
} else {
CH_WARN_RATELIMIT(adap, "Unknown firmware reply %d\n", opcode);

View File

@ -4335,7 +4335,8 @@ cxgbe_uninit_synchronized(struct vi_info *vi)
pi->link_cfg.link_ok = 0;
pi->link_cfg.speed = 0;
pi->link_cfg.link_down_rc = 255;
t4_os_link_changed(pi, NULL);
t4_os_link_changed(pi);
pi->old_link_cfg = pi->link_cfg;
return (0);
}
@ -9274,8 +9275,7 @@ t4_os_pci_restore_state(struct adapter *sc)
}
void
t4_os_portmod_changed(struct port_info *pi, int old_ptype, int old_mtype,
struct link_config *old_lc)
t4_os_portmod_changed(struct port_info *pi)
{
struct vi_info *vi;
struct ifnet *ifp;
@ -9312,7 +9312,7 @@ t4_os_portmod_changed(struct port_info *pi, int old_ptype, int old_mtype,
}
void
t4_os_link_changed(struct port_info *pi, struct link_config *old_lc)
t4_os_link_changed(struct port_info *pi)
{
struct vi_info *vi;
struct ifnet *ifp;