Deleted Added
full compact
t4_sge.c (239258) t4_sge.c (239266)
1/*-
2 * Copyright (c) 2011 Chelsio Communications, Inc.
3 * All rights reserved.
4 * Written by: Navdeep Parhar <np@FreeBSD.org>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2011 Chelsio Communications, Inc.
3 * All rights reserved.
4 * Written by: Navdeep Parhar <np@FreeBSD.org>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/cxgbe/t4_sge.c 239258 2012-08-14 21:47:41Z np $");
29__FBSDID("$FreeBSD: head/sys/dev/cxgbe/t4_sge.c 239266 2012-08-15 01:03:13Z np $");
30
31#include "opt_inet.h"
32#include "opt_inet6.h"
33
34#include <sys/types.h>
35#include <sys/mbuf.h>
36#include <sys/socket.h>
37#include <sys/kernel.h>

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

537 idx %= pi->nrxq;
538 iq = &s->rxq[pi->first_rxq + idx].iq;
539#endif
540
541 KASSERT(iq->flags & IQ_INTR, ("%s: EDOOFUS", __func__));
542 return (iq);
543}
544
30
31#include "opt_inet.h"
32#include "opt_inet6.h"
33
34#include <sys/types.h>
35#include <sys/mbuf.h>
36#include <sys/socket.h>
37#include <sys/kernel.h>

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

537 idx %= pi->nrxq;
538 iq = &s->rxq[pi->first_rxq + idx].iq;
539#endif
540
541 KASSERT(iq->flags & IQ_INTR, ("%s: EDOOFUS", __func__));
542 return (iq);
543}
544
545static inline int
546mtu_to_bufsize(int mtu)
547{
548 int bufsize;
549
550 /* large enough for a frame even when VLAN extraction is disabled */
551 bufsize = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + mtu;
552 bufsize = roundup(bufsize + fl_pktshift, fl_pad);
553
554 return (bufsize);
555}
556
545int
546t4_setup_port_queues(struct port_info *pi)
547{
548 int rc = 0, i, j, intr_idx, iqid;
549 struct sge_rxq *rxq;
550 struct sge_txq *txq;
551 struct sge_wrq *ctrlq;
552#ifdef TCP_OFFLOAD
553 struct sge_ofld_rxq *ofld_rxq;
554 struct sge_wrq *ofld_txq;
555 struct sysctl_oid *oid2 = NULL;
556#endif
557 char name[16];
558 struct adapter *sc = pi->adapter;
559 struct sysctl_oid *oid = device_get_sysctl_tree(pi->dev);
560 struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid);
557int
558t4_setup_port_queues(struct port_info *pi)
559{
560 int rc = 0, i, j, intr_idx, iqid;
561 struct sge_rxq *rxq;
562 struct sge_txq *txq;
563 struct sge_wrq *ctrlq;
564#ifdef TCP_OFFLOAD
565 struct sge_ofld_rxq *ofld_rxq;
566 struct sge_wrq *ofld_txq;
567 struct sysctl_oid *oid2 = NULL;
568#endif
569 char name[16];
570 struct adapter *sc = pi->adapter;
571 struct sysctl_oid *oid = device_get_sysctl_tree(pi->dev);
572 struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid);
573 int bufsize = mtu_to_bufsize(pi->ifp->if_mtu);
561
562 oid = SYSCTL_ADD_NODE(&pi->ctx, children, OID_AUTO, "rxq", CTLFLAG_RD,
563 NULL, "rx queues");
564
565#ifdef TCP_OFFLOAD
566 if (is_offload(sc)) {
567 oid2 = SYSCTL_ADD_NODE(&pi->ctx, children, OID_AUTO, "ofld_rxq",
568 CTLFLAG_RD, NULL,

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

582
583 snprintf(name, sizeof(name), "%s rxq%d-iq",
584 device_get_nameunit(pi->dev), i);
585 init_iq(&rxq->iq, sc, pi->tmr_idx, pi->pktc_idx, pi->qsize_rxq,
586 RX_IQ_ESIZE, name);
587
588 snprintf(name, sizeof(name), "%s rxq%d-fl",
589 device_get_nameunit(pi->dev), i);
574
575 oid = SYSCTL_ADD_NODE(&pi->ctx, children, OID_AUTO, "rxq", CTLFLAG_RD,
576 NULL, "rx queues");
577
578#ifdef TCP_OFFLOAD
579 if (is_offload(sc)) {
580 oid2 = SYSCTL_ADD_NODE(&pi->ctx, children, OID_AUTO, "ofld_rxq",
581 CTLFLAG_RD, NULL,

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

595
596 snprintf(name, sizeof(name), "%s rxq%d-iq",
597 device_get_nameunit(pi->dev), i);
598 init_iq(&rxq->iq, sc, pi->tmr_idx, pi->pktc_idx, pi->qsize_rxq,
599 RX_IQ_ESIZE, name);
600
601 snprintf(name, sizeof(name), "%s rxq%d-fl",
602 device_get_nameunit(pi->dev), i);
590 init_fl(&rxq->fl, pi->qsize_rxq / 8, pi->ifp->if_mtu, name);
603 init_fl(&rxq->fl, pi->qsize_rxq / 8, bufsize, name);
591
592 if (sc->flags & INTR_DIRECT
593#ifdef TCP_OFFLOAD
594 || (sc->intr_count > 1 && pi->nrxq >= pi->nofldrxq)
595#endif
596 ) {
597 rxq->iq.flags |= IQ_INTR;
598 rc = alloc_rxq(pi, rxq, intr_idx, i, oid);

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

1446}
1447
1448void
1449t4_update_fl_bufsize(struct ifnet *ifp)
1450{
1451 struct port_info *pi = ifp->if_softc;
1452 struct sge_rxq *rxq;
1453 struct sge_fl *fl;
604
605 if (sc->flags & INTR_DIRECT
606#ifdef TCP_OFFLOAD
607 || (sc->intr_count > 1 && pi->nrxq >= pi->nofldrxq)
608#endif
609 ) {
610 rxq->iq.flags |= IQ_INTR;
611 rc = alloc_rxq(pi, rxq, intr_idx, i, oid);

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

1459}
1460
1461void
1462t4_update_fl_bufsize(struct ifnet *ifp)
1463{
1464 struct port_info *pi = ifp->if_softc;
1465 struct sge_rxq *rxq;
1466 struct sge_fl *fl;
1454 int i, bufsize;
1467 int i, bufsize = mtu_to_bufsize(ifp->if_mtu);
1455
1468
1456 /* large enough for a frame even when VLAN extraction is disabled */
1457 bufsize = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ifp->if_mtu;
1458 bufsize = roundup(bufsize + fl_pktshift, fl_pad);
1459 for_each_rxq(pi, i, rxq) {
1460 fl = &rxq->fl;
1461
1462 FL_LOCK(fl);
1463 set_fl_tag_idx(fl, bufsize);
1464 FL_UNLOCK(fl);
1465 }
1466}

--- 2067 unchanged lines hidden ---
1469 for_each_rxq(pi, i, rxq) {
1470 fl = &rxq->fl;
1471
1472 FL_LOCK(fl);
1473 set_fl_tag_idx(fl, bufsize);
1474 FL_UNLOCK(fl);
1475 }
1476}

--- 2067 unchanged lines hidden ---