Skip to content

Commit 4da44fd

Browse files
committed
Merge branch 'cxgb4-next'
Hariprasad Shenai says: ==================== Free VI, flush sge ec and some other misc. fixes This patch series adds the following. Free VI interface during remove, flush SGE ec routine, rename t4_link_start to t4_link_l1cfg since it only does l1 configuration, set mac addr from when we can't contact firmware for debug purpose, set pcie completion timeout and use fw interface to access TP_PIO_XXX registers This patch series has been created against net-next tree and includes patches on cxgb4 driver. We have included all the maintainers of respective drivers. Kindly review the change and let us know in case of any review comments. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents bb62f79 + c1e9af0 commit 4da44fd

File tree

5 files changed

+257
-51
lines changed

5 files changed

+257
-51
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4.h

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,19 @@
4646
#include <linux/spinlock.h>
4747
#include <linux/timer.h>
4848
#include <linux/vmalloc.h>
49+
#include <linux/etherdevice.h>
4950
#include <asm/io.h>
5051
#include "cxgb4_uld.h"
5152

5253
#define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)
5354

5455
enum {
55-
MAX_NPORTS = 4, /* max # of ports */
56-
SERNUM_LEN = 24, /* Serial # length */
57-
EC_LEN = 16, /* E/C length */
58-
ID_LEN = 16, /* ID length */
59-
PN_LEN = 16, /* Part Number length */
56+
MAX_NPORTS = 4, /* max # of ports */
57+
SERNUM_LEN = 24, /* Serial # length */
58+
EC_LEN = 16, /* E/C length */
59+
ID_LEN = 16, /* ID length */
60+
PN_LEN = 16, /* Part Number length */
61+
MACADDR_LEN = 12, /* MAC Address length */
6062
};
6163

6264
enum {
@@ -280,6 +282,7 @@ struct vpd_params {
280282
u8 sn[SERNUM_LEN + 1];
281283
u8 id[ID_LEN + 1];
282284
u8 pn[PN_LEN + 1];
285+
u8 na[MACADDR_LEN + 1];
283286
};
284287

285288
struct pci_params {
@@ -945,6 +948,22 @@ static inline void t4_write_reg64(struct adapter *adap, u32 reg_addr, u64 val)
945948
writeq(val, adap->regs + reg_addr);
946949
}
947950

951+
/**
952+
* t4_set_hw_addr - store a port's MAC address in SW
953+
* @adapter: the adapter
954+
* @port_idx: the port index
955+
* @hw_addr: the Ethernet address
956+
*
957+
* Store the Ethernet address of the given port in SW. Called by the common
958+
* code when it retrieves a port's Ethernet address from EEPROM.
959+
*/
960+
static inline void t4_set_hw_addr(struct adapter *adapter, int port_idx,
961+
u8 hw_addr[])
962+
{
963+
ether_addr_copy(adapter->port[port_idx]->dev_addr, hw_addr);
964+
ether_addr_copy(adapter->port[port_idx]->perm_addr, hw_addr);
965+
}
966+
948967
/**
949968
* netdev2pinfo - return the port_info structure associated with a net_device
950969
* @dev: the netdev
@@ -1229,7 +1248,7 @@ void t4_intr_disable(struct adapter *adapter);
12291248
int t4_slow_intr_handler(struct adapter *adapter);
12301249

12311250
int t4_wait_dev_ready(void __iomem *regs);
1232-
int t4_link_start(struct adapter *adap, unsigned int mbox, unsigned int port,
1251+
int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port,
12331252
struct link_config *lc);
12341253
int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port);
12351254

@@ -1251,7 +1270,8 @@ unsigned int t4_get_regs_len(struct adapter *adapter);
12511270
void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size);
12521271

12531272
int t4_seeprom_wp(struct adapter *adapter, bool enable);
1254-
int get_vpd_params(struct adapter *adapter, struct vpd_params *p);
1273+
int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p);
1274+
int t4_get_vpd_params(struct adapter *adapter, struct vpd_params *p);
12551275
int t4_read_flash(struct adapter *adapter, unsigned int addr,
12561276
unsigned int nwords, u32 *data, int byte_oriented);
12571277
int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size);
@@ -1378,6 +1398,9 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf,
13781398
int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
13791399
unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac,
13801400
unsigned int *rss_size);
1401+
int t4_free_vi(struct adapter *adap, unsigned int mbox,
1402+
unsigned int pf, unsigned int vf,
1403+
unsigned int viid);
13811404
int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
13821405
int mtu, int promisc, int all_multi, int bcast, int vlanex,
13831406
bool sleep_ok);
@@ -1407,6 +1430,7 @@ int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
14071430
unsigned int vf, unsigned int eqid);
14081431
int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
14091432
unsigned int vf, unsigned int eqid);
1433+
int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox);
14101434
int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl);
14111435
void t4_db_full(struct adapter *adapter);
14121436
void t4_db_dropped(struct adapter *adapter);

drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
646646
lc->autoneg = cmd->autoneg;
647647

648648
if (netif_running(dev))
649-
return t4_link_start(p->adapter, p->adapter->pf, p->tx_chan,
649+
return t4_link_l1cfg(p->adapter, p->adapter->pf, p->tx_chan,
650650
lc);
651651
return 0;
652652
}
@@ -679,7 +679,7 @@ static int set_pauseparam(struct net_device *dev,
679679
if (epause->tx_pause)
680680
lc->requested_fc |= PAUSE_TX;
681681
if (netif_running(dev))
682-
return t4_link_start(p->adapter, p->adapter->pf, p->tx_chan,
682+
return t4_link_l1cfg(p->adapter, p->adapter->pf, p->tx_chan,
683683
lc);
684684
return 0;
685685
}

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static int link_start(struct net_device *dev)
481481
}
482482
}
483483
if (ret == 0)
484-
ret = t4_link_start(pi->adapter, mb, pi->tx_chan,
484+
ret = t4_link_l1cfg(pi->adapter, mb, pi->tx_chan,
485485
&pi->link_cfg);
486486
if (ret == 0) {
487487
local_bh_disable();
@@ -2007,11 +2007,8 @@ EXPORT_SYMBOL(cxgb4_iscsi_init);
20072007
int cxgb4_flush_eq_cache(struct net_device *dev)
20082008
{
20092009
struct adapter *adap = netdev2adap(dev);
2010-
int ret;
20112010

2012-
ret = t4_fwaddrspace_write(adap, adap->mbox,
2013-
0xe1000000 + SGE_CTXT_CMD_A, 0x20000000);
2014-
return ret;
2011+
return t4_sge_ctxt_flush(adap, adap->mbox);
20152012
}
20162013
EXPORT_SYMBOL(cxgb4_flush_eq_cache);
20172014

@@ -3715,7 +3712,7 @@ static int adap_init0(struct adapter *adap)
37153712
* the firmware. On the other hand, we need these fairly early on
37163713
* so we do this right after getting ahold of the firmware.
37173714
*/
3718-
ret = get_vpd_params(adap, &adap->params.vpd);
3715+
ret = t4_get_vpd_params(adap, &adap->params.vpd);
37193716
if (ret < 0)
37203717
goto bye;
37213718

@@ -4071,8 +4068,8 @@ static int adap_init0(struct adapter *adap)
40714068
adap->params.b_wnd);
40724069
}
40734070
t4_init_sge_params(adap);
4074-
t4_init_tp_params(adap);
40754071
adap->flags |= FW_OK;
4072+
t4_init_tp_params(adap);
40764073
return 0;
40774074

40784075
/*
@@ -4538,6 +4535,11 @@ static void free_some_resources(struct adapter *adapter)
45384535

45394536
for_each_port(adapter, i)
45404537
if (adapter->port[i]) {
4538+
struct port_info *pi = adap2pinfo(adapter, i);
4539+
4540+
if (pi->viid != 0)
4541+
t4_free_vi(adapter, adapter->mbox, adapter->pf,
4542+
0, pi->viid);
45414543
kfree(adap2pinfo(adapter, i)->rss);
45424544
free_netdev(adapter->port[i]);
45434545
}
@@ -4733,10 +4735,25 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
47334735
err = t4_port_init(adapter, func, func, 0);
47344736
if (err)
47354737
goto out_free_dev;
4738+
} else if (adapter->params.nports == 1) {
4739+
/* If we don't have a connection to the firmware -- possibly
4740+
* because of an error -- grab the raw VPD parameters so we
4741+
* can set the proper MAC Address on the debug network
4742+
* interface that we've created.
4743+
*/
4744+
u8 hw_addr[ETH_ALEN];
4745+
u8 *na = adapter->params.vpd.na;
4746+
4747+
err = t4_get_raw_vpd_params(adapter, &adapter->params.vpd);
4748+
if (!err) {
4749+
for (i = 0; i < ETH_ALEN; i++)
4750+
hw_addr[i] = (hex2val(na[2 * i + 0]) * 16 +
4751+
hex2val(na[2 * i + 1]));
4752+
t4_set_hw_addr(adapter, 0, hw_addr);
4753+
}
47364754
}
47374755

4738-
/*
4739-
* Configure queues and allocate tables now, they can be needed as
4756+
/* Configure queues and allocate tables now, they can be needed as
47404757
* soon as the first register_netdev completes.
47414758
*/
47424759
cfg_queues(adapter);

0 commit comments

Comments
 (0)