From owner-svn-src-head@freebsd.org Sat Aug 12 14:02:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49CB6DD859A; Sat, 12 Aug 2017 14:02:21 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25CCD2A9C; Sat, 12 Aug 2017 14:02:21 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CE2KiQ005506; Sat, 12 Aug 2017 14:02:20 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CE2K1O005503; Sat, 12 Aug 2017 14:02:20 GMT (envelope-from np@FreeBSD.org) Message-Id: <201708121402.v7CE2K1O005503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 12 Aug 2017 14:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322425 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 322425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 14:02:21 -0000 Author: np Date: Sat Aug 12 14:02:19 2017 New Revision: 322425 URL: https://svnweb.freebsd.org/changeset/base/322425 Log: 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 Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Sat Aug 12 12:17:38 2017 (r322424) +++ head/sys/dev/cxgbe/adapter.h Sat Aug 12 14:02:19 2017 (r322425) @@ -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 *); Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Sat Aug 12 12:17:38 2017 (r322424) +++ head/sys/dev/cxgbe/common/t4_hw.c Sat Aug 12 14:02:19 2017 (r322425) @@ -7715,7 +7715,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6 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 __be6 } 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); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Aug 12 12:17:38 2017 (r322424) +++ head/sys/dev/cxgbe/t4_main.c Sat Aug 12 14:02:19 2017 (r322425) @@ -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_pt } 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;