Deleted Added
full compact
sfxge_port.c (279267) sfxge_port.c (279351)
1/*-
2 * Copyright (c) 2010-2011 Solarflare Communications, Inc.
3 * All rights reserved.
4 *
5 * This software was developed in part by Philip Paeps under contract for
6 * Solarflare Communications, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2011 Solarflare Communications, Inc.
3 * All rights reserved.
4 *
5 * This software was developed in part by Philip Paeps under contract for
6 * Solarflare Communications, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_port.c 279267 2015-02-25 06:19:23Z arybchik $");
31__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_port.c 279351 2015-02-27 07:39:09Z arybchik $");
32
33#include <sys/types.h>
34#include <sys/limits.h>
35#include <net/ethernet.h>
36#include <net/if_dl.h>
37
38#include "common/efx.h"
39

--- 5 unchanged lines hidden (view full) ---

45 struct sfxge_port *port = &sc->port;
46 efsys_mem_t *esmp = &(port->mac_stats.dma_buf);
47 clock_t now;
48 unsigned int count;
49 int rc;
50
51 SFXGE_PORT_LOCK_ASSERT_OWNED(port);
52
32
33#include <sys/types.h>
34#include <sys/limits.h>
35#include <net/ethernet.h>
36#include <net/if_dl.h>
37
38#include "common/efx.h"
39

--- 5 unchanged lines hidden (view full) ---

45 struct sfxge_port *port = &sc->port;
46 efsys_mem_t *esmp = &(port->mac_stats.dma_buf);
47 clock_t now;
48 unsigned int count;
49 int rc;
50
51 SFXGE_PORT_LOCK_ASSERT_OWNED(port);
52
53 if (port->init_state != SFXGE_PORT_STARTED) {
53 if (__predict_false(port->init_state != SFXGE_PORT_STARTED)) {
54 rc = 0;
55 goto out;
56 }
57
58 now = ticks;
59 if (now - port->mac_stats.update_time < hz) {
60 rc = 0;
61 goto out;

--- 174 unchanged lines hidden (view full) ---

236
237 if (req->newptr != NULL) {
238 if ((error = SYSCTL_IN(req, &fcntl, sizeof(fcntl))) != 0)
239 return (error);
240
241 SFXGE_PORT_LOCK(port);
242
243 if (port->wanted_fc != fcntl) {
54 rc = 0;
55 goto out;
56 }
57
58 now = ticks;
59 if (now - port->mac_stats.update_time < hz) {
60 rc = 0;
61 goto out;

--- 174 unchanged lines hidden (view full) ---

236
237 if (req->newptr != NULL) {
238 if ((error = SYSCTL_IN(req, &fcntl, sizeof(fcntl))) != 0)
239 return (error);
240
241 SFXGE_PORT_LOCK(port);
242
243 if (port->wanted_fc != fcntl) {
244 if (port->init_state == SFXGE_PORT_STARTED)
244 if (__predict_false(port->init_state == SFXGE_PORT_STARTED))
245 error = efx_mac_fcntl_set(sc->enp,
246 port->wanted_fc,
247 B_TRUE);
248 if (error == 0)
249 port->wanted_fc = fcntl;
250 }
251
252 SFXGE_PORT_UNLOCK(port);

--- 14 unchanged lines hidden (view full) ---

267 struct sfxge_softc *sc;
268 struct sfxge_port *port;
269 unsigned int wanted_fc, link_fc;
270
271 sc = arg1;
272 port = &sc->port;
273
274 SFXGE_PORT_LOCK(port);
245 error = efx_mac_fcntl_set(sc->enp,
246 port->wanted_fc,
247 B_TRUE);
248 if (error == 0)
249 port->wanted_fc = fcntl;
250 }
251
252 SFXGE_PORT_UNLOCK(port);

--- 14 unchanged lines hidden (view full) ---

267 struct sfxge_softc *sc;
268 struct sfxge_port *port;
269 unsigned int wanted_fc, link_fc;
270
271 sc = arg1;
272 port = &sc->port;
273
274 SFXGE_PORT_LOCK(port);
275 if (port->init_state == SFXGE_PORT_STARTED && SFXGE_LINK_UP(sc))
275 if (__predict_true(port->init_state == SFXGE_PORT_STARTED) &&
276 SFXGE_LINK_UP(sc))
276 efx_mac_fcntl_get(sc->enp, &wanted_fc, &link_fc);
277 else
278 link_fc = 0;
279 SFXGE_PORT_UNLOCK(port);
280
281 return (SYSCTL_OUT(req, &link_fc, sizeof(link_fc)));
282}
283

--- 38 unchanged lines hidden (view full) ---

322 efx_link_mode_t mode;
323
324 sc = (struct sfxge_softc *)arg;
325 enp = sc->enp;
326 port = &sc->port;
327
328 SFXGE_PORT_LOCK(port);
329
277 efx_mac_fcntl_get(sc->enp, &wanted_fc, &link_fc);
278 else
279 link_fc = 0;
280 SFXGE_PORT_UNLOCK(port);
281
282 return (SYSCTL_OUT(req, &link_fc, sizeof(link_fc)));
283}
284

--- 38 unchanged lines hidden (view full) ---

323 efx_link_mode_t mode;
324
325 sc = (struct sfxge_softc *)arg;
326 enp = sc->enp;
327 port = &sc->port;
328
329 SFXGE_PORT_LOCK(port);
330
330 if (port->init_state != SFXGE_PORT_STARTED)
331 if (__predict_false(port->init_state != SFXGE_PORT_STARTED))
331 goto done;
332
333 /* This may sleep waiting for MCDI completion */
334 (void)efx_port_poll(enp, &mode);
335 sfxge_mac_link_update(sc, mode);
336
337done:
338 SFXGE_PORT_UNLOCK(port);

--- 50 unchanged lines hidden (view full) ---

389 * case of SIOCADDMULTI and SIOCDELMULTI ioctls. ioctl handler
390 * checks IFF_DRV_RUNNING flag which implies port started, but
391 * it is not guaranteed to remain. softc_lock shared lock can't
392 * be held in the case of these ioctls processing, since it
393 * results in failure where kernel complains that non-sleepable
394 * lock is held in sleeping thread. Both problems are repeatable
395 * on LAG with LACP proto bring up.
396 */
332 goto done;
333
334 /* This may sleep waiting for MCDI completion */
335 (void)efx_port_poll(enp, &mode);
336 sfxge_mac_link_update(sc, mode);
337
338done:
339 SFXGE_PORT_UNLOCK(port);

--- 50 unchanged lines hidden (view full) ---

390 * case of SIOCADDMULTI and SIOCDELMULTI ioctls. ioctl handler
391 * checks IFF_DRV_RUNNING flag which implies port started, but
392 * it is not guaranteed to remain. softc_lock shared lock can't
393 * be held in the case of these ioctls processing, since it
394 * results in failure where kernel complains that non-sleepable
395 * lock is held in sleeping thread. Both problems are repeatable
396 * on LAG with LACP proto bring up.
397 */
397 if (port->init_state == SFXGE_PORT_STARTED)
398 if (__predict_true(port->init_state == SFXGE_PORT_STARTED))
398 rc = sfxge_mac_filter_set_locked(sc);
399 else
400 rc = 0;
401 SFXGE_PORT_UNLOCK(port);
402 return (rc);
403}
404
405void

--- 107 unchanged lines hidden (view full) ---

513 struct sfxge_port *port = &sc->port;
514 efsys_mem_t *esmp = &port->phy_stats.dma_buf;
515 clock_t now;
516 unsigned int count;
517 int rc;
518
519 SFXGE_PORT_LOCK_ASSERT_OWNED(port);
520
399 rc = sfxge_mac_filter_set_locked(sc);
400 else
401 rc = 0;
402 SFXGE_PORT_UNLOCK(port);
403 return (rc);
404}
405
406void

--- 107 unchanged lines hidden (view full) ---

514 struct sfxge_port *port = &sc->port;
515 efsys_mem_t *esmp = &port->phy_stats.dma_buf;
516 clock_t now;
517 unsigned int count;
518 int rc;
519
520 SFXGE_PORT_LOCK_ASSERT_OWNED(port);
521
521 if (port->init_state != SFXGE_PORT_STARTED) {
522 if (__predict_false(port->init_state != SFXGE_PORT_STARTED)) {
522 rc = 0;
523 goto out;
524 }
525
526 now = ticks;
527 if (now - port->phy_stats.update_time < hz) {
528 rc = 0;
529 goto out;

--- 334 unchanged lines hidden ---
523 rc = 0;
524 goto out;
525 }
526
527 now = ticks;
528 if (now - port->phy_stats.update_time < hz) {
529 rc = 0;
530 goto out;

--- 334 unchanged lines hidden ---