aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorVipul Pandya <vipul@chelsio.com>2012-09-25 22:39:40 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-27 17:55:50 -0400
commit13ee15d396da78079918c5be7510ea1847393d4c (patch)
tree421a811a5b491d1295b0aedf564682991fa86690 /drivers/net
parent636f9d371f70f22961fd598fe18380057518ca31 (diff)
cxgb4: Add support for T4 hardwired driver configuration settings
In case if user defined configuration file at /lib/firmware/cxgb4/t4-config.txt location and also factory default configuration file written to FLASH are not present then driver will use hardwired configuration settings. Signed-off-by: Jay Hernandez <jay@chelsio.com> Signed-off-by: Vipul Pandya <vipul@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4.h4
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c390
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c22
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_regs.h56
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h2
5 files changed, 442 insertions, 32 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index 777cbb4f62bb..6827ce338f6a 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -318,6 +318,7 @@ enum { /* adapter flags */
318 USING_MSI = (1 << 1), 318 USING_MSI = (1 << 1),
319 USING_MSIX = (1 << 2), 319 USING_MSIX = (1 << 2),
320 FW_OK = (1 << 4), 320 FW_OK = (1 << 4),
321 RSS_TNLALLLOOKUP = (1 << 5),
321 USING_SOFT_PARAMS = (1 << 6), 322 USING_SOFT_PARAMS = (1 << 6),
322 MASTER_PF = (1 << 7), 323 MASTER_PF = (1 << 7),
323 FW_OFLD_CONN = (1 << 9), 324 FW_OFLD_CONN = (1 << 9),
@@ -677,6 +678,9 @@ static inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd,
677 return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false); 678 return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false);
678} 679}
679 680
681void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
682 unsigned int data_reg, const u32 *vals,
683 unsigned int nregs, unsigned int start_idx);
680void t4_intr_enable(struct adapter *adapter); 684void t4_intr_enable(struct adapter *adapter);
681void t4_intr_disable(struct adapter *adapter); 685void t4_intr_disable(struct adapter *adapter);
682int t4_slow_intr_handler(struct adapter *adapter); 686int t4_slow_intr_handler(struct adapter *adapter);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index cb3e663c30dc..b9cd08df39b3 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -78,28 +78,45 @@
78 */ 78 */
79#define MAX_SGE_TIMERVAL 200U 79#define MAX_SGE_TIMERVAL 200U
80 80
81#ifdef CONFIG_PCI_IOV
82/*
83 * Virtual Function provisioning constants. We need two extra Ingress Queues
84 * with Interrupt capability to serve as the VF's Firmware Event Queue and
85 * Forwarded Interrupt Queue (when using MSI mode) -- neither will have Free
86 * Lists associated with them). For each Ethernet/Control Egress Queue and
87 * for each Free List, we need an Egress Context.
88 */
89enum { 81enum {
82 /*
83 * Physical Function provisioning constants.
84 */
85 PFRES_NVI = 4, /* # of Virtual Interfaces */
86 PFRES_NETHCTRL = 128, /* # of EQs used for ETH or CTRL Qs */
87 PFRES_NIQFLINT = 128, /* # of ingress Qs/w Free List(s)/intr
88 */
89 PFRES_NEQ = 256, /* # of egress queues */
90 PFRES_NIQ = 0, /* # of ingress queues */
91 PFRES_TC = 0, /* PCI-E traffic class */
92 PFRES_NEXACTF = 128, /* # of exact MPS filters */
93
94 PFRES_R_CAPS = FW_CMD_CAP_PF,
95 PFRES_WX_CAPS = FW_CMD_CAP_PF,
96
97#ifdef CONFIG_PCI_IOV
98 /*
99 * Virtual Function provisioning constants. We need two extra Ingress
100 * Queues with Interrupt capability to serve as the VF's Firmware
101 * Event Queue and Forwarded Interrupt Queue (when using MSI mode) --
102 * neither will have Free Lists associated with them). For each
103 * Ethernet/Control Egress Queue and for each Free List, we need an
104 * Egress Context.
105 */
90 VFRES_NPORTS = 1, /* # of "ports" per VF */ 106 VFRES_NPORTS = 1, /* # of "ports" per VF */
91 VFRES_NQSETS = 2, /* # of "Queue Sets" per VF */ 107 VFRES_NQSETS = 2, /* # of "Queue Sets" per VF */
92 108
93 VFRES_NVI = VFRES_NPORTS, /* # of Virtual Interfaces */ 109 VFRES_NVI = VFRES_NPORTS, /* # of Virtual Interfaces */
94 VFRES_NETHCTRL = VFRES_NQSETS, /* # of EQs used for ETH or CTRL Qs */ 110 VFRES_NETHCTRL = VFRES_NQSETS, /* # of EQs used for ETH or CTRL Qs */
95 VFRES_NIQFLINT = VFRES_NQSETS+2,/* # of ingress Qs/w Free List(s)/intr */ 111 VFRES_NIQFLINT = VFRES_NQSETS+2,/* # of ingress Qs/w Free List(s)/intr */
96 VFRES_NIQ = 0, /* # of non-fl/int ingress queues */
97 VFRES_NEQ = VFRES_NQSETS*2, /* # of egress queues */ 112 VFRES_NEQ = VFRES_NQSETS*2, /* # of egress queues */
113 VFRES_NIQ = 0, /* # of non-fl/int ingress queues */
98 VFRES_TC = 0, /* PCI-E traffic class */ 114 VFRES_TC = 0, /* PCI-E traffic class */
99 VFRES_NEXACTF = 16, /* # of exact MPS filters */ 115 VFRES_NEXACTF = 16, /* # of exact MPS filters */
100 116
101 VFRES_R_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF|FW_CMD_CAP_PORT, 117 VFRES_R_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF|FW_CMD_CAP_PORT,
102 VFRES_WX_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF, 118 VFRES_WX_CAPS = FW_CMD_CAP_DMAQ|FW_CMD_CAP_VF,
119#endif
103}; 120};
104 121
105/* 122/*
@@ -146,7 +163,6 @@ static unsigned int pfvfres_pmask(struct adapter *adapter,
146 } 163 }
147 /*NOTREACHED*/ 164 /*NOTREACHED*/
148} 165}
149#endif
150 166
151enum { 167enum {
152 MAX_TXQ_ENTRIES = 16384, 168 MAX_TXQ_ENTRIES = 16384,
@@ -213,6 +229,17 @@ static uint force_init;
213module_param(force_init, uint, 0644); 229module_param(force_init, uint, 0644);
214MODULE_PARM_DESC(force_init, "Forcibly become Master PF and initialize adapter"); 230MODULE_PARM_DESC(force_init, "Forcibly become Master PF and initialize adapter");
215 231
232/*
233 * Normally if the firmware we connect to has Configuration File support, we
234 * use that and only fall back to the old Driver-based initialization if the
235 * Configuration File fails for some reason. If force_old_init is set, then
236 * we'll always use the old Driver-based initialization sequence.
237 */
238static uint force_old_init;
239
240module_param(force_old_init, uint, 0644);
241MODULE_PARM_DESC(force_old_init, "Force old initialization sequence");
242
216static int dflt_msg_enable = DFLT_MSG_ENABLE; 243static int dflt_msg_enable = DFLT_MSG_ENABLE;
217 244
218module_param(dflt_msg_enable, int, 0644); 245module_param(dflt_msg_enable, int, 0644);
@@ -274,6 +301,30 @@ module_param_array(num_vf, uint, NULL, 0644);
274MODULE_PARM_DESC(num_vf, "number of VFs for each of PFs 0-3"); 301MODULE_PARM_DESC(num_vf, "number of VFs for each of PFs 0-3");
275#endif 302#endif
276 303
304/*
305 * The filter TCAM has a fixed portion and a variable portion. The fixed
306 * portion can match on source/destination IP IPv4/IPv6 addresses and TCP/UDP
307 * ports. The variable portion is 36 bits which can include things like Exact
308 * Match MAC Index (9 bits), Ether Type (16 bits), IP Protocol (8 bits),
309 * [Inner] VLAN Tag (17 bits), etc. which, if all were somehow selected, would
310 * far exceed the 36-bit budget for this "compressed" header portion of the
311 * filter. Thus, we have a scarce resource which must be carefully managed.
312 *
313 * By default we set this up to mostly match the set of filter matching
314 * capabilities of T3 but with accommodations for some of T4's more
315 * interesting features:
316 *
317 * { IP Fragment (1), MPS Match Type (3), IP Protocol (8),
318 * [Inner] VLAN (17), Port (3), FCoE (1) }
319 */
320enum {
321 TP_VLAN_PRI_MAP_DEFAULT = HW_TPL_FR_MT_PR_IV_P_FC,
322 TP_VLAN_PRI_MAP_FIRST = FCOE_SHIFT,
323 TP_VLAN_PRI_MAP_LAST = FRAGMENTATION_SHIFT,
324};
325
326static unsigned int tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT;
327
277static struct dentry *cxgb4_debugfs_root; 328static struct dentry *cxgb4_debugfs_root;
278 329
279static LIST_HEAD(adapter_list); 330static LIST_HEAD(adapter_list);
@@ -3410,6 +3461,262 @@ bye:
3410} 3461}
3411 3462
3412/* 3463/*
3464 * Attempt to initialize the adapter via hard-coded, driver supplied
3465 * parameters ...
3466 */
3467static int adap_init0_no_config(struct adapter *adapter, int reset)
3468{
3469 struct sge *s = &adapter->sge;
3470 struct fw_caps_config_cmd caps_cmd;
3471 u32 v;
3472 int i, ret;
3473
3474 /*
3475 * Reset device if necessary
3476 */
3477 if (reset) {
3478 ret = t4_fw_reset(adapter, adapter->mbox,
3479 PIORSTMODE | PIORST);
3480 if (ret < 0)
3481 goto bye;
3482 }
3483
3484 /*
3485 * Get device capabilities and select which we'll be using.
3486 */
3487 memset(&caps_cmd, 0, sizeof(caps_cmd));
3488 caps_cmd.op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
3489 FW_CMD_REQUEST | FW_CMD_READ);
3490 caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd));
3491 ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd),
3492 &caps_cmd);
3493 if (ret < 0)
3494 goto bye;
3495
3496#ifndef CONFIG_CHELSIO_T4_OFFLOAD
3497 /*
3498 * If we're a pure NIC driver then disable all offloading facilities.
3499 * This will allow the firmware to optimize aspects of the hardware
3500 * configuration which will result in improved performance.
3501 */
3502 caps_cmd.ofldcaps = 0;
3503 caps_cmd.iscsicaps = 0;
3504 caps_cmd.rdmacaps = 0;
3505 caps_cmd.fcoecaps = 0;
3506#endif
3507
3508 if (caps_cmd.niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) {
3509 if (!vf_acls)
3510 caps_cmd.niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM);
3511 else
3512 caps_cmd.niccaps = htons(FW_CAPS_CONFIG_NIC_VM);
3513 } else if (vf_acls) {
3514 dev_err(adapter->pdev_dev, "virtualization ACLs not supported");
3515 goto bye;
3516 }
3517 caps_cmd.op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
3518 FW_CMD_REQUEST | FW_CMD_WRITE);
3519 ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd),
3520 NULL);
3521 if (ret < 0)
3522 goto bye;
3523
3524 /*
3525 * Tweak configuration based on system architecture, module
3526 * parameters, etc.
3527 */
3528 ret = adap_init0_tweaks(adapter);
3529 if (ret < 0)
3530 goto bye;
3531
3532 /*
3533 * Select RSS Global Mode we want to use. We use "Basic Virtual"
3534 * mode which maps each Virtual Interface to its own section of
3535 * the RSS Table and we turn on all map and hash enables ...
3536 */
3537 adapter->flags |= RSS_TNLALLLOOKUP;
3538 ret = t4_config_glbl_rss(adapter, adapter->mbox,
3539 FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL,
3540 FW_RSS_GLB_CONFIG_CMD_TNLMAPEN |
3541 FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ |
3542 ((adapter->flags & RSS_TNLALLLOOKUP) ?
3543 FW_RSS_GLB_CONFIG_CMD_TNLALLLKP : 0));
3544 if (ret < 0)
3545 goto bye;
3546
3547 /*
3548 * Set up our own fundamental resource provisioning ...
3549 */
3550 ret = t4_cfg_pfvf(adapter, adapter->mbox, adapter->fn, 0,
3551 PFRES_NEQ, PFRES_NETHCTRL,
3552 PFRES_NIQFLINT, PFRES_NIQ,
3553 PFRES_TC, PFRES_NVI,
3554 FW_PFVF_CMD_CMASK_MASK,
3555 pfvfres_pmask(adapter, adapter->fn, 0),
3556 PFRES_NEXACTF,
3557 PFRES_R_CAPS, PFRES_WX_CAPS);
3558 if (ret < 0)
3559 goto bye;
3560
3561 /*
3562 * Perform low level SGE initialization. We need to do this before we
3563 * send the firmware the INITIALIZE command because that will cause
3564 * any other PF Drivers which are waiting for the Master
3565 * Initialization to proceed forward.
3566 */
3567 for (i = 0; i < SGE_NTIMERS - 1; i++)
3568 s->timer_val[i] = min(intr_holdoff[i], MAX_SGE_TIMERVAL);
3569 s->timer_val[SGE_NTIMERS - 1] = MAX_SGE_TIMERVAL;
3570 s->counter_val[0] = 1;
3571 for (i = 1; i < SGE_NCOUNTERS; i++)
3572 s->counter_val[i] = min(intr_cnt[i - 1],
3573 THRESHOLD_0_GET(THRESHOLD_0_MASK));
3574 t4_sge_init(adapter);
3575
3576#ifdef CONFIG_PCI_IOV
3577 /*
3578 * Provision resource limits for Virtual Functions. We currently
3579 * grant them all the same static resource limits except for the Port
3580 * Access Rights Mask which we're assigning based on the PF. All of
3581 * the static provisioning stuff for both the PF and VF really needs
3582 * to be managed in a persistent manner for each device which the
3583 * firmware controls.
3584 */
3585 {
3586 int pf, vf;
3587
3588 for (pf = 0; pf < ARRAY_SIZE(num_vf); pf++) {
3589 if (num_vf[pf] <= 0)
3590 continue;
3591
3592 /* VF numbering starts at 1! */
3593 for (vf = 1; vf <= num_vf[pf]; vf++) {
3594 ret = t4_cfg_pfvf(adapter, adapter->mbox,
3595 pf, vf,
3596 VFRES_NEQ, VFRES_NETHCTRL,
3597 VFRES_NIQFLINT, VFRES_NIQ,
3598 VFRES_TC, VFRES_NVI,
3599 FW_PFVF_CMD_CMASK_GET(
3600 FW_PFVF_CMD_CMASK_MASK),
3601 pfvfres_pmask(
3602 adapter, pf, vf),
3603 VFRES_NEXACTF,
3604 VFRES_R_CAPS, VFRES_WX_CAPS);
3605 if (ret < 0)
3606 dev_warn(adapter->pdev_dev,
3607 "failed to "\
3608 "provision pf/vf=%d/%d; "
3609 "err=%d\n", pf, vf, ret);
3610 }
3611 }
3612 }
3613#endif
3614
3615 /*
3616 * Set up the default filter mode. Later we'll want to implement this
3617 * via a firmware command, etc. ... This needs to be done before the
3618 * firmare initialization command ... If the selected set of fields
3619 * isn't equal to the default value, we'll need to make sure that the
3620 * field selections will fit in the 36-bit budget.
3621 */
3622 if (tp_vlan_pri_map != TP_VLAN_PRI_MAP_DEFAULT) {
3623 int i, bits = 0;
3624
3625 for (i = TP_VLAN_PRI_MAP_FIRST; i <= TP_VLAN_PRI_MAP_LAST; i++)
3626 switch (tp_vlan_pri_map & (1 << i)) {
3627 case 0:
3628 /* compressed filter field not enabled */
3629 break;
3630 case FCOE_MASK:
3631 bits += 1;
3632 break;
3633 case PORT_MASK:
3634 bits += 3;
3635 break;
3636 case VNIC_ID_MASK:
3637 bits += 17;
3638 break;
3639 case VLAN_MASK:
3640 bits += 17;
3641 break;
3642 case TOS_MASK:
3643 bits += 8;
3644 break;
3645 case PROTOCOL_MASK:
3646 bits += 8;
3647 break;
3648 case ETHERTYPE_MASK:
3649 bits += 16;
3650 break;
3651 case MACMATCH_MASK:
3652 bits += 9;
3653 break;
3654 case MPSHITTYPE_MASK:
3655 bits += 3;
3656 break;
3657 case FRAGMENTATION_MASK:
3658 bits += 1;
3659 break;
3660 }
3661
3662 if (bits > 36) {
3663 dev_err(adapter->pdev_dev,
3664 "tp_vlan_pri_map=%#x needs %d bits > 36;"\
3665 " using %#x\n", tp_vlan_pri_map, bits,
3666 TP_VLAN_PRI_MAP_DEFAULT);
3667 tp_vlan_pri_map = TP_VLAN_PRI_MAP_DEFAULT;
3668 }
3669 }
3670 v = tp_vlan_pri_map;
3671 t4_write_indirect(adapter, TP_PIO_ADDR, TP_PIO_DATA,
3672 &v, 1, TP_VLAN_PRI_MAP);
3673
3674 /*
3675 * We need Five Tuple Lookup mode to be set in TP_GLOBAL_CONFIG order
3676 * to support any of the compressed filter fields above. Newer
3677 * versions of the firmware do this automatically but it doesn't hurt
3678 * to set it here. Meanwhile, we do _not_ need to set Lookup Every
3679 * Packet in TP_INGRESS_CONFIG to support matching non-TCP packets
3680 * since the firmware automatically turns this on and off when we have
3681 * a non-zero number of filters active (since it does have a
3682 * performance impact).
3683 */
3684 if (tp_vlan_pri_map)
3685 t4_set_reg_field(adapter, TP_GLOBAL_CONFIG,
3686 FIVETUPLELOOKUP_MASK,
3687 FIVETUPLELOOKUP_MASK);
3688
3689 /*
3690 * Tweak some settings.
3691 */
3692 t4_write_reg(adapter, TP_SHIFT_CNT, SYNSHIFTMAX(6) |
3693 RXTSHIFTMAXR1(4) | RXTSHIFTMAXR2(15) |
3694 PERSHIFTBACKOFFMAX(8) | PERSHIFTMAX(8) |
3695 KEEPALIVEMAXR1(4) | KEEPALIVEMAXR2(9));
3696
3697 /*
3698 * Get basic stuff going by issuing the Firmware Initialize command.
3699 * Note that this _must_ be after all PFVF commands ...
3700 */
3701 ret = t4_fw_initialize(adapter, adapter->mbox);
3702 if (ret < 0)
3703 goto bye;
3704
3705 /*
3706 * Return successfully!
3707 */
3708 dev_info(adapter->pdev_dev, "Successfully configured using built-in "\
3709 "driver parameters\n");
3710 return 0;
3711
3712 /*
3713 * Something bad happened. Return the error ...
3714 */
3715bye:
3716 return ret;
3717}
3718
3719/*
3413 * Phase 0 of initialization: contact FW, obtain config, perform basic init. 3720 * Phase 0 of initialization: contact FW, obtain config, perform basic init.
3414 */ 3721 */
3415static int adap_init0(struct adapter *adap) 3722static int adap_init0(struct adapter *adap)
@@ -3474,7 +3781,9 @@ static int adap_init0(struct adapter *adap)
3474 goto bye; 3781 goto bye;
3475 3782
3476 /* 3783 /*
3477 * Find out what ports are available to us. 3784 * Find out what ports are available to us. Note that we need to do
3785 * this before calling adap_init0_no_config() since it needs nports
3786 * and portvec ...
3478 */ 3787 */
3479 v = 3788 v =
3480 FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | 3789 FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
@@ -3500,35 +3809,52 @@ static int adap_init0(struct adapter *adap)
3500 } else { 3809 } else {
3501 dev_info(adap->pdev_dev, "Coming up as MASTER: "\ 3810 dev_info(adap->pdev_dev, "Coming up as MASTER: "\
3502 "Initializing adapter\n"); 3811 "Initializing adapter\n");
3503 /*
3504 * Find out whether we're dealing with a version of
3505 * the firmware which has configuration file support.
3506 */
3507 params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
3508 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_CF));
3509 ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 1,
3510 params, val);
3511 3812
3512 /* 3813 /*
3513 * If the firmware doesn't support Configuration 3814 * If the firmware doesn't support Configuration
3514 * Files warn user and exit, 3815 * Files warn user and exit,
3515 */ 3816 */
3516 if (ret < 0) 3817 if (ret < 0)
3517 dev_warn(adap->pdev_dev, "Firmware doesn't support "\ 3818 dev_warn(adap->pdev_dev, "Firmware doesn't support "
3518 "configuration file.\n"); 3819 "configuration file.\n");
3820 if (force_old_init)
3821 ret = adap_init0_no_config(adap, reset);
3519 else { 3822 else {
3520 /* 3823 /*
3521 * The firmware provides us with a memory 3824 * Find out whether we're dealing with a version of
3522 * buffer where we can load a Configuration 3825 * the firmware which has configuration file support.
3523 * File from the host if we want to override
3524 * the Configuration File in flash.
3525 */ 3826 */
3827 params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
3828 FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_CF));
3829 ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 1,
3830 params, val);
3526 3831
3527 ret = adap_init0_config(adap, reset); 3832 /*
3528 if (ret == -ENOENT) { 3833 * If the firmware doesn't support Configuration
3529 dev_info(adap->pdev_dev, 3834 * Files, use the old Driver-based, hard-wired
3530 "No Configuration File present " 3835 * initialization. Otherwise, try using the
3531 "on adapter.\n"); 3836 * Configuration File support and fall back to the
3837 * Driver-based initialization if there's no
3838 * Configuration File found.
3839 */
3840 if (ret < 0)
3841 ret = adap_init0_no_config(adap, reset);
3842 else {
3843 /*
3844 * The firmware provides us with a memory
3845 * buffer where we can load a Configuration
3846 * File from the host if we want to override
3847 * the Configuration File in flash.
3848 */
3849
3850 ret = adap_init0_config(adap, reset);
3851 if (ret == -ENOENT) {
3852 dev_info(adap->pdev_dev,
3853 "No Configuration File present "
3854 "on adapter. Using hard-wired "
3855 "configuration parameters.\n");
3856 ret = adap_init0_no_config(adap, reset);
3857 }
3532 } 3858 }
3533 } 3859 }
3534 if (ret < 0) { 3860 if (ret < 0) {
@@ -3601,14 +3927,14 @@ static int adap_init0(struct adapter *adap)
3601 */ 3927 */
3602 memset(&caps_cmd, 0, sizeof(caps_cmd)); 3928 memset(&caps_cmd, 0, sizeof(caps_cmd));
3603 caps_cmd.op_to_write = htonl(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | 3929 caps_cmd.op_to_write = htonl(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
3604 F_FW_CMD_REQUEST | F_FW_CMD_READ); 3930 FW_CMD_REQUEST | FW_CMD_READ);
3605 caps_cmd.cfvalid_to_len16 = htonl(FW_LEN16(caps_cmd)); 3931 caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd));
3606 ret = t4_wr_mbox(adap, adap->mbox, &caps_cmd, sizeof(caps_cmd), 3932 ret = t4_wr_mbox(adap, adap->mbox, &caps_cmd, sizeof(caps_cmd),
3607 &caps_cmd); 3933 &caps_cmd);
3608 if (ret < 0) 3934 if (ret < 0)
3609 goto bye; 3935 goto bye;
3610 3936
3611 if (caps_cmd.toecaps) { 3937 if (caps_cmd.ofldcaps) {
3612 /* query offload-related parameters */ 3938 /* query offload-related parameters */
3613 params[0] = FW_PARAM_DEV(NTID); 3939 params[0] = FW_PARAM_DEV(NTID);
3614 params[1] = FW_PARAM_PFVF(SERVER_START); 3940 params[1] = FW_PARAM_PFVF(SERVER_START);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 419432d42049..61f002d22013 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -120,6 +120,28 @@ static void t4_read_indirect(struct adapter *adap, unsigned int addr_reg,
120 } 120 }
121} 121}
122 122
123/**
124 * t4_write_indirect - write indirectly addressed registers
125 * @adap: the adapter
126 * @addr_reg: register holding the indirect addresses
127 * @data_reg: register holding the value for the indirect registers
128 * @vals: values to write
129 * @nregs: how many indirect registers to write
130 * @start_idx: address of first indirect register to write
131 *
132 * Writes a sequential block of registers that are accessed indirectly
133 * through an address/data register pair.
134 */
135void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
136 unsigned int data_reg, const u32 *vals,
137 unsigned int nregs, unsigned int start_idx)
138{
139 while (nregs--) {
140 t4_write_reg(adap, addr_reg, start_idx++);
141 t4_write_reg(adap, data_reg, *vals++);
142 }
143}
144
123/* 145/*
124 * Get the reply to a mailbox command and store it in @rpl in big-endian order. 146 * Get the reply to a mailbox command and store it in @rpl in big-endian order.
125 */ 147 */
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
index 779b23f8f591..732c6da2636f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
@@ -491,6 +491,13 @@
491#define VLANEXTENABLE_MASK 0x0000f000U 491#define VLANEXTENABLE_MASK 0x0000f000U
492#define VLANEXTENABLE_SHIFT 12 492#define VLANEXTENABLE_SHIFT 12
493 493
494#define TP_GLOBAL_CONFIG 0x7d08
495#define FIVETUPLELOOKUP_SHIFT 17
496#define FIVETUPLELOOKUP_MASK 0x00060000U
497#define FIVETUPLELOOKUP(x) ((x) << FIVETUPLELOOKUP_SHIFT)
498#define FIVETUPLELOOKUP_GET(x) (((x) & FIVETUPLELOOKUP_MASK) >> \
499 FIVETUPLELOOKUP_SHIFT)
500
494#define TP_PARA_REG2 0x7d68 501#define TP_PARA_REG2 0x7d68
495#define MAXRXDATA_MASK 0xffff0000U 502#define MAXRXDATA_MASK 0xffff0000U
496#define MAXRXDATA_SHIFT 16 503#define MAXRXDATA_SHIFT 16
@@ -506,6 +513,41 @@
506 (((x) & DELAYEDACKRESOLUTION_MASK) >> DELAYEDACKRESOLUTION_SHIFT) 513 (((x) & DELAYEDACKRESOLUTION_MASK) >> DELAYEDACKRESOLUTION_SHIFT)
507 514
508#define TP_SHIFT_CNT 0x7dc0 515#define TP_SHIFT_CNT 0x7dc0
516#define SYNSHIFTMAX_SHIFT 24
517#define SYNSHIFTMAX_MASK 0xff000000U
518#define SYNSHIFTMAX(x) ((x) << SYNSHIFTMAX_SHIFT)
519#define SYNSHIFTMAX_GET(x) (((x) & SYNSHIFTMAX_MASK) >> \
520 SYNSHIFTMAX_SHIFT)
521#define RXTSHIFTMAXR1_SHIFT 20
522#define RXTSHIFTMAXR1_MASK 0x00f00000U
523#define RXTSHIFTMAXR1(x) ((x) << RXTSHIFTMAXR1_SHIFT)
524#define RXTSHIFTMAXR1_GET(x) (((x) & RXTSHIFTMAXR1_MASK) >> \
525 RXTSHIFTMAXR1_SHIFT)
526#define RXTSHIFTMAXR2_SHIFT 16
527#define RXTSHIFTMAXR2_MASK 0x000f0000U
528#define RXTSHIFTMAXR2(x) ((x) << RXTSHIFTMAXR2_SHIFT)
529#define RXTSHIFTMAXR2_GET(x) (((x) & RXTSHIFTMAXR2_MASK) >> \
530 RXTSHIFTMAXR2_SHIFT)
531#define PERSHIFTBACKOFFMAX_SHIFT 12
532#define PERSHIFTBACKOFFMAX_MASK 0x0000f000U
533#define PERSHIFTBACKOFFMAX(x) ((x) << PERSHIFTBACKOFFMAX_SHIFT)
534#define PERSHIFTBACKOFFMAX_GET(x) (((x) & PERSHIFTBACKOFFMAX_MASK) >> \
535 PERSHIFTBACKOFFMAX_SHIFT)
536#define PERSHIFTMAX_SHIFT 8
537#define PERSHIFTMAX_MASK 0x00000f00U
538#define PERSHIFTMAX(x) ((x) << PERSHIFTMAX_SHIFT)
539#define PERSHIFTMAX_GET(x) (((x) & PERSHIFTMAX_MASK) >> \
540 PERSHIFTMAX_SHIFT)
541#define KEEPALIVEMAXR1_SHIFT 4
542#define KEEPALIVEMAXR1_MASK 0x000000f0U
543#define KEEPALIVEMAXR1(x) ((x) << KEEPALIVEMAXR1_SHIFT)
544#define KEEPALIVEMAXR1_GET(x) (((x) & KEEPALIVEMAXR1_MASK) >> \
545 KEEPALIVEMAXR1_SHIFT)
546#define KEEPALIVEMAXR2_SHIFT 0
547#define KEEPALIVEMAXR2_MASK 0x0000000fU
548#define KEEPALIVEMAXR2(x) ((x) << KEEPALIVEMAXR2_SHIFT)
549#define KEEPALIVEMAXR2_GET(x) (((x) & KEEPALIVEMAXR2_MASK) >> \
550 KEEPALIVEMAXR2_SHIFT)
509 551
510#define TP_CCTRL_TABLE 0x7ddc 552#define TP_CCTRL_TABLE 0x7ddc
511#define TP_MTU_TABLE 0x7de4 553#define TP_MTU_TABLE 0x7de4
@@ -539,6 +581,20 @@
539#define TP_INT_CAUSE 0x7e74 581#define TP_INT_CAUSE 0x7e74
540#define FLMTXFLSTEMPTY 0x40000000U 582#define FLMTXFLSTEMPTY 0x40000000U
541 583
584#define TP_VLAN_PRI_MAP 0x140
585#define FRAGMENTATION_SHIFT 9
586#define FRAGMENTATION_MASK 0x00000200U
587#define MPSHITTYPE_MASK 0x00000100U
588#define MACMATCH_MASK 0x00000080U
589#define ETHERTYPE_MASK 0x00000040U
590#define PROTOCOL_MASK 0x00000020U
591#define TOS_MASK 0x00000010U
592#define VLAN_MASK 0x00000008U
593#define VNIC_ID_MASK 0x00000004U
594#define PORT_MASK 0x00000002U
595#define FCOE_SHIFT 0
596#define FCOE_MASK 0x00000001U
597
542#define TP_INGRESS_CONFIG 0x141 598#define TP_INGRESS_CONFIG 0x141
543#define VNIC 0x00000800U 599#define VNIC 0x00000800U
544#define CSUM_HAS_PSEUDO_HDR 0x00000400U 600#define CSUM_HAS_PSEUDO_HDR 0x00000400U
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
index 3f85019106fa..b1d556128f84 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
@@ -79,6 +79,8 @@ struct fw_wr_hdr {
79#define FW_WR_FLOWID(x) ((x) << 8) 79#define FW_WR_FLOWID(x) ((x) << 8)
80#define FW_WR_LEN16(x) ((x) << 0) 80#define FW_WR_LEN16(x) ((x) << 0)
81 81
82#define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
83
82struct fw_ulptx_wr { 84struct fw_ulptx_wr {
83 __be32 op_to_compl; 85 __be32 op_to_compl;
84 __be32 flowid_len16; 86 __be32 flowid_len16;