* [PATCH 0/3] Chelsio driver namespace cleanups @ 2010-10-15 22:43 Stephen Hemminger 2010-10-15 22:43 ` [PATCH 1/3] cxgb3: function namespace cleanup Stephen Hemminger ` (2 more replies) 0 siblings, 3 replies; 20+ messages in thread From: Stephen Hemminger @ 2010-10-15 22:43 UTC (permalink / raw) To: Divy Le Ray, David S. Miller, Casey Leedom, Dimitris Michailidis; +Cc: netdev Cleanup functions and dead code in Chelsio drivers ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/3] cxgb3: function namespace cleanup 2010-10-15 22:43 [PATCH 0/3] Chelsio driver namespace cleanups Stephen Hemminger @ 2010-10-15 22:43 ` Stephen Hemminger 2010-10-19 1:14 ` Divy Le Ray 2010-10-15 22:43 ` [PATCH 2/3] cxgb4: " Stephen Hemminger 2010-10-15 22:43 ` [PATCH 3/3] cxgb4vf: function namespace cleanup Stephen Hemminger 2 siblings, 1 reply; 20+ messages in thread From: Stephen Hemminger @ 2010-10-15 22:43 UTC (permalink / raw) To: Divy Le Ray, David S. Miller, Casey Leedom, Dimitris Michailidis; +Cc: netdev [-- Attachment #1: cxgb3-local.patch --] [-- Type: text/plain, Size: 18193 bytes --] Make local functions static. Remove functions that are defined and never used. Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> --- drivers/net/cxgb3/adapter.h | 3 drivers/net/cxgb3/common.h | 18 --- drivers/net/cxgb3/cxgb3_defs.h | 3 drivers/net/cxgb3/cxgb3_offload.c | 9 + drivers/net/cxgb3/mc5.c | 38 ------- drivers/net/cxgb3/sge.c | 39 ------- drivers/net/cxgb3/t3_hw.c | 197 ++------------------------------------ 7 files changed, 18 insertions(+), 289 deletions(-) --- a/drivers/net/cxgb3/common.h 2010-10-15 11:13:45.087851624 -0700 +++ b/drivers/net/cxgb3/common.h 2010-10-15 11:24:41.425577576 -0700 @@ -673,7 +673,6 @@ void t3_xgm_intr_enable(struct adapter * void t3_xgm_intr_disable(struct adapter *adapter, int idx); void t3_port_intr_enable(struct adapter *adapter, int idx); void t3_port_intr_disable(struct adapter *adapter, int idx); -void t3_port_intr_clear(struct adapter *adapter, int idx); int t3_slow_intr_handler(struct adapter *adapter); int t3_phy_intr_handler(struct adapter *adapter); @@ -689,14 +688,10 @@ int t3_check_tpsram_version(struct adapt int t3_check_tpsram(struct adapter *adapter, const u8 *tp_ram, unsigned int size); int t3_set_proto_sram(struct adapter *adap, const u8 *data); -int t3_read_flash(struct adapter *adapter, unsigned int addr, - unsigned int nwords, u32 *data, int byte_oriented); int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size); int t3_get_fw_version(struct adapter *adapter, u32 *vers); int t3_check_fw_version(struct adapter *adapter); int t3_init_hw(struct adapter *adapter, u32 fw_params); -void mac_prep(struct cmac *mac, struct adapter *adapter, int index); -void early_hw_init(struct adapter *adapter, const struct adapter_info *ai); int t3_reset_adapter(struct adapter *adapter); int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, int reset); @@ -706,8 +701,6 @@ void t3_fatal_err(struct adapter *adapte void t3_set_vlan_accel(struct adapter *adapter, unsigned int ports, int on); void t3_config_rss(struct adapter *adapter, unsigned int rss_config, const u8 * cpus, const u16 *rspq); -int t3_read_rss(struct adapter *adapter, u8 * lkup, u16 *map); -int t3_mps_set_active_ports(struct adapter *adap, unsigned int port_mask); int t3_cim_ctl_blk_read(struct adapter *adap, unsigned int addr, unsigned int n, unsigned int *valp); int t3_mc7_bd_read(struct mc7 *mc7, unsigned int start, unsigned int n, @@ -731,19 +724,12 @@ void t3_mc5_prep(struct adapter *adapter int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, unsigned int nroutes); void t3_mc5_intr_handler(struct mc5 *mc5); -int t3_read_mc5_range(const struct mc5 *mc5, unsigned int start, unsigned int n, - u32 *buf); -int t3_tp_set_coalescing_size(struct adapter *adap, unsigned int size, int psh); -void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size); void t3_tp_set_offload_mode(struct adapter *adap, int enable); void t3_tp_get_mib_stats(struct adapter *adap, struct tp_mib_stats *tps); void t3_load_mtus(struct adapter *adap, unsigned short mtus[NMTUS], unsigned short alpha[NCCTRL_WIN], unsigned short beta[NCCTRL_WIN], unsigned short mtu_cap); -void t3_read_hw_mtus(struct adapter *adap, unsigned short mtus[NMTUS]); -void t3_get_cong_cntl_tab(struct adapter *adap, - unsigned short incr[NMTUS][NCCTRL_WIN]); void t3_config_trace_filter(struct adapter *adapter, const struct trace_params *tp, int filter_index, int invert, int enable); @@ -769,10 +755,6 @@ int t3_sge_enable_ecntxt(struct adapter int t3_sge_disable_fl(struct adapter *adapter, unsigned int id); int t3_sge_disable_rspcntxt(struct adapter *adapter, unsigned int id); int t3_sge_disable_cqcntxt(struct adapter *adapter, unsigned int id); -int t3_sge_read_ecntxt(struct adapter *adapter, unsigned int id, u32 data[4]); -int t3_sge_read_fl(struct adapter *adapter, unsigned int id, u32 data[4]); -int t3_sge_read_cq(struct adapter *adapter, unsigned int id, u32 data[4]); -int t3_sge_read_rspq(struct adapter *adapter, unsigned int id, u32 data[4]); int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned int id, unsigned int op, unsigned int credits); --- a/drivers/net/cxgb3/cxgb3_defs.h 2010-10-15 11:17:35.345242098 -0700 +++ b/drivers/net/cxgb3/cxgb3_defs.h 2010-10-15 11:28:15.233294035 -0700 @@ -43,8 +43,6 @@ void *cxgb_alloc_mem(unsigned long size); void cxgb_free_mem(void *addr); -void cxgb_neigh_update(struct neighbour *neigh); -void cxgb_redirect(struct dst_entry *old, struct dst_entry *new); /* * Map an ATID or STID to their entries in the corresponding TID tables. @@ -111,7 +109,6 @@ static inline struct t3c_tid_entry *look return &e->t3c_tid; } -int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n); int attach_t3cdev(struct t3cdev *dev); void detach_t3cdev(struct t3cdev *dev); #endif --- a/drivers/net/cxgb3/cxgb3_offload.c 2010-10-15 11:12:57.413912920 -0700 +++ b/drivers/net/cxgb3/cxgb3_offload.c 2010-10-15 11:28:04.412900334 -0700 @@ -60,6 +60,9 @@ static LIST_HEAD(adapter_list); static const unsigned int MAX_ATIDS = 64 * 1024; static const unsigned int ATID_BASE = 0x10000; +static void cxgb_neigh_update(struct neighbour *neigh); +static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new); + static inline int offload_activated(struct t3cdev *tdev) { const struct adapter *adapter = tdev2adap(tdev); @@ -1015,7 +1018,7 @@ EXPORT_SYMBOL(t3_register_cpl_handler); /* * T3CDEV's receive method. */ -int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n) +static int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n) { while (n--) { struct sk_buff *skb = *skbs++; @@ -1070,7 +1073,7 @@ static int is_offloading(struct net_devi return 0; } -void cxgb_neigh_update(struct neighbour *neigh) +static void cxgb_neigh_update(struct neighbour *neigh) { struct net_device *dev = neigh->dev; @@ -1104,7 +1107,7 @@ static void set_l2t_ix(struct t3cdev *td tdev->send(tdev, skb); } -void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) +static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) { struct net_device *olddev, *newdev; struct tid_info *ti; --- a/drivers/net/cxgb3/mc5.c 2010-10-15 11:12:49.041572658 -0700 +++ b/drivers/net/cxgb3/mc5.c 2010-10-15 11:15:00.746932380 -0700 @@ -374,44 +374,6 @@ int t3_mc5_init(struct mc5 *mc5, unsigne return err; } -/* - * read_mc5_range - dump a part of the memory managed by MC5 - * @mc5: the MC5 handle - * @start: the start address for the dump - * @n: number of 72-bit words to read - * @buf: result buffer - * - * Read n 72-bit words from MC5 memory from the given start location. - */ -int t3_read_mc5_range(const struct mc5 *mc5, unsigned int start, - unsigned int n, u32 *buf) -{ - u32 read_cmd; - int err = 0; - struct adapter *adap = mc5->adapter; - - if (mc5->part_type == IDT75P52100) - read_cmd = IDT_CMD_READ; - else if (mc5->part_type == IDT75N43102) - read_cmd = IDT4_CMD_READ; - else - return -EINVAL; - - mc5_dbgi_mode_enable(mc5); - - while (n--) { - t3_write_reg(adap, A_MC5_DB_DBGI_REQ_ADDR0, start++); - if (mc5_cmd_write(adap, read_cmd)) { - err = -EIO; - break; - } - dbgi_rd_rsp3(adap, buf + 2, buf + 1, buf); - buf += 3; - } - - mc5_dbgi_mode_disable(mc5); - return 0; -} #define MC5_INT_FATAL (F_PARITYERR | F_REQQPARERR | F_DISPQPARERR) --- a/drivers/net/cxgb3/t3_hw.c 2010-10-15 11:13:07.590326587 -0700 +++ b/drivers/net/cxgb3/t3_hw.c 2010-10-15 11:26:01.636456578 -0700 @@ -34,6 +34,8 @@ #include "sge_defs.h" #include "firmware_exports.h" +static void t3_port_intr_clear(struct adapter *adapter, int idx); + /** * t3_wait_op_done_val - wait until an operation is completed * @adapter: the adapter performing the operation @@ -840,8 +842,8 @@ static int flash_wait_op(struct adapter * (i.e., big-endian), otherwise as 32-bit words in the platform's * natural endianess. */ -int t3_read_flash(struct adapter *adapter, unsigned int addr, - unsigned int nwords, u32 *data, int byte_oriented) +static int t3_read_flash(struct adapter *adapter, unsigned int addr, + unsigned int nwords, u32 *data, int byte_oriented) { int ret; @@ -2111,7 +2113,7 @@ void t3_port_intr_disable(struct adapter * Clear port-specific (i.e., MAC and PHY) interrupts for the given * adapter port. */ -void t3_port_intr_clear(struct adapter *adapter, int idx) +static void t3_port_intr_clear(struct adapter *adapter, int idx) { struct cphy *phy = &adap2pinfo(adapter, idx)->phy; @@ -2484,98 +2486,6 @@ int t3_sge_cqcntxt_op(struct adapter *ad } /** - * t3_sge_read_context - read an SGE context - * @type: the context type - * @adapter: the adapter - * @id: the context id - * @data: holds the retrieved context - * - * Read an SGE egress context. The caller is responsible for ensuring - * only one context operation occurs at a time. - */ -static int t3_sge_read_context(unsigned int type, struct adapter *adapter, - unsigned int id, u32 data[4]) -{ - if (t3_read_reg(adapter, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY) - return -EBUSY; - - t3_write_reg(adapter, A_SG_CONTEXT_CMD, - V_CONTEXT_CMD_OPCODE(0) | type | V_CONTEXT(id)); - if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0, - SG_CONTEXT_CMD_ATTEMPTS, 1)) - return -EIO; - data[0] = t3_read_reg(adapter, A_SG_CONTEXT_DATA0); - data[1] = t3_read_reg(adapter, A_SG_CONTEXT_DATA1); - data[2] = t3_read_reg(adapter, A_SG_CONTEXT_DATA2); - data[3] = t3_read_reg(adapter, A_SG_CONTEXT_DATA3); - return 0; -} - -/** - * t3_sge_read_ecntxt - read an SGE egress context - * @adapter: the adapter - * @id: the context id - * @data: holds the retrieved context - * - * Read an SGE egress context. The caller is responsible for ensuring - * only one context operation occurs at a time. - */ -int t3_sge_read_ecntxt(struct adapter *adapter, unsigned int id, u32 data[4]) -{ - if (id >= 65536) - return -EINVAL; - return t3_sge_read_context(F_EGRESS, adapter, id, data); -} - -/** - * t3_sge_read_cq - read an SGE CQ context - * @adapter: the adapter - * @id: the context id - * @data: holds the retrieved context - * - * Read an SGE CQ context. The caller is responsible for ensuring - * only one context operation occurs at a time. - */ -int t3_sge_read_cq(struct adapter *adapter, unsigned int id, u32 data[4]) -{ - if (id >= 65536) - return -EINVAL; - return t3_sge_read_context(F_CQ, adapter, id, data); -} - -/** - * t3_sge_read_fl - read an SGE free-list context - * @adapter: the adapter - * @id: the context id - * @data: holds the retrieved context - * - * Read an SGE free-list context. The caller is responsible for ensuring - * only one context operation occurs at a time. - */ -int t3_sge_read_fl(struct adapter *adapter, unsigned int id, u32 data[4]) -{ - if (id >= SGE_QSETS * 2) - return -EINVAL; - return t3_sge_read_context(F_FREELIST, adapter, id, data); -} - -/** - * t3_sge_read_rspq - read an SGE response queue context - * @adapter: the adapter - * @id: the context id - * @data: holds the retrieved context - * - * Read an SGE response queue context. The caller is responsible for - * ensuring only one context operation occurs at a time. - */ -int t3_sge_read_rspq(struct adapter *adapter, unsigned int id, u32 data[4]) -{ - if (id >= SGE_QSETS) - return -EINVAL; - return t3_sge_read_context(F_RESPONSEQ, adapter, id, data); -} - -/** * t3_config_rss - configure Rx packet steering * @adapter: the adapter * @rss_config: RSS settings (written to TP_RSS_CONFIG) @@ -2616,42 +2526,6 @@ void t3_config_rss(struct adapter *adapt } /** - * t3_read_rss - read the contents of the RSS tables - * @adapter: the adapter - * @lkup: holds the contents of the RSS lookup table - * @map: holds the contents of the RSS map table - * - * Reads the contents of the receive packet steering tables. - */ -int t3_read_rss(struct adapter *adapter, u8 * lkup, u16 *map) -{ - int i; - u32 val; - - if (lkup) - for (i = 0; i < RSS_TABLE_SIZE; ++i) { - t3_write_reg(adapter, A_TP_RSS_LKP_TABLE, - 0xffff0000 | i); - val = t3_read_reg(adapter, A_TP_RSS_LKP_TABLE); - if (!(val & 0x80000000)) - return -EAGAIN; - *lkup++ = val; - *lkup++ = (val >> 8); - } - - if (map) - for (i = 0; i < RSS_TABLE_SIZE; ++i) { - t3_write_reg(adapter, A_TP_RSS_MAP_TABLE, - 0xffff0000 | i); - val = t3_read_reg(adapter, A_TP_RSS_MAP_TABLE); - if (!(val & 0x80000000)) - return -EAGAIN; - *map++ = val; - } - return 0; -} - -/** * t3_tp_set_offload_mode - put TP in NIC/offload mode * @adap: the adapter * @enable: 1 to select offload mode, 0 for regular NIC @@ -2868,7 +2742,8 @@ static void tp_set_timers(struct adapter * * Set the receive coalescing size and PSH bit handling. */ -int t3_tp_set_coalescing_size(struct adapter *adap, unsigned int size, int psh) +static int t3_tp_set_coalescing_size(struct adapter *adap, + unsigned int size, int psh) { u32 val; @@ -2898,7 +2773,7 @@ int t3_tp_set_coalescing_size(struct ada * Set TP's max receive size. This is the limit that applies when * receive coalescing is disabled. */ -void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size) +static void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size) { t3_write_reg(adap, A_TP_PARA_REG7, V_PMMAXXFERLEN0(size) | V_PMMAXXFERLEN1(size)); @@ -3018,48 +2893,6 @@ void t3_load_mtus(struct adapter *adap, } /** - * t3_read_hw_mtus - returns the values in the HW MTU table - * @adap: the adapter - * @mtus: where to store the HW MTU values - * - * Reads the HW MTU table. - */ -void t3_read_hw_mtus(struct adapter *adap, unsigned short mtus[NMTUS]) -{ - int i; - - for (i = 0; i < NMTUS; ++i) { - unsigned int val; - - t3_write_reg(adap, A_TP_MTU_TABLE, 0xff000000 | i); - val = t3_read_reg(adap, A_TP_MTU_TABLE); - mtus[i] = val & 0x3fff; - } -} - -/** - * t3_get_cong_cntl_tab - reads the congestion control table - * @adap: the adapter - * @incr: where to store the alpha values - * - * Reads the additive increments programmed into the HW congestion - * control table. - */ -void t3_get_cong_cntl_tab(struct adapter *adap, - unsigned short incr[NMTUS][NCCTRL_WIN]) -{ - unsigned int mtu, w; - - for (mtu = 0; mtu < NMTUS; ++mtu) - for (w = 0; w < NCCTRL_WIN; ++w) { - t3_write_reg(adap, A_TP_CCTRL_TABLE, - 0xffff0000 | (mtu << 5) | w); - incr[mtu][w] = t3_read_reg(adap, A_TP_CCTRL_TABLE) & - 0x1fff; - } -} - -/** * t3_tp_get_mib_stats - read TP's MIB counters * @adap: the adapter * @tps: holds the returned counter values @@ -3223,15 +3056,6 @@ static int tp_init(struct adapter *adap, return busy; } -int t3_mps_set_active_ports(struct adapter *adap, unsigned int port_mask) -{ - if (port_mask & ~((1 << adap->params.nports) - 1)) - return -EINVAL; - t3_set_reg_field(adap, A_MPS_CFG, F_PORT1ACTIVE | F_PORT0ACTIVE, - port_mask << S_PORT0ACTIVE); - return 0; -} - /* * Perform the bits of HW initialization that are dependent on the Tx * channels being used. @@ -3687,7 +3511,7 @@ static void mc7_prep(struct adapter *ada mc7->width = G_WIDTH(cfg); } -void mac_prep(struct cmac *mac, struct adapter *adapter, int index) +static void mac_prep(struct cmac *mac, struct adapter *adapter, int index) { u16 devid; @@ -3707,7 +3531,8 @@ void mac_prep(struct cmac *mac, struct a } } -void early_hw_init(struct adapter *adapter, const struct adapter_info *ai) +static void early_hw_init(struct adapter *adapter, + const struct adapter_info *ai) { u32 val = V_PORTSPEED(is_10G(adapter) ? 3 : 2); --- a/drivers/net/cxgb3/adapter.h 2010-10-15 11:29:31.428075569 -0700 +++ b/drivers/net/cxgb3/adapter.h 2010-10-15 11:29:46.280619610 -0700 @@ -336,9 +336,6 @@ int t3_sge_alloc_qset(struct adapter *ad int irq_vec_idx, const struct qset_params *p, int ntxq, struct net_device *dev, struct netdev_queue *netdevq); -int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx, - unsigned char *data); -irqreturn_t t3_sge_intr_msix(int irq, void *cookie); extern struct workqueue_struct *cxgb3_wq; int t3_get_edc_fw(struct cphy *phy, int edc_idx, int size); --- a/drivers/net/cxgb3/sge.c 2010-10-15 11:13:02.710128196 -0700 +++ b/drivers/net/cxgb3/sge.c 2010-10-15 11:30:17.141751919 -0700 @@ -2554,7 +2554,7 @@ static inline int handle_responses(struc * The MSI-X interrupt handler for an SGE response queue for the non-NAPI case * (i.e., response queue serviced in hard interrupt). */ -irqreturn_t t3_sge_intr_msix(int irq, void *cookie) +static irqreturn_t t3_sge_intr_msix(int irq, void *cookie) { struct sge_qset *qs = cookie; struct adapter *adap = qs->adap; @@ -3320,40 +3320,3 @@ void t3_sge_prep(struct adapter *adap, s spin_lock_init(&adap->sge.reg_lock); } - -/** - * t3_get_desc - dump an SGE descriptor for debugging purposes - * @qs: the queue set - * @qnum: identifies the specific queue (0..2: Tx, 3:response, 4..5: Rx) - * @idx: the descriptor index in the queue - * @data: where to dump the descriptor contents - * - * Dumps the contents of a HW descriptor of an SGE queue. Returns the - * size of the descriptor. - */ -int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx, - unsigned char *data) -{ - if (qnum >= 6) - return -EINVAL; - - if (qnum < 3) { - if (!qs->txq[qnum].desc || idx >= qs->txq[qnum].size) - return -EINVAL; - memcpy(data, &qs->txq[qnum].desc[idx], sizeof(struct tx_desc)); - return sizeof(struct tx_desc); - } - - if (qnum == 3) { - if (!qs->rspq.desc || idx >= qs->rspq.size) - return -EINVAL; - memcpy(data, &qs->rspq.desc[idx], sizeof(struct rsp_desc)); - return sizeof(struct rsp_desc); - } - - qnum -= 4; - if (!qs->fl[qnum].desc || idx >= qs->fl[qnum].size) - return -EINVAL; - memcpy(data, &qs->fl[qnum].desc[idx], sizeof(struct rx_desc)); - return sizeof(struct rx_desc); -} ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] cxgb3: function namespace cleanup 2010-10-15 22:43 ` [PATCH 1/3] cxgb3: function namespace cleanup Stephen Hemminger @ 2010-10-19 1:14 ` Divy Le Ray 2010-10-21 14:19 ` David Miller 0 siblings, 1 reply; 20+ messages in thread From: Divy Le Ray @ 2010-10-19 1:14 UTC (permalink / raw) To: Stephen Hemminger Cc: David S. Miller, Casey Leedom, Dimitrios Michailidis, netdev On 10/15/2010 03:43 PM, Stephen Hemminger wrote: > Make local functions static. Remove functions that are > defined and never used. Compile tested only. > > Signed-off-by: Stephen Hemminger<shemminger@vyatta.com> Acked-by: Divy Le Ray <divy@chelsio.com> > --- > drivers/net/cxgb3/adapter.h | 3 > drivers/net/cxgb3/common.h | 18 --- > drivers/net/cxgb3/cxgb3_defs.h | 3 > drivers/net/cxgb3/cxgb3_offload.c | 9 + > drivers/net/cxgb3/mc5.c | 38 ------- > drivers/net/cxgb3/sge.c | 39 ------- > drivers/net/cxgb3/t3_hw.c | 197 ++------------------------------------ > 7 files changed, 18 insertions(+), 289 deletions(-) > > --- a/drivers/net/cxgb3/common.h 2010-10-15 11:13:45.087851624 -0700 > +++ b/drivers/net/cxgb3/common.h 2010-10-15 11:24:41.425577576 -0700 > @@ -673,7 +673,6 @@ void t3_xgm_intr_enable(struct adapter * > void t3_xgm_intr_disable(struct adapter *adapter, int idx); > void t3_port_intr_enable(struct adapter *adapter, int idx); > void t3_port_intr_disable(struct adapter *adapter, int idx); > -void t3_port_intr_clear(struct adapter *adapter, int idx); > int t3_slow_intr_handler(struct adapter *adapter); > int t3_phy_intr_handler(struct adapter *adapter); > > @@ -689,14 +688,10 @@ int t3_check_tpsram_version(struct adapt > int t3_check_tpsram(struct adapter *adapter, const u8 *tp_ram, > unsigned int size); > int t3_set_proto_sram(struct adapter *adap, const u8 *data); > -int t3_read_flash(struct adapter *adapter, unsigned int addr, > - unsigned int nwords, u32 *data, int byte_oriented); > int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size); > int t3_get_fw_version(struct adapter *adapter, u32 *vers); > int t3_check_fw_version(struct adapter *adapter); > int t3_init_hw(struct adapter *adapter, u32 fw_params); > -void mac_prep(struct cmac *mac, struct adapter *adapter, int index); > -void early_hw_init(struct adapter *adapter, const struct adapter_info *ai); > int t3_reset_adapter(struct adapter *adapter); > int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, > int reset); > @@ -706,8 +701,6 @@ void t3_fatal_err(struct adapter *adapte > void t3_set_vlan_accel(struct adapter *adapter, unsigned int ports, int on); > void t3_config_rss(struct adapter *adapter, unsigned int rss_config, > const u8 * cpus, const u16 *rspq); > -int t3_read_rss(struct adapter *adapter, u8 * lkup, u16 *map); > -int t3_mps_set_active_ports(struct adapter *adap, unsigned int port_mask); > int t3_cim_ctl_blk_read(struct adapter *adap, unsigned int addr, > unsigned int n, unsigned int *valp); > int t3_mc7_bd_read(struct mc7 *mc7, unsigned int start, unsigned int n, > @@ -731,19 +724,12 @@ void t3_mc5_prep(struct adapter *adapter > int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, > unsigned int nroutes); > void t3_mc5_intr_handler(struct mc5 *mc5); > -int t3_read_mc5_range(const struct mc5 *mc5, unsigned int start, unsigned int n, > - u32 *buf); > > -int t3_tp_set_coalescing_size(struct adapter *adap, unsigned int size, int psh); > -void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size); > void t3_tp_set_offload_mode(struct adapter *adap, int enable); > void t3_tp_get_mib_stats(struct adapter *adap, struct tp_mib_stats *tps); > void t3_load_mtus(struct adapter *adap, unsigned short mtus[NMTUS], > unsigned short alpha[NCCTRL_WIN], > unsigned short beta[NCCTRL_WIN], unsigned short mtu_cap); > -void t3_read_hw_mtus(struct adapter *adap, unsigned short mtus[NMTUS]); > -void t3_get_cong_cntl_tab(struct adapter *adap, > - unsigned short incr[NMTUS][NCCTRL_WIN]); > void t3_config_trace_filter(struct adapter *adapter, > const struct trace_params *tp, int filter_index, > int invert, int enable); > @@ -769,10 +755,6 @@ int t3_sge_enable_ecntxt(struct adapter > int t3_sge_disable_fl(struct adapter *adapter, unsigned int id); > int t3_sge_disable_rspcntxt(struct adapter *adapter, unsigned int id); > int t3_sge_disable_cqcntxt(struct adapter *adapter, unsigned int id); > -int t3_sge_read_ecntxt(struct adapter *adapter, unsigned int id, u32 data[4]); > -int t3_sge_read_fl(struct adapter *adapter, unsigned int id, u32 data[4]); > -int t3_sge_read_cq(struct adapter *adapter, unsigned int id, u32 data[4]); > -int t3_sge_read_rspq(struct adapter *adapter, unsigned int id, u32 data[4]); > int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned int id, unsigned int op, > unsigned int credits); > > --- a/drivers/net/cxgb3/cxgb3_defs.h 2010-10-15 11:17:35.345242098 -0700 > +++ b/drivers/net/cxgb3/cxgb3_defs.h 2010-10-15 11:28:15.233294035 -0700 > @@ -43,8 +43,6 @@ > > void *cxgb_alloc_mem(unsigned long size); > void cxgb_free_mem(void *addr); > -void cxgb_neigh_update(struct neighbour *neigh); > -void cxgb_redirect(struct dst_entry *old, struct dst_entry *new); > > /* > * Map an ATID or STID to their entries in the corresponding TID tables. > @@ -111,7 +109,6 @@ static inline struct t3c_tid_entry *look > return&e->t3c_tid; > } > > -int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n); > int attach_t3cdev(struct t3cdev *dev); > void detach_t3cdev(struct t3cdev *dev); > #endif > --- a/drivers/net/cxgb3/cxgb3_offload.c 2010-10-15 11:12:57.413912920 -0700 > +++ b/drivers/net/cxgb3/cxgb3_offload.c 2010-10-15 11:28:04.412900334 -0700 > @@ -60,6 +60,9 @@ static LIST_HEAD(adapter_list); > static const unsigned int MAX_ATIDS = 64 * 1024; > static const unsigned int ATID_BASE = 0x10000; > > +static void cxgb_neigh_update(struct neighbour *neigh); > +static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new); > + > static inline int offload_activated(struct t3cdev *tdev) > { > const struct adapter *adapter = tdev2adap(tdev); > @@ -1015,7 +1018,7 @@ EXPORT_SYMBOL(t3_register_cpl_handler); > /* > * T3CDEV's receive method. > */ > -int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n) > +static int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n) > { > while (n--) { > struct sk_buff *skb = *skbs++; > @@ -1070,7 +1073,7 @@ static int is_offloading(struct net_devi > return 0; > } > > -void cxgb_neigh_update(struct neighbour *neigh) > +static void cxgb_neigh_update(struct neighbour *neigh) > { > struct net_device *dev = neigh->dev; > > @@ -1104,7 +1107,7 @@ static void set_l2t_ix(struct t3cdev *td > tdev->send(tdev, skb); > } > > -void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) > +static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) > { > struct net_device *olddev, *newdev; > struct tid_info *ti; > --- a/drivers/net/cxgb3/mc5.c 2010-10-15 11:12:49.041572658 -0700 > +++ b/drivers/net/cxgb3/mc5.c 2010-10-15 11:15:00.746932380 -0700 > @@ -374,44 +374,6 @@ int t3_mc5_init(struct mc5 *mc5, unsigne > return err; > } > > -/* > - * read_mc5_range - dump a part of the memory managed by MC5 > - * @mc5: the MC5 handle > - * @start: the start address for the dump > - * @n: number of 72-bit words to read > - * @buf: result buffer > - * > - * Read n 72-bit words from MC5 memory from the given start location. > - */ > -int t3_read_mc5_range(const struct mc5 *mc5, unsigned int start, > - unsigned int n, u32 *buf) > -{ > - u32 read_cmd; > - int err = 0; > - struct adapter *adap = mc5->adapter; > - > - if (mc5->part_type == IDT75P52100) > - read_cmd = IDT_CMD_READ; > - else if (mc5->part_type == IDT75N43102) > - read_cmd = IDT4_CMD_READ; > - else > - return -EINVAL; > - > - mc5_dbgi_mode_enable(mc5); > - > - while (n--) { > - t3_write_reg(adap, A_MC5_DB_DBGI_REQ_ADDR0, start++); > - if (mc5_cmd_write(adap, read_cmd)) { > - err = -EIO; > - break; > - } > - dbgi_rd_rsp3(adap, buf + 2, buf + 1, buf); > - buf += 3; > - } > - > - mc5_dbgi_mode_disable(mc5); > - return 0; > -} > > #define MC5_INT_FATAL (F_PARITYERR | F_REQQPARERR | F_DISPQPARERR) > > --- a/drivers/net/cxgb3/t3_hw.c 2010-10-15 11:13:07.590326587 -0700 > +++ b/drivers/net/cxgb3/t3_hw.c 2010-10-15 11:26:01.636456578 -0700 > @@ -34,6 +34,8 @@ > #include "sge_defs.h" > #include "firmware_exports.h" > > +static void t3_port_intr_clear(struct adapter *adapter, int idx); > + > /** > * t3_wait_op_done_val - wait until an operation is completed > * @adapter: the adapter performing the operation > @@ -840,8 +842,8 @@ static int flash_wait_op(struct adapter > * (i.e., big-endian), otherwise as 32-bit words in the platform's > * natural endianess. > */ > -int t3_read_flash(struct adapter *adapter, unsigned int addr, > - unsigned int nwords, u32 *data, int byte_oriented) > +static int t3_read_flash(struct adapter *adapter, unsigned int addr, > + unsigned int nwords, u32 *data, int byte_oriented) > { > int ret; > > @@ -2111,7 +2113,7 @@ void t3_port_intr_disable(struct adapter > * Clear port-specific (i.e., MAC and PHY) interrupts for the given > * adapter port. > */ > -void t3_port_intr_clear(struct adapter *adapter, int idx) > +static void t3_port_intr_clear(struct adapter *adapter, int idx) > { > struct cphy *phy =&adap2pinfo(adapter, idx)->phy; > > @@ -2484,98 +2486,6 @@ int t3_sge_cqcntxt_op(struct adapter *ad > } > > /** > - * t3_sge_read_context - read an SGE context > - * @type: the context type > - * @adapter: the adapter > - * @id: the context id > - * @data: holds the retrieved context > - * > - * Read an SGE egress context. The caller is responsible for ensuring > - * only one context operation occurs at a time. > - */ > -static int t3_sge_read_context(unsigned int type, struct adapter *adapter, > - unsigned int id, u32 data[4]) > -{ > - if (t3_read_reg(adapter, A_SG_CONTEXT_CMD)& F_CONTEXT_CMD_BUSY) > - return -EBUSY; > - > - t3_write_reg(adapter, A_SG_CONTEXT_CMD, > - V_CONTEXT_CMD_OPCODE(0) | type | V_CONTEXT(id)); > - if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0, > - SG_CONTEXT_CMD_ATTEMPTS, 1)) > - return -EIO; > - data[0] = t3_read_reg(adapter, A_SG_CONTEXT_DATA0); > - data[1] = t3_read_reg(adapter, A_SG_CONTEXT_DATA1); > - data[2] = t3_read_reg(adapter, A_SG_CONTEXT_DATA2); > - data[3] = t3_read_reg(adapter, A_SG_CONTEXT_DATA3); > - return 0; > -} > - > -/** > - * t3_sge_read_ecntxt - read an SGE egress context > - * @adapter: the adapter > - * @id: the context id > - * @data: holds the retrieved context > - * > - * Read an SGE egress context. The caller is responsible for ensuring > - * only one context operation occurs at a time. > - */ > -int t3_sge_read_ecntxt(struct adapter *adapter, unsigned int id, u32 data[4]) > -{ > - if (id>= 65536) > - return -EINVAL; > - return t3_sge_read_context(F_EGRESS, adapter, id, data); > -} > - > -/** > - * t3_sge_read_cq - read an SGE CQ context > - * @adapter: the adapter > - * @id: the context id > - * @data: holds the retrieved context > - * > - * Read an SGE CQ context. The caller is responsible for ensuring > - * only one context operation occurs at a time. > - */ > -int t3_sge_read_cq(struct adapter *adapter, unsigned int id, u32 data[4]) > -{ > - if (id>= 65536) > - return -EINVAL; > - return t3_sge_read_context(F_CQ, adapter, id, data); > -} > - > -/** > - * t3_sge_read_fl - read an SGE free-list context > - * @adapter: the adapter > - * @id: the context id > - * @data: holds the retrieved context > - * > - * Read an SGE free-list context. The caller is responsible for ensuring > - * only one context operation occurs at a time. > - */ > -int t3_sge_read_fl(struct adapter *adapter, unsigned int id, u32 data[4]) > -{ > - if (id>= SGE_QSETS * 2) > - return -EINVAL; > - return t3_sge_read_context(F_FREELIST, adapter, id, data); > -} > - > -/** > - * t3_sge_read_rspq - read an SGE response queue context > - * @adapter: the adapter > - * @id: the context id > - * @data: holds the retrieved context > - * > - * Read an SGE response queue context. The caller is responsible for > - * ensuring only one context operation occurs at a time. > - */ > -int t3_sge_read_rspq(struct adapter *adapter, unsigned int id, u32 data[4]) > -{ > - if (id>= SGE_QSETS) > - return -EINVAL; > - return t3_sge_read_context(F_RESPONSEQ, adapter, id, data); > -} > - > -/** > * t3_config_rss - configure Rx packet steering > * @adapter: the adapter > * @rss_config: RSS settings (written to TP_RSS_CONFIG) > @@ -2616,42 +2526,6 @@ void t3_config_rss(struct adapter *adapt > } > > /** > - * t3_read_rss - read the contents of the RSS tables > - * @adapter: the adapter > - * @lkup: holds the contents of the RSS lookup table > - * @map: holds the contents of the RSS map table > - * > - * Reads the contents of the receive packet steering tables. > - */ > -int t3_read_rss(struct adapter *adapter, u8 * lkup, u16 *map) > -{ > - int i; > - u32 val; > - > - if (lkup) > - for (i = 0; i< RSS_TABLE_SIZE; ++i) { > - t3_write_reg(adapter, A_TP_RSS_LKP_TABLE, > - 0xffff0000 | i); > - val = t3_read_reg(adapter, A_TP_RSS_LKP_TABLE); > - if (!(val& 0x80000000)) > - return -EAGAIN; > - *lkup++ = val; > - *lkup++ = (val>> 8); > - } > - > - if (map) > - for (i = 0; i< RSS_TABLE_SIZE; ++i) { > - t3_write_reg(adapter, A_TP_RSS_MAP_TABLE, > - 0xffff0000 | i); > - val = t3_read_reg(adapter, A_TP_RSS_MAP_TABLE); > - if (!(val& 0x80000000)) > - return -EAGAIN; > - *map++ = val; > - } > - return 0; > -} > - > -/** > * t3_tp_set_offload_mode - put TP in NIC/offload mode > * @adap: the adapter > * @enable: 1 to select offload mode, 0 for regular NIC > @@ -2868,7 +2742,8 @@ static void tp_set_timers(struct adapter > * > * Set the receive coalescing size and PSH bit handling. > */ > -int t3_tp_set_coalescing_size(struct adapter *adap, unsigned int size, int psh) > +static int t3_tp_set_coalescing_size(struct adapter *adap, > + unsigned int size, int psh) > { > u32 val; > > @@ -2898,7 +2773,7 @@ int t3_tp_set_coalescing_size(struct ada > * Set TP's max receive size. This is the limit that applies when > * receive coalescing is disabled. > */ > -void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size) > +static void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size) > { > t3_write_reg(adap, A_TP_PARA_REG7, > V_PMMAXXFERLEN0(size) | V_PMMAXXFERLEN1(size)); > @@ -3018,48 +2893,6 @@ void t3_load_mtus(struct adapter *adap, > } > > /** > - * t3_read_hw_mtus - returns the values in the HW MTU table > - * @adap: the adapter > - * @mtus: where to store the HW MTU values > - * > - * Reads the HW MTU table. > - */ > -void t3_read_hw_mtus(struct adapter *adap, unsigned short mtus[NMTUS]) > -{ > - int i; > - > - for (i = 0; i< NMTUS; ++i) { > - unsigned int val; > - > - t3_write_reg(adap, A_TP_MTU_TABLE, 0xff000000 | i); > - val = t3_read_reg(adap, A_TP_MTU_TABLE); > - mtus[i] = val& 0x3fff; > - } > -} > - > -/** > - * t3_get_cong_cntl_tab - reads the congestion control table > - * @adap: the adapter > - * @incr: where to store the alpha values > - * > - * Reads the additive increments programmed into the HW congestion > - * control table. > - */ > -void t3_get_cong_cntl_tab(struct adapter *adap, > - unsigned short incr[NMTUS][NCCTRL_WIN]) > -{ > - unsigned int mtu, w; > - > - for (mtu = 0; mtu< NMTUS; ++mtu) > - for (w = 0; w< NCCTRL_WIN; ++w) { > - t3_write_reg(adap, A_TP_CCTRL_TABLE, > - 0xffff0000 | (mtu<< 5) | w); > - incr[mtu][w] = t3_read_reg(adap, A_TP_CCTRL_TABLE)& > - 0x1fff; > - } > -} > - > -/** > * t3_tp_get_mib_stats - read TP's MIB counters > * @adap: the adapter > * @tps: holds the returned counter values > @@ -3223,15 +3056,6 @@ static int tp_init(struct adapter *adap, > return busy; > } > > -int t3_mps_set_active_ports(struct adapter *adap, unsigned int port_mask) > -{ > - if (port_mask& ~((1<< adap->params.nports) - 1)) > - return -EINVAL; > - t3_set_reg_field(adap, A_MPS_CFG, F_PORT1ACTIVE | F_PORT0ACTIVE, > - port_mask<< S_PORT0ACTIVE); > - return 0; > -} > - > /* > * Perform the bits of HW initialization that are dependent on the Tx > * channels being used. > @@ -3687,7 +3511,7 @@ static void mc7_prep(struct adapter *ada > mc7->width = G_WIDTH(cfg); > } > > -void mac_prep(struct cmac *mac, struct adapter *adapter, int index) > +static void mac_prep(struct cmac *mac, struct adapter *adapter, int index) > { > u16 devid; > > @@ -3707,7 +3531,8 @@ void mac_prep(struct cmac *mac, struct a > } > } > > -void early_hw_init(struct adapter *adapter, const struct adapter_info *ai) > +static void early_hw_init(struct adapter *adapter, > + const struct adapter_info *ai) > { > u32 val = V_PORTSPEED(is_10G(adapter) ? 3 : 2); > > --- a/drivers/net/cxgb3/adapter.h 2010-10-15 11:29:31.428075569 -0700 > +++ b/drivers/net/cxgb3/adapter.h 2010-10-15 11:29:46.280619610 -0700 > @@ -336,9 +336,6 @@ int t3_sge_alloc_qset(struct adapter *ad > int irq_vec_idx, const struct qset_params *p, > int ntxq, struct net_device *dev, > struct netdev_queue *netdevq); > -int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx, > - unsigned char *data); > -irqreturn_t t3_sge_intr_msix(int irq, void *cookie); > extern struct workqueue_struct *cxgb3_wq; > > int t3_get_edc_fw(struct cphy *phy, int edc_idx, int size); > --- a/drivers/net/cxgb3/sge.c 2010-10-15 11:13:02.710128196 -0700 > +++ b/drivers/net/cxgb3/sge.c 2010-10-15 11:30:17.141751919 -0700 > @@ -2554,7 +2554,7 @@ static inline int handle_responses(struc > * The MSI-X interrupt handler for an SGE response queue for the non-NAPI case > * (i.e., response queue serviced in hard interrupt). > */ > -irqreturn_t t3_sge_intr_msix(int irq, void *cookie) > +static irqreturn_t t3_sge_intr_msix(int irq, void *cookie) > { > struct sge_qset *qs = cookie; > struct adapter *adap = qs->adap; > @@ -3320,40 +3320,3 @@ void t3_sge_prep(struct adapter *adap, s > > spin_lock_init(&adap->sge.reg_lock); > } > - > -/** > - * t3_get_desc - dump an SGE descriptor for debugging purposes > - * @qs: the queue set > - * @qnum: identifies the specific queue (0..2: Tx, 3:response, 4..5: Rx) > - * @idx: the descriptor index in the queue > - * @data: where to dump the descriptor contents > - * > - * Dumps the contents of a HW descriptor of an SGE queue. Returns the > - * size of the descriptor. > - */ > -int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx, > - unsigned char *data) > -{ > - if (qnum>= 6) > - return -EINVAL; > - > - if (qnum< 3) { > - if (!qs->txq[qnum].desc || idx>= qs->txq[qnum].size) > - return -EINVAL; > - memcpy(data,&qs->txq[qnum].desc[idx], sizeof(struct tx_desc)); > - return sizeof(struct tx_desc); > - } > - > - if (qnum == 3) { > - if (!qs->rspq.desc || idx>= qs->rspq.size) > - return -EINVAL; > - memcpy(data,&qs->rspq.desc[idx], sizeof(struct rsp_desc)); > - return sizeof(struct rsp_desc); > - } > - > - qnum -= 4; > - if (!qs->fl[qnum].desc || idx>= qs->fl[qnum].size) > - return -EINVAL; > - memcpy(data,&qs->fl[qnum].desc[idx], sizeof(struct rx_desc)); > - return sizeof(struct rx_desc); > -} > > > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] cxgb3: function namespace cleanup 2010-10-19 1:14 ` Divy Le Ray @ 2010-10-21 14:19 ` David Miller 0 siblings, 0 replies; 20+ messages in thread From: David Miller @ 2010-10-21 14:19 UTC (permalink / raw) To: divy; +Cc: shemminger, leedom, dm, netdev From: Divy Le Ray <divy@chelsio.com> Date: Mon, 18 Oct 2010 18:14:52 -0700 > On 10/15/2010 03:43 PM, Stephen Hemminger wrote: >> Make local functions static. Remove functions that are >> defined and never used. Compile tested only. >> >> Signed-off-by: Stephen Hemminger<shemminger@vyatta.com> > > Acked-by: Divy Le Ray <divy@chelsio.com> Applied. ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/3] cxgb4: function namespace cleanup 2010-10-15 22:43 [PATCH 0/3] Chelsio driver namespace cleanups Stephen Hemminger 2010-10-15 22:43 ` [PATCH 1/3] cxgb3: function namespace cleanup Stephen Hemminger @ 2010-10-15 22:43 ` Stephen Hemminger 2010-10-15 23:29 ` Joe Perches ` (2 more replies) 2010-10-15 22:43 ` [PATCH 3/3] cxgb4vf: function namespace cleanup Stephen Hemminger 2 siblings, 3 replies; 20+ messages in thread From: Stephen Hemminger @ 2010-10-15 22:43 UTC (permalink / raw) To: Divy Le Ray, David S. Miller, Casey Leedom, Dimitris Michailidis; +Cc: netdev [-- Attachment #1: cxgb4-local.patch --] [-- Type: text/plain, Size: 26898 bytes --] Make functions only used in one file local. Remove lots of dead code. Most surprising is the function cxgb4_iscsi_init which is defined but never called! Compile tested only Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> --- drivers/net/cxgb4/cxgb4.h | 17 - drivers/net/cxgb4/cxgb4_main.c | 91 --------- drivers/net/cxgb4/cxgb4_uld.h | 12 - drivers/net/cxgb4/l2t.c | 34 --- drivers/net/cxgb4/l2t.h | 3 drivers/net/cxgb4/sge.c | 5 drivers/net/cxgb4/t4_hw.c | 394 ----------------------------------------- 7 files changed, 5 insertions(+), 551 deletions(-) --- a/drivers/net/cxgb4/cxgb4_main.c 2010-10-15 11:31:38.980766681 -0700 +++ b/drivers/net/cxgb4/cxgb4_main.c 2010-10-15 11:40:13.976943486 -0700 @@ -880,7 +880,7 @@ void *t4_alloc_mem(size_t size) /* * Free memory allocated through alloc_mem(). */ -void t4_free_mem(void *addr) +static void t4_free_mem(void *addr) { if (is_vmalloc_addr(addr)) vfree(addr); @@ -2206,8 +2206,8 @@ static void mk_tid_release(struct sk_buf * Queue a TID release request and if necessary schedule a work queue to * process it. */ -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, - unsigned int tid) +static void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, + unsigned int tid) { void **p = &t->tid_tab[tid]; struct adapter *adap = container_of(t, struct adapter, tids); @@ -2222,7 +2222,6 @@ void cxgb4_queue_tid_release(struct tid_ } spin_unlock_bh(&adap->tid_release_lock); } -EXPORT_SYMBOL(cxgb4_queue_tid_release); /* * Process the list of pending TID release requests. @@ -2355,48 +2354,6 @@ int cxgb4_create_server(const struct net EXPORT_SYMBOL(cxgb4_create_server); /** - * cxgb4_create_server6 - create an IPv6 server - * @dev: the device - * @stid: the server TID - * @sip: local IPv6 address to bind server to - * @sport: the server's TCP port - * @queue: queue to direct messages from this server to - * - * Create an IPv6 server for the given port and address. - * Returns <0 on error and one of the %NET_XMIT_* values on success. - */ -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, - const struct in6_addr *sip, __be16 sport, - unsigned int queue) -{ - unsigned int chan; - struct sk_buff *skb; - struct adapter *adap; - struct cpl_pass_open_req6 *req; - - skb = alloc_skb(sizeof(*req), GFP_KERNEL); - if (!skb) - return -ENOMEM; - - adap = netdev2adap(dev); - req = (struct cpl_pass_open_req6 *)__skb_put(skb, sizeof(*req)); - INIT_TP_WR(req, 0); - OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ6, stid)); - req->local_port = sport; - req->peer_port = htons(0); - req->local_ip_hi = *(__be64 *)(sip->s6_addr); - req->local_ip_lo = *(__be64 *)(sip->s6_addr + 8); - req->peer_ip_hi = cpu_to_be64(0); - req->peer_ip_lo = cpu_to_be64(0); - chan = rxq_to_chan(&adap->sge, queue); - req->opt0 = cpu_to_be64(TX_CHAN(chan)); - req->opt1 = cpu_to_be64(CONN_POLICY_ASK | - SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); - return t4_mgmt_tx(adap, skb); -} -EXPORT_SYMBOL(cxgb4_create_server6); - -/** * cxgb4_best_mtu - find the entry in the MTU table closest to an MTU * @mtus: the HW MTU table * @mtu: the target MTU @@ -2455,48 +2412,6 @@ unsigned int cxgb4_port_idx(const struct } EXPORT_SYMBOL(cxgb4_port_idx); -/** - * cxgb4_netdev_by_hwid - return the net device of a HW port - * @pdev: identifies the adapter - * @id: the HW port id - * - * Return the net device associated with the interface with the given HW - * id. - */ -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id) -{ - const struct adapter *adap = pci_get_drvdata(pdev); - - if (!adap || id >= NCHAN) - return NULL; - id = adap->chan_map[id]; - return id < MAX_NPORTS ? adap->port[id] : NULL; -} -EXPORT_SYMBOL(cxgb4_netdev_by_hwid); - -void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6) -{ - struct adapter *adap = pci_get_drvdata(pdev); - - spin_lock(&adap->stats_lock); - t4_tp_get_tcp_stats(adap, v4, v6); - spin_unlock(&adap->stats_lock); -} -EXPORT_SYMBOL(cxgb4_get_tcp_stats); - -void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, - const unsigned int *pgsz_order) -{ - struct adapter *adap = netdev2adap(dev); - - t4_write_reg(adap, ULP_RX_ISCSI_TAGMASK, tag_mask); - t4_write_reg(adap, ULP_RX_ISCSI_PSZ, HPZ0(pgsz_order[0]) | - HPZ1(pgsz_order[1]) | HPZ2(pgsz_order[2]) | - HPZ3(pgsz_order[3])); -} -EXPORT_SYMBOL(cxgb4_iscsi_init); - static struct pci_driver cxgb4_driver; static void check_neigh_update(struct neighbour *neigh) --- a/drivers/net/cxgb4/cxgb4_uld.h 2010-10-15 11:31:38.964766089 -0700 +++ b/drivers/net/cxgb4/cxgb4_uld.h 2010-10-15 11:39:06.777878706 -0700 @@ -139,16 +139,11 @@ int cxgb4_alloc_stid(struct tid_info *t, void cxgb4_free_atid(struct tid_info *t, unsigned int atid); void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family); void cxgb4_remove_tid(struct tid_info *t, unsigned int qid, unsigned int tid); -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, - unsigned int tid); struct in6_addr; int cxgb4_create_server(const struct net_device *dev, unsigned int stid, __be32 sip, __be16 sport, unsigned int queue); -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, - const struct in6_addr *sip, __be16 sport, - unsigned int queue); static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue) { @@ -233,13 +228,6 @@ int cxgb4_ofld_send(struct net_device *d unsigned int cxgb4_port_chan(const struct net_device *dev); unsigned int cxgb4_port_viid(const struct net_device *dev); unsigned int cxgb4_port_idx(const struct net_device *dev); -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id); unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu, unsigned int *idx); -void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6); -void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, - const unsigned int *pgsz_order); -struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, - unsigned int skb_len, unsigned int pull_len); #endif /* !__CXGB4_OFLD_H */ --- a/drivers/net/cxgb4/cxgb4.h 2010-10-15 11:40:02.748431897 -0700 +++ b/drivers/net/cxgb4/cxgb4.h 2010-10-15 11:46:18.685455254 -0700 @@ -592,7 +592,6 @@ void t4_os_portmod_changed(const struct void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat); void *t4_alloc_mem(size_t size); -void t4_free_mem(void *addr); void t4_free_sge_resources(struct adapter *adap); irq_handler_t t4_intr_handler(struct adapter *adap); @@ -651,7 +650,6 @@ static inline int t4_wr_mbox_ns(struct a void t4_intr_enable(struct adapter *adapter); void t4_intr_disable(struct adapter *adapter); -void t4_intr_clear(struct adapter *adapter); int t4_slow_intr_handler(struct adapter *adapter); int t4_wait_dev_ready(struct adapter *adap); @@ -664,26 +662,16 @@ int t4_check_fw_version(struct adapter * int t4_prep_adapter(struct adapter *adapter); int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); void t4_fatal_err(struct adapter *adapter); -int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, - int filter_index, int enable); -void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, - int filter_index, int *enabled); int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, int start, int n, const u16 *rspq, unsigned int nrspq); int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, unsigned int flags); -int t4_read_rss(struct adapter *adapter, u16 *entries); int t4_mc_read(struct adapter *adap, u32 addr, __be32 *data, u64 *parity); int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity); void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); - void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); -void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6); void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, const unsigned short *alpha, const unsigned short *beta); @@ -711,8 +699,6 @@ int t4_cfg_pfvf(struct adapter *adap, un int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, unsigned int *rss_size); -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, - unsigned int vf, unsigned int viid); int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, int mtu, int promisc, int all_multi, int bcast, int vlanex, bool sleep_ok); @@ -731,9 +717,6 @@ int t4_mdio_rd(struct adapter *adap, uns unsigned int mmd, unsigned int reg, u16 *valp); int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, unsigned int mmd, unsigned int reg, u16 val); -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, - unsigned int pf, unsigned int vf, unsigned int iqid, - unsigned int fl0id, unsigned int fl1id); int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int iqtype, unsigned int iqid, unsigned int fl0id, unsigned int fl1id); --- a/drivers/net/cxgb4/l2t.c 2010-10-15 11:33:43.549387836 -0700 +++ b/drivers/net/cxgb4/l2t.c 2010-10-15 11:33:55.949849920 -0700 @@ -481,40 +481,6 @@ void t4_l2t_update(struct adapter *adap, handle_failed_resolution(adap, arpq); } -/* - * Allocate an L2T entry for use by a switching rule. Such entries need to be - * explicitly freed and while busy they are not on any hash chain, so normal - * address resolution updates do not see them. - */ -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d) -{ - struct l2t_entry *e; - - write_lock_bh(&d->lock); - e = alloc_l2e(d); - if (e) { - spin_lock(&e->lock); /* avoid race with t4_l2t_free */ - e->state = L2T_STATE_SWITCHING; - atomic_set(&e->refcnt, 1); - spin_unlock(&e->lock); - } - write_unlock_bh(&d->lock); - return e; -} - -/* - * Sets/updates the contents of a switching L2T entry that has been allocated - * with an earlier call to @t4_l2t_alloc_switching. - */ -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, - u8 port, u8 *eth_addr) -{ - e->vlan = vlan; - e->lport = port; - memcpy(e->dmac, eth_addr, ETH_ALEN); - return write_l2e(adap, e, 0); -} - struct l2t_data *t4_init_l2t(void) { int i; --- a/drivers/net/cxgb4/l2t.h 2010-10-15 11:33:00.175774482 -0700 +++ b/drivers/net/cxgb4/l2t.h 2010-10-15 11:33:13.728278102 -0700 @@ -100,9 +100,6 @@ struct l2t_entry *cxgb4_l2t_get(struct l unsigned int priority); void t4_l2t_update(struct adapter *adap, struct neighbour *neigh); -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d); -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, - u8 port, u8 *eth_addr); struct l2t_data *t4_init_l2t(void); void do_l2t_write_rpl(struct adapter *p, const struct cpl_l2t_write_rpl *rpl); --- a/drivers/net/cxgb4/sge.c 2010-10-15 11:34:06.486242828 -0700 +++ b/drivers/net/cxgb4/sge.c 2010-10-15 11:34:41.967567863 -0700 @@ -1434,8 +1434,8 @@ static inline void copy_frags(struct skb * Builds an sk_buff from the given packet gather list. Returns the * sk_buff or %NULL if sk_buff allocation failed. */ -struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, - unsigned int skb_len, unsigned int pull_len) +static struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, + unsigned int skb_len, unsigned int pull_len) { struct sk_buff *skb; @@ -1464,7 +1464,6 @@ struct sk_buff *cxgb4_pktgl_to_skb(const } out: return skb; } -EXPORT_SYMBOL(cxgb4_pktgl_to_skb); /** * t4_pktgl_free - free a packet gather list --- a/drivers/net/cxgb4/t4_hw.c 2010-10-15 11:35:08.640565879 -0700 +++ b/drivers/net/cxgb4/t4_hw.c 2010-10-15 11:46:55.167096446 -0700 @@ -97,53 +97,6 @@ void t4_set_reg_field(struct adapter *ad (void) t4_read_reg(adapter, addr); /* flush */ } -/** - * t4_read_indirect - read indirectly addressed registers - * @adap: the adapter - * @addr_reg: register holding the indirect address - * @data_reg: register holding the value of the indirect register - * @vals: where the read register values are stored - * @nregs: how many indirect registers to read - * @start_idx: index of first indirect register to read - * - * Reads registers that are accessed indirectly through an address/data - * register pair. - */ -static void t4_read_indirect(struct adapter *adap, unsigned int addr_reg, - unsigned int data_reg, u32 *vals, - unsigned int nregs, unsigned int start_idx) -{ - while (nregs--) { - t4_write_reg(adap, addr_reg, start_idx); - *vals++ = t4_read_reg(adap, data_reg); - start_idx++; - } -} - -#if 0 -/** - * t4_write_indirect - write indirectly addressed registers - * @adap: the adapter - * @addr_reg: register holding the indirect addresses - * @data_reg: register holding the value for the indirect registers - * @vals: values to write - * @nregs: how many indirect registers to write - * @start_idx: address of first indirect register to write - * - * Writes a sequential block of registers that are accessed indirectly - * through an address/data register pair. - */ -static void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, - unsigned int data_reg, const u32 *vals, - unsigned int nregs, unsigned int start_idx) -{ - while (nregs--) { - t4_write_reg(adap, addr_reg, start_idx++); - t4_write_reg(adap, data_reg, *vals++); - } -} -#endif - /* * Get the reply to a mailbox command and store it in @rpl in big-endian order. */ @@ -1560,44 +1513,6 @@ void t4_intr_disable(struct adapter *ada } /** - * t4_intr_clear - clear all interrupts - * @adapter: the adapter whose interrupts should be cleared - * - * Clears all interrupts. The caller must be a PCI function managing - * global interrupts. - */ -void t4_intr_clear(struct adapter *adapter) -{ - static const unsigned int cause_reg[] = { - SGE_INT_CAUSE1, SGE_INT_CAUSE2, SGE_INT_CAUSE3, - PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, - PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, - PCIE_NONFAT_ERR, PCIE_INT_CAUSE, - MC_INT_CAUSE, - MA_INT_WRAP_STATUS, MA_PARITY_ERROR_STATUS, MA_INT_CAUSE, - EDC_INT_CAUSE, EDC_REG(EDC_INT_CAUSE, 1), - CIM_HOST_INT_CAUSE, CIM_HOST_UPACC_INT_CAUSE, - MYPF_REG(CIM_PF_HOST_INT_CAUSE), - TP_INT_CAUSE, - ULP_RX_INT_CAUSE, ULP_TX_INT_CAUSE, - PM_RX_INT_CAUSE, PM_TX_INT_CAUSE, - MPS_RX_PERR_INT_CAUSE, - CPL_INTR_CAUSE, - MYPF_REG(PL_PF_INT_CAUSE), - PL_PL_INT_CAUSE, - LE_DB_INT_CAUSE, - }; - - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(cause_reg); ++i) - t4_write_reg(adapter, cause_reg[i], 0xffffffff); - - t4_write_reg(adapter, PL_INT_CAUSE, GLBL_INTR_MASK); - (void) t4_read_reg(adapter, PL_INT_CAUSE); /* flush */ -} - -/** * hash_mac_addr - return the hash value of a MAC address * @addr: the 48-bit Ethernet MAC address * @@ -1709,98 +1624,6 @@ int t4_config_glbl_rss(struct adapter *a return t4_wr_mbox(adapter, mbox, &c, sizeof(c), NULL); } -/* Read an RSS table row */ -static int rd_rss_row(struct adapter *adap, int row, u32 *val) -{ - t4_write_reg(adap, TP_RSS_LKP_TABLE, 0xfff00000 | row); - return t4_wait_op_done_val(adap, TP_RSS_LKP_TABLE, LKPTBLROWVLD, 1, - 5, 0, val); -} - -/** - * t4_read_rss - read the contents of the RSS mapping table - * @adapter: the adapter - * @map: holds the contents of the RSS mapping table - * - * Reads the contents of the RSS hash->queue mapping table. - */ -int t4_read_rss(struct adapter *adapter, u16 *map) -{ - u32 val; - int i, ret; - - for (i = 0; i < RSS_NENTRIES / 2; ++i) { - ret = rd_rss_row(adapter, i, &val); - if (ret) - return ret; - *map++ = LKPTBLQUEUE0_GET(val); - *map++ = LKPTBLQUEUE1_GET(val); - } - return 0; -} - -/** - * t4_tp_get_tcp_stats - read TP's TCP MIB counters - * @adap: the adapter - * @v4: holds the TCP/IP counter values - * @v6: holds the TCP/IPv6 counter values - * - * Returns the values of TP's TCP/IP and TCP/IPv6 MIB counters. - * Either @v4 or @v6 may be %NULL to skip the corresponding stats. - */ -void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6) -{ - u32 val[TP_MIB_TCP_RXT_SEG_LO - TP_MIB_TCP_OUT_RST + 1]; - -#define STAT_IDX(x) ((TP_MIB_TCP_##x) - TP_MIB_TCP_OUT_RST) -#define STAT(x) val[STAT_IDX(x)] -#define STAT64(x) (((u64)STAT(x##_HI) << 32) | STAT(x##_LO)) - - if (v4) { - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, val, - ARRAY_SIZE(val), TP_MIB_TCP_OUT_RST); - v4->tcpOutRsts = STAT(OUT_RST); - v4->tcpInSegs = STAT64(IN_SEG); - v4->tcpOutSegs = STAT64(OUT_SEG); - v4->tcpRetransSegs = STAT64(RXT_SEG); - } - if (v6) { - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, val, - ARRAY_SIZE(val), TP_MIB_TCP_V6OUT_RST); - v6->tcpOutRsts = STAT(OUT_RST); - v6->tcpInSegs = STAT64(IN_SEG); - v6->tcpOutSegs = STAT64(OUT_SEG); - v6->tcpRetransSegs = STAT64(RXT_SEG); - } -#undef STAT64 -#undef STAT -#undef STAT_IDX -} - -/** - * t4_tp_get_err_stats - read TP's error MIB counters - * @adap: the adapter - * @st: holds the counter values - * - * Returns the values of TP's error counters. - */ -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) -{ - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->macInErrs, - 12, TP_MIB_MAC_IN_ERR_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlCongDrops, - 8, TP_MIB_TNL_CNG_DROP_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlTxDrops, - 4, TP_MIB_TNL_DROP_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->ofldVlanDrops, - 4, TP_MIB_OFD_VLN_DROP_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tcp6InErrs, - 4, TP_MIB_TCP_V6IN_ERR_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, &st->ofldNoNeigh, - 2, TP_MIB_OFD_ARP_DROP); -} - /** * t4_read_mtu_tbl - returns the values in the HW path MTU table * @adap: the adapter @@ -1916,122 +1739,6 @@ void t4_load_mtus(struct adapter *adap, } /** - * t4_set_trace_filter - configure one of the tracing filters - * @adap: the adapter - * @tp: the desired trace filter parameters - * @idx: which filter to configure - * @enable: whether to enable or disable the filter - * - * Configures one of the tracing filters available in HW. If @enable is - * %0 @tp is not examined and may be %NULL. - */ -int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, - int idx, int enable) -{ - int i, ofst = idx * 4; - u32 data_reg, mask_reg, cfg; - u32 multitrc = TRCMULTIFILTER; - - if (!enable) { - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - goto out; - } - - if (tp->port > 11 || tp->invert > 1 || tp->skip_len > 0x1f || - tp->skip_ofst > 0x1f || tp->min_len > 0x1ff || - tp->snap_len > 9600 || (idx && tp->snap_len > 256)) - return -EINVAL; - - if (tp->snap_len > 256) { /* must be tracer 0 */ - if ((t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 4) | - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 8) | - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 12)) & TFEN) - return -EINVAL; /* other tracers are enabled */ - multitrc = 0; - } else if (idx) { - i = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B); - if (TFCAPTUREMAX_GET(i) > 256 && - (t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A) & TFEN)) - return -EINVAL; - } - - /* stop the tracer we'll be changing */ - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - - /* disable tracing globally if running in the wrong single/multi mode */ - cfg = t4_read_reg(adap, MPS_TRC_CFG); - if ((cfg & TRCEN) && multitrc != (cfg & TRCMULTIFILTER)) { - t4_write_reg(adap, MPS_TRC_CFG, cfg ^ TRCEN); - t4_read_reg(adap, MPS_TRC_CFG); /* flush */ - msleep(1); - if (!(t4_read_reg(adap, MPS_TRC_CFG) & TRCFIFOEMPTY)) - return -ETIMEDOUT; - } - /* - * At this point either the tracing is enabled and in the right mode or - * disabled. - */ - - idx *= (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH); - data_reg = MPS_TRC_FILTER0_MATCH + idx; - mask_reg = MPS_TRC_FILTER0_DONT_CARE + idx; - - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { - t4_write_reg(adap, data_reg, tp->data[i]); - t4_write_reg(adap, mask_reg, ~tp->mask[i]); - } - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst, - TFCAPTUREMAX(tp->snap_len) | - TFMINPKTSIZE(tp->min_len)); - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, - TFOFFSET(tp->skip_ofst) | TFLENGTH(tp->skip_len) | - TFPORT(tp->port) | TFEN | - (tp->invert ? TFINVERTMATCH : 0)); - - cfg &= ~TRCMULTIFILTER; - t4_write_reg(adap, MPS_TRC_CFG, cfg | TRCEN | multitrc); -out: t4_read_reg(adap, MPS_TRC_CFG); /* flush */ - return 0; -} - -/** - * t4_get_trace_filter - query one of the tracing filters - * @adap: the adapter - * @tp: the current trace filter parameters - * @idx: which trace filter to query - * @enabled: non-zero if the filter is enabled - * - * Returns the current settings of one of the HW tracing filters. - */ -void t4_get_trace_filter(struct adapter *adap, struct trace_params *tp, int idx, - int *enabled) -{ - u32 ctla, ctlb; - int i, ofst = idx * 4; - u32 data_reg, mask_reg; - - ctla = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst); - ctlb = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst); - - *enabled = !!(ctla & TFEN); - tp->snap_len = TFCAPTUREMAX_GET(ctlb); - tp->min_len = TFMINPKTSIZE_GET(ctlb); - tp->skip_ofst = TFOFFSET_GET(ctla); - tp->skip_len = TFLENGTH_GET(ctla); - tp->invert = !!(ctla & TFINVERTMATCH); - tp->port = TFPORT_GET(ctla); - - ofst = (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH) * idx; - data_reg = MPS_TRC_FILTER0_MATCH + ofst; - mask_reg = MPS_TRC_FILTER0_DONT_CARE + ofst; - - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { - tp->mask[i] = ~t4_read_reg(adap, mask_reg); - tp->data[i] = t4_read_reg(adap, data_reg) & tp->mask[i]; - } -} - -/** * get_mps_bg_map - return the buffer groups associated with a port * @adap: the adapter * @idx: the port index @@ -2133,52 +1840,6 @@ void t4_get_port_stats(struct adapter *a } /** - * t4_get_lb_stats - collect loopback port statistics - * @adap: the adapter - * @idx: the loopback port index - * @p: the stats structure to fill - * - * Return HW statistics for the given loopback port. - */ -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) -{ - u32 bgmap = get_mps_bg_map(adap, idx); - -#define GET_STAT(name) \ - t4_read_reg64(adap, PORT_REG(idx, MPS_PORT_STAT_LB_PORT_##name##_L)) -#define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) - - p->octets = GET_STAT(BYTES); - p->frames = GET_STAT(FRAMES); - p->bcast_frames = GET_STAT(BCAST); - p->mcast_frames = GET_STAT(MCAST); - p->ucast_frames = GET_STAT(UCAST); - p->error_frames = GET_STAT(ERROR); - - p->frames_64 = GET_STAT(64B); - p->frames_65_127 = GET_STAT(65B_127B); - p->frames_128_255 = GET_STAT(128B_255B); - p->frames_256_511 = GET_STAT(256B_511B); - p->frames_512_1023 = GET_STAT(512B_1023B); - p->frames_1024_1518 = GET_STAT(1024B_1518B); - p->frames_1519_max = GET_STAT(1519B_MAX); - p->drop = t4_read_reg(adap, PORT_REG(idx, - MPS_PORT_STAT_LB_PORT_DROP_FRAMES)); - - p->ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; - p->ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; - p->ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; - p->ovflow3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; - p->trunc0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; - p->trunc1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; - p->trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; - p->trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; - -#undef GET_STAT -#undef GET_STAT_COM -} - -/** * t4_wol_magic_enable - enable/disable magic packet WoL * @adap: the adapter * @port: the physical port index @@ -2584,30 +2245,6 @@ int t4_alloc_vi(struct adapter *adap, un } /** - * t4_free_vi - free a virtual interface - * @adap: the adapter - * @mbox: mailbox to use for the FW command - * @pf: the PF owning the VI - * @vf: the VF owning the VI - * @viid: virtual interface identifiler - * - * Free a previously allocated virtual interface. - */ -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, - unsigned int vf, unsigned int viid) -{ - struct fw_vi_cmd c; - - memset(&c, 0, sizeof(c)); - c.op_to_vfn = htonl(FW_CMD_OP(FW_VI_CMD) | FW_CMD_REQUEST | - FW_CMD_EXEC | FW_VI_CMD_PFN(pf) | - FW_VI_CMD_VFN(vf)); - c.alloc_to_len16 = htonl(FW_VI_CMD_FREE | FW_LEN16(c)); - c.type_viid = htons(FW_VI_CMD_VIID(viid)); - return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); -} - -/** * t4_set_rxmode - set Rx properties of a virtual interface * @adap: the adapter * @mbox: mailbox to use for the FW command @@ -2832,37 +2469,6 @@ int t4_identify_port(struct adapter *ada return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); } -/** - * t4_iq_start_stop - enable/disable an ingress queue and its FLs - * @adap: the adapter - * @mbox: mailbox to use for the FW command - * @start: %true to enable the queues, %false to disable them - * @pf: the PF owning the queues - * @vf: the VF owning the queues - * @iqid: ingress queue id - * @fl0id: FL0 queue id or 0xffff if no attached FL0 - * @fl1id: FL1 queue id or 0xffff if no attached FL1 - * - * Starts or stops an ingress queue and its associated FLs, if any. - */ -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, - unsigned int pf, unsigned int vf, unsigned int iqid, - unsigned int fl0id, unsigned int fl1id) -{ - struct fw_iq_cmd c; - - memset(&c, 0, sizeof(c)); - c.op_to_vfn = htonl(FW_CMD_OP(FW_IQ_CMD) | FW_CMD_REQUEST | - FW_CMD_EXEC | FW_IQ_CMD_PFN(pf) | - FW_IQ_CMD_VFN(vf)); - c.alloc_to_len16 = htonl(FW_IQ_CMD_IQSTART(start) | - FW_IQ_CMD_IQSTOP(!start) | FW_LEN16(c)); - c.iqid = htons(iqid); - c.fl0id = htons(fl0id); - c.fl1id = htons(fl1id); - return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); -} - /** * t4_iq_free - free an ingress queue and its FLs * @adap: the adapter ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup 2010-10-15 22:43 ` [PATCH 2/3] cxgb4: " Stephen Hemminger @ 2010-10-15 23:29 ` Joe Perches 2010-10-15 23:50 ` Stephen Hemminger 2010-10-15 23:34 ` Dimitris Michailidis 2010-10-16 0:10 ` [PATCH 2/3] cxgb4: function namespace cleanup (v2) Stephen Hemminger 2 siblings, 1 reply; 20+ messages in thread From: Joe Perches @ 2010-10-15 23:29 UTC (permalink / raw) To: Stephen Hemminger Cc: Divy Le Ray, David S. Miller, Casey Leedom, Dimitris Michailidis, netdev On Fri, 2010-10-15 at 15:43 -0700, Stephen Hemminger wrote: > plain text document attachment (cxgb4-local.patch) > Make functions only used in one file local. > Remove lots of dead code. Most surprising is the function > cxgb4_iscsi_init which is defined but never called! > Compile tested only drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:1423: cxgb4_iscsi_init(lldi->ports[0], tagmask, pgsz_factor); ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup 2010-10-15 23:29 ` Joe Perches @ 2010-10-15 23:50 ` Stephen Hemminger 0 siblings, 0 replies; 20+ messages in thread From: Stephen Hemminger @ 2010-10-15 23:50 UTC (permalink / raw) To: Joe Perches Cc: Divy Le Ray, David S. Miller, Casey Leedom, Dimitris Michailidis, netdev On Fri, 15 Oct 2010 16:29:21 -0700 Joe Perches <joe@perches.com> wrote: > On Fri, 2010-10-15 at 15:43 -0700, Stephen Hemminger wrote: > > plain text document attachment (cxgb4-local.patch) > > Make functions only used in one file local. > > Remove lots of dead code. Most surprising is the function > > cxgb4_iscsi_init which is defined but never called! > > Compile tested only > > drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:1423: cxgb4_iscsi_init(lldi->ports[0], tagmask, pgsz_factor); Ok. drivers/scsi/cxgbi/cxgb4i does not exist in net-next will recheck with linux-next ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup 2010-10-15 22:43 ` [PATCH 2/3] cxgb4: " Stephen Hemminger 2010-10-15 23:29 ` Joe Perches @ 2010-10-15 23:34 ` Dimitris Michailidis 2010-10-16 0:10 ` [PATCH 2/3] cxgb4: function namespace cleanup (v2) Stephen Hemminger 2 siblings, 0 replies; 20+ messages in thread From: Dimitris Michailidis @ 2010-10-15 23:34 UTC (permalink / raw) To: Stephen Hemminger; +Cc: Divy Le Ray, David S. Miller, Casey Leedom, netdev Stephen Hemminger wrote: > Make functions only used in one file local. > Remove lots of dead code. Most surprising is the function > cxgb4_iscsi_init which is defined but never called! > Compile tested only You are changing to static or removing entirely functions exported for use by the iSCSI and RDMA drivers. The function you mention, cxgb4_iscsi_init, is used in the cxgb4i driver in the scsi tree and this change breaks it. > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> > > > --- > drivers/net/cxgb4/cxgb4.h | 17 - > drivers/net/cxgb4/cxgb4_main.c | 91 --------- > drivers/net/cxgb4/cxgb4_uld.h | 12 - > drivers/net/cxgb4/l2t.c | 34 --- > drivers/net/cxgb4/l2t.h | 3 > drivers/net/cxgb4/sge.c | 5 > drivers/net/cxgb4/t4_hw.c | 394 ----------------------------------------- > 7 files changed, 5 insertions(+), 551 deletions(-) > > --- a/drivers/net/cxgb4/cxgb4_main.c 2010-10-15 11:31:38.980766681 -0700 > +++ b/drivers/net/cxgb4/cxgb4_main.c 2010-10-15 11:40:13.976943486 -0700 > @@ -880,7 +880,7 @@ void *t4_alloc_mem(size_t size) > /* > * Free memory allocated through alloc_mem(). > */ > -void t4_free_mem(void *addr) > +static void t4_free_mem(void *addr) > { > if (is_vmalloc_addr(addr)) > vfree(addr); > @@ -2206,8 +2206,8 @@ static void mk_tid_release(struct sk_buf > * Queue a TID release request and if necessary schedule a work queue to > * process it. > */ > -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, > - unsigned int tid) > +static void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, > + unsigned int tid) > { > void **p = &t->tid_tab[tid]; > struct adapter *adap = container_of(t, struct adapter, tids); > @@ -2222,7 +2222,6 @@ void cxgb4_queue_tid_release(struct tid_ > } > spin_unlock_bh(&adap->tid_release_lock); > } > -EXPORT_SYMBOL(cxgb4_queue_tid_release); > > /* > * Process the list of pending TID release requests. > @@ -2355,48 +2354,6 @@ int cxgb4_create_server(const struct net > EXPORT_SYMBOL(cxgb4_create_server); > > /** > - * cxgb4_create_server6 - create an IPv6 server > - * @dev: the device > - * @stid: the server TID > - * @sip: local IPv6 address to bind server to > - * @sport: the server's TCP port > - * @queue: queue to direct messages from this server to > - * > - * Create an IPv6 server for the given port and address. > - * Returns <0 on error and one of the %NET_XMIT_* values on success. > - */ > -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, > - const struct in6_addr *sip, __be16 sport, > - unsigned int queue) > -{ > - unsigned int chan; > - struct sk_buff *skb; > - struct adapter *adap; > - struct cpl_pass_open_req6 *req; > - > - skb = alloc_skb(sizeof(*req), GFP_KERNEL); > - if (!skb) > - return -ENOMEM; > - > - adap = netdev2adap(dev); > - req = (struct cpl_pass_open_req6 *)__skb_put(skb, sizeof(*req)); > - INIT_TP_WR(req, 0); > - OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ6, stid)); > - req->local_port = sport; > - req->peer_port = htons(0); > - req->local_ip_hi = *(__be64 *)(sip->s6_addr); > - req->local_ip_lo = *(__be64 *)(sip->s6_addr + 8); > - req->peer_ip_hi = cpu_to_be64(0); > - req->peer_ip_lo = cpu_to_be64(0); > - chan = rxq_to_chan(&adap->sge, queue); > - req->opt0 = cpu_to_be64(TX_CHAN(chan)); > - req->opt1 = cpu_to_be64(CONN_POLICY_ASK | > - SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); > - return t4_mgmt_tx(adap, skb); > -} > -EXPORT_SYMBOL(cxgb4_create_server6); > - > -/** > * cxgb4_best_mtu - find the entry in the MTU table closest to an MTU > * @mtus: the HW MTU table > * @mtu: the target MTU > @@ -2455,48 +2412,6 @@ unsigned int cxgb4_port_idx(const struct > } > EXPORT_SYMBOL(cxgb4_port_idx); > > -/** > - * cxgb4_netdev_by_hwid - return the net device of a HW port > - * @pdev: identifies the adapter > - * @id: the HW port id > - * > - * Return the net device associated with the interface with the given HW > - * id. > - */ > -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id) > -{ > - const struct adapter *adap = pci_get_drvdata(pdev); > - > - if (!adap || id >= NCHAN) > - return NULL; > - id = adap->chan_map[id]; > - return id < MAX_NPORTS ? adap->port[id] : NULL; > -} > -EXPORT_SYMBOL(cxgb4_netdev_by_hwid); > - > -void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, > - struct tp_tcp_stats *v6) > -{ > - struct adapter *adap = pci_get_drvdata(pdev); > - > - spin_lock(&adap->stats_lock); > - t4_tp_get_tcp_stats(adap, v4, v6); > - spin_unlock(&adap->stats_lock); > -} > -EXPORT_SYMBOL(cxgb4_get_tcp_stats); > - > -void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, > - const unsigned int *pgsz_order) > -{ > - struct adapter *adap = netdev2adap(dev); > - > - t4_write_reg(adap, ULP_RX_ISCSI_TAGMASK, tag_mask); > - t4_write_reg(adap, ULP_RX_ISCSI_PSZ, HPZ0(pgsz_order[0]) | > - HPZ1(pgsz_order[1]) | HPZ2(pgsz_order[2]) | > - HPZ3(pgsz_order[3])); > -} > -EXPORT_SYMBOL(cxgb4_iscsi_init); > - > static struct pci_driver cxgb4_driver; > > static void check_neigh_update(struct neighbour *neigh) > --- a/drivers/net/cxgb4/cxgb4_uld.h 2010-10-15 11:31:38.964766089 -0700 > +++ b/drivers/net/cxgb4/cxgb4_uld.h 2010-10-15 11:39:06.777878706 -0700 > @@ -139,16 +139,11 @@ int cxgb4_alloc_stid(struct tid_info *t, > void cxgb4_free_atid(struct tid_info *t, unsigned int atid); > void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family); > void cxgb4_remove_tid(struct tid_info *t, unsigned int qid, unsigned int tid); > -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, > - unsigned int tid); > > struct in6_addr; > > int cxgb4_create_server(const struct net_device *dev, unsigned int stid, > __be32 sip, __be16 sport, unsigned int queue); > -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, > - const struct in6_addr *sip, __be16 sport, > - unsigned int queue); > > static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue) > { > @@ -233,13 +228,6 @@ int cxgb4_ofld_send(struct net_device *d > unsigned int cxgb4_port_chan(const struct net_device *dev); > unsigned int cxgb4_port_viid(const struct net_device *dev); > unsigned int cxgb4_port_idx(const struct net_device *dev); > -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id); > unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu, > unsigned int *idx); > -void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, > - struct tp_tcp_stats *v6); > -void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, > - const unsigned int *pgsz_order); > -struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, > - unsigned int skb_len, unsigned int pull_len); > #endif /* !__CXGB4_OFLD_H */ > --- a/drivers/net/cxgb4/cxgb4.h 2010-10-15 11:40:02.748431897 -0700 > +++ b/drivers/net/cxgb4/cxgb4.h 2010-10-15 11:46:18.685455254 -0700 > @@ -592,7 +592,6 @@ void t4_os_portmod_changed(const struct > void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat); > > void *t4_alloc_mem(size_t size); > -void t4_free_mem(void *addr); > > void t4_free_sge_resources(struct adapter *adap); > irq_handler_t t4_intr_handler(struct adapter *adap); > @@ -651,7 +650,6 @@ static inline int t4_wr_mbox_ns(struct a > > void t4_intr_enable(struct adapter *adapter); > void t4_intr_disable(struct adapter *adapter); > -void t4_intr_clear(struct adapter *adapter); > int t4_slow_intr_handler(struct adapter *adapter); > > int t4_wait_dev_ready(struct adapter *adap); > @@ -664,26 +662,16 @@ int t4_check_fw_version(struct adapter * > int t4_prep_adapter(struct adapter *adapter); > int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); > void t4_fatal_err(struct adapter *adapter); > -int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, > - int filter_index, int enable); > -void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, > - int filter_index, int *enabled); > int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, > int start, int n, const u16 *rspq, unsigned int nrspq); > int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, > unsigned int flags); > -int t4_read_rss(struct adapter *adapter, u16 *entries); > int t4_mc_read(struct adapter *adap, u32 addr, __be32 *data, u64 *parity); > int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, > u64 *parity); > > void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); > -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); > - > void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); > -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); > -void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, > - struct tp_tcp_stats *v6); > void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, > const unsigned short *alpha, const unsigned short *beta); > > @@ -711,8 +699,6 @@ int t4_cfg_pfvf(struct adapter *adap, un > int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, > unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, > unsigned int *rss_size); > -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, > - unsigned int vf, unsigned int viid); > int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, > int mtu, int promisc, int all_multi, int bcast, int vlanex, > bool sleep_ok); > @@ -731,9 +717,6 @@ int t4_mdio_rd(struct adapter *adap, uns > unsigned int mmd, unsigned int reg, u16 *valp); > int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, > unsigned int mmd, unsigned int reg, u16 val); > -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, > - unsigned int pf, unsigned int vf, unsigned int iqid, > - unsigned int fl0id, unsigned int fl1id); > int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, > unsigned int vf, unsigned int iqtype, unsigned int iqid, > unsigned int fl0id, unsigned int fl1id); > --- a/drivers/net/cxgb4/l2t.c 2010-10-15 11:33:43.549387836 -0700 > +++ b/drivers/net/cxgb4/l2t.c 2010-10-15 11:33:55.949849920 -0700 > @@ -481,40 +481,6 @@ void t4_l2t_update(struct adapter *adap, > handle_failed_resolution(adap, arpq); > } > > -/* > - * Allocate an L2T entry for use by a switching rule. Such entries need to be > - * explicitly freed and while busy they are not on any hash chain, so normal > - * address resolution updates do not see them. > - */ > -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d) > -{ > - struct l2t_entry *e; > - > - write_lock_bh(&d->lock); > - e = alloc_l2e(d); > - if (e) { > - spin_lock(&e->lock); /* avoid race with t4_l2t_free */ > - e->state = L2T_STATE_SWITCHING; > - atomic_set(&e->refcnt, 1); > - spin_unlock(&e->lock); > - } > - write_unlock_bh(&d->lock); > - return e; > -} > - > -/* > - * Sets/updates the contents of a switching L2T entry that has been allocated > - * with an earlier call to @t4_l2t_alloc_switching. > - */ > -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, > - u8 port, u8 *eth_addr) > -{ > - e->vlan = vlan; > - e->lport = port; > - memcpy(e->dmac, eth_addr, ETH_ALEN); > - return write_l2e(adap, e, 0); > -} > - > struct l2t_data *t4_init_l2t(void) > { > int i; > --- a/drivers/net/cxgb4/l2t.h 2010-10-15 11:33:00.175774482 -0700 > +++ b/drivers/net/cxgb4/l2t.h 2010-10-15 11:33:13.728278102 -0700 > @@ -100,9 +100,6 @@ struct l2t_entry *cxgb4_l2t_get(struct l > unsigned int priority); > > void t4_l2t_update(struct adapter *adap, struct neighbour *neigh); > -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d); > -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, > - u8 port, u8 *eth_addr); > struct l2t_data *t4_init_l2t(void); > void do_l2t_write_rpl(struct adapter *p, const struct cpl_l2t_write_rpl *rpl); > > --- a/drivers/net/cxgb4/sge.c 2010-10-15 11:34:06.486242828 -0700 > +++ b/drivers/net/cxgb4/sge.c 2010-10-15 11:34:41.967567863 -0700 > @@ -1434,8 +1434,8 @@ static inline void copy_frags(struct skb > * Builds an sk_buff from the given packet gather list. Returns the > * sk_buff or %NULL if sk_buff allocation failed. > */ > -struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, > - unsigned int skb_len, unsigned int pull_len) > +static struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, > + unsigned int skb_len, unsigned int pull_len) > { > struct sk_buff *skb; > > @@ -1464,7 +1464,6 @@ struct sk_buff *cxgb4_pktgl_to_skb(const > } > out: return skb; > } > -EXPORT_SYMBOL(cxgb4_pktgl_to_skb); > > /** > * t4_pktgl_free - free a packet gather list > --- a/drivers/net/cxgb4/t4_hw.c 2010-10-15 11:35:08.640565879 -0700 > +++ b/drivers/net/cxgb4/t4_hw.c 2010-10-15 11:46:55.167096446 -0700 > @@ -97,53 +97,6 @@ void t4_set_reg_field(struct adapter *ad > (void) t4_read_reg(adapter, addr); /* flush */ > } > > -/** > - * t4_read_indirect - read indirectly addressed registers > - * @adap: the adapter > - * @addr_reg: register holding the indirect address > - * @data_reg: register holding the value of the indirect register > - * @vals: where the read register values are stored > - * @nregs: how many indirect registers to read > - * @start_idx: index of first indirect register to read > - * > - * Reads registers that are accessed indirectly through an address/data > - * register pair. > - */ > -static void t4_read_indirect(struct adapter *adap, unsigned int addr_reg, > - unsigned int data_reg, u32 *vals, > - unsigned int nregs, unsigned int start_idx) > -{ > - while (nregs--) { > - t4_write_reg(adap, addr_reg, start_idx); > - *vals++ = t4_read_reg(adap, data_reg); > - start_idx++; > - } > -} > - > -#if 0 > -/** > - * t4_write_indirect - write indirectly addressed registers > - * @adap: the adapter > - * @addr_reg: register holding the indirect addresses > - * @data_reg: register holding the value for the indirect registers > - * @vals: values to write > - * @nregs: how many indirect registers to write > - * @start_idx: address of first indirect register to write > - * > - * Writes a sequential block of registers that are accessed indirectly > - * through an address/data register pair. > - */ > -static void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, > - unsigned int data_reg, const u32 *vals, > - unsigned int nregs, unsigned int start_idx) > -{ > - while (nregs--) { > - t4_write_reg(adap, addr_reg, start_idx++); > - t4_write_reg(adap, data_reg, *vals++); > - } > -} > -#endif > - > /* > * Get the reply to a mailbox command and store it in @rpl in big-endian order. > */ > @@ -1560,44 +1513,6 @@ void t4_intr_disable(struct adapter *ada > } > > /** > - * t4_intr_clear - clear all interrupts > - * @adapter: the adapter whose interrupts should be cleared > - * > - * Clears all interrupts. The caller must be a PCI function managing > - * global interrupts. > - */ > -void t4_intr_clear(struct adapter *adapter) > -{ > - static const unsigned int cause_reg[] = { > - SGE_INT_CAUSE1, SGE_INT_CAUSE2, SGE_INT_CAUSE3, > - PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, > - PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, > - PCIE_NONFAT_ERR, PCIE_INT_CAUSE, > - MC_INT_CAUSE, > - MA_INT_WRAP_STATUS, MA_PARITY_ERROR_STATUS, MA_INT_CAUSE, > - EDC_INT_CAUSE, EDC_REG(EDC_INT_CAUSE, 1), > - CIM_HOST_INT_CAUSE, CIM_HOST_UPACC_INT_CAUSE, > - MYPF_REG(CIM_PF_HOST_INT_CAUSE), > - TP_INT_CAUSE, > - ULP_RX_INT_CAUSE, ULP_TX_INT_CAUSE, > - PM_RX_INT_CAUSE, PM_TX_INT_CAUSE, > - MPS_RX_PERR_INT_CAUSE, > - CPL_INTR_CAUSE, > - MYPF_REG(PL_PF_INT_CAUSE), > - PL_PL_INT_CAUSE, > - LE_DB_INT_CAUSE, > - }; > - > - unsigned int i; > - > - for (i = 0; i < ARRAY_SIZE(cause_reg); ++i) > - t4_write_reg(adapter, cause_reg[i], 0xffffffff); > - > - t4_write_reg(adapter, PL_INT_CAUSE, GLBL_INTR_MASK); > - (void) t4_read_reg(adapter, PL_INT_CAUSE); /* flush */ > -} > - > -/** > * hash_mac_addr - return the hash value of a MAC address > * @addr: the 48-bit Ethernet MAC address > * > @@ -1709,98 +1624,6 @@ int t4_config_glbl_rss(struct adapter *a > return t4_wr_mbox(adapter, mbox, &c, sizeof(c), NULL); > } > > -/* Read an RSS table row */ > -static int rd_rss_row(struct adapter *adap, int row, u32 *val) > -{ > - t4_write_reg(adap, TP_RSS_LKP_TABLE, 0xfff00000 | row); > - return t4_wait_op_done_val(adap, TP_RSS_LKP_TABLE, LKPTBLROWVLD, 1, > - 5, 0, val); > -} > - > -/** > - * t4_read_rss - read the contents of the RSS mapping table > - * @adapter: the adapter > - * @map: holds the contents of the RSS mapping table > - * > - * Reads the contents of the RSS hash->queue mapping table. > - */ > -int t4_read_rss(struct adapter *adapter, u16 *map) > -{ > - u32 val; > - int i, ret; > - > - for (i = 0; i < RSS_NENTRIES / 2; ++i) { > - ret = rd_rss_row(adapter, i, &val); > - if (ret) > - return ret; > - *map++ = LKPTBLQUEUE0_GET(val); > - *map++ = LKPTBLQUEUE1_GET(val); > - } > - return 0; > -} > - > -/** > - * t4_tp_get_tcp_stats - read TP's TCP MIB counters > - * @adap: the adapter > - * @v4: holds the TCP/IP counter values > - * @v6: holds the TCP/IPv6 counter values > - * > - * Returns the values of TP's TCP/IP and TCP/IPv6 MIB counters. > - * Either @v4 or @v6 may be %NULL to skip the corresponding stats. > - */ > -void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, > - struct tp_tcp_stats *v6) > -{ > - u32 val[TP_MIB_TCP_RXT_SEG_LO - TP_MIB_TCP_OUT_RST + 1]; > - > -#define STAT_IDX(x) ((TP_MIB_TCP_##x) - TP_MIB_TCP_OUT_RST) > -#define STAT(x) val[STAT_IDX(x)] > -#define STAT64(x) (((u64)STAT(x##_HI) << 32) | STAT(x##_LO)) > - > - if (v4) { > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, val, > - ARRAY_SIZE(val), TP_MIB_TCP_OUT_RST); > - v4->tcpOutRsts = STAT(OUT_RST); > - v4->tcpInSegs = STAT64(IN_SEG); > - v4->tcpOutSegs = STAT64(OUT_SEG); > - v4->tcpRetransSegs = STAT64(RXT_SEG); > - } > - if (v6) { > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, val, > - ARRAY_SIZE(val), TP_MIB_TCP_V6OUT_RST); > - v6->tcpOutRsts = STAT(OUT_RST); > - v6->tcpInSegs = STAT64(IN_SEG); > - v6->tcpOutSegs = STAT64(OUT_SEG); > - v6->tcpRetransSegs = STAT64(RXT_SEG); > - } > -#undef STAT64 > -#undef STAT > -#undef STAT_IDX > -} > - > -/** > - * t4_tp_get_err_stats - read TP's error MIB counters > - * @adap: the adapter > - * @st: holds the counter values > - * > - * Returns the values of TP's error counters. > - */ > -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) > -{ > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->macInErrs, > - 12, TP_MIB_MAC_IN_ERR_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlCongDrops, > - 8, TP_MIB_TNL_CNG_DROP_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlTxDrops, > - 4, TP_MIB_TNL_DROP_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->ofldVlanDrops, > - 4, TP_MIB_OFD_VLN_DROP_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tcp6InErrs, > - 4, TP_MIB_TCP_V6IN_ERR_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, &st->ofldNoNeigh, > - 2, TP_MIB_OFD_ARP_DROP); > -} > - > /** > * t4_read_mtu_tbl - returns the values in the HW path MTU table > * @adap: the adapter > @@ -1916,122 +1739,6 @@ void t4_load_mtus(struct adapter *adap, > } > > /** > - * t4_set_trace_filter - configure one of the tracing filters > - * @adap: the adapter > - * @tp: the desired trace filter parameters > - * @idx: which filter to configure > - * @enable: whether to enable or disable the filter > - * > - * Configures one of the tracing filters available in HW. If @enable is > - * %0 @tp is not examined and may be %NULL. > - */ > -int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, > - int idx, int enable) > -{ > - int i, ofst = idx * 4; > - u32 data_reg, mask_reg, cfg; > - u32 multitrc = TRCMULTIFILTER; > - > - if (!enable) { > - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); > - goto out; > - } > - > - if (tp->port > 11 || tp->invert > 1 || tp->skip_len > 0x1f || > - tp->skip_ofst > 0x1f || tp->min_len > 0x1ff || > - tp->snap_len > 9600 || (idx && tp->snap_len > 256)) > - return -EINVAL; > - > - if (tp->snap_len > 256) { /* must be tracer 0 */ > - if ((t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 4) | > - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 8) | > - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 12)) & TFEN) > - return -EINVAL; /* other tracers are enabled */ > - multitrc = 0; > - } else if (idx) { > - i = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B); > - if (TFCAPTUREMAX_GET(i) > 256 && > - (t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A) & TFEN)) > - return -EINVAL; > - } > - > - /* stop the tracer we'll be changing */ > - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); > - > - /* disable tracing globally if running in the wrong single/multi mode */ > - cfg = t4_read_reg(adap, MPS_TRC_CFG); > - if ((cfg & TRCEN) && multitrc != (cfg & TRCMULTIFILTER)) { > - t4_write_reg(adap, MPS_TRC_CFG, cfg ^ TRCEN); > - t4_read_reg(adap, MPS_TRC_CFG); /* flush */ > - msleep(1); > - if (!(t4_read_reg(adap, MPS_TRC_CFG) & TRCFIFOEMPTY)) > - return -ETIMEDOUT; > - } > - /* > - * At this point either the tracing is enabled and in the right mode or > - * disabled. > - */ > - > - idx *= (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH); > - data_reg = MPS_TRC_FILTER0_MATCH + idx; > - mask_reg = MPS_TRC_FILTER0_DONT_CARE + idx; > - > - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { > - t4_write_reg(adap, data_reg, tp->data[i]); > - t4_write_reg(adap, mask_reg, ~tp->mask[i]); > - } > - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst, > - TFCAPTUREMAX(tp->snap_len) | > - TFMINPKTSIZE(tp->min_len)); > - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, > - TFOFFSET(tp->skip_ofst) | TFLENGTH(tp->skip_len) | > - TFPORT(tp->port) | TFEN | > - (tp->invert ? TFINVERTMATCH : 0)); > - > - cfg &= ~TRCMULTIFILTER; > - t4_write_reg(adap, MPS_TRC_CFG, cfg | TRCEN | multitrc); > -out: t4_read_reg(adap, MPS_TRC_CFG); /* flush */ > - return 0; > -} > - > -/** > - * t4_get_trace_filter - query one of the tracing filters > - * @adap: the adapter > - * @tp: the current trace filter parameters > - * @idx: which trace filter to query > - * @enabled: non-zero if the filter is enabled > - * > - * Returns the current settings of one of the HW tracing filters. > - */ > -void t4_get_trace_filter(struct adapter *adap, struct trace_params *tp, int idx, > - int *enabled) > -{ > - u32 ctla, ctlb; > - int i, ofst = idx * 4; > - u32 data_reg, mask_reg; > - > - ctla = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst); > - ctlb = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst); > - > - *enabled = !!(ctla & TFEN); > - tp->snap_len = TFCAPTUREMAX_GET(ctlb); > - tp->min_len = TFMINPKTSIZE_GET(ctlb); > - tp->skip_ofst = TFOFFSET_GET(ctla); > - tp->skip_len = TFLENGTH_GET(ctla); > - tp->invert = !!(ctla & TFINVERTMATCH); > - tp->port = TFPORT_GET(ctla); > - > - ofst = (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH) * idx; > - data_reg = MPS_TRC_FILTER0_MATCH + ofst; > - mask_reg = MPS_TRC_FILTER0_DONT_CARE + ofst; > - > - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { > - tp->mask[i] = ~t4_read_reg(adap, mask_reg); > - tp->data[i] = t4_read_reg(adap, data_reg) & tp->mask[i]; > - } > -} > - > -/** > * get_mps_bg_map - return the buffer groups associated with a port > * @adap: the adapter > * @idx: the port index > @@ -2133,52 +1840,6 @@ void t4_get_port_stats(struct adapter *a > } > > /** > - * t4_get_lb_stats - collect loopback port statistics > - * @adap: the adapter > - * @idx: the loopback port index > - * @p: the stats structure to fill > - * > - * Return HW statistics for the given loopback port. > - */ > -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) > -{ > - u32 bgmap = get_mps_bg_map(adap, idx); > - > -#define GET_STAT(name) \ > - t4_read_reg64(adap, PORT_REG(idx, MPS_PORT_STAT_LB_PORT_##name##_L)) > -#define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) > - > - p->octets = GET_STAT(BYTES); > - p->frames = GET_STAT(FRAMES); > - p->bcast_frames = GET_STAT(BCAST); > - p->mcast_frames = GET_STAT(MCAST); > - p->ucast_frames = GET_STAT(UCAST); > - p->error_frames = GET_STAT(ERROR); > - > - p->frames_64 = GET_STAT(64B); > - p->frames_65_127 = GET_STAT(65B_127B); > - p->frames_128_255 = GET_STAT(128B_255B); > - p->frames_256_511 = GET_STAT(256B_511B); > - p->frames_512_1023 = GET_STAT(512B_1023B); > - p->frames_1024_1518 = GET_STAT(1024B_1518B); > - p->frames_1519_max = GET_STAT(1519B_MAX); > - p->drop = t4_read_reg(adap, PORT_REG(idx, > - MPS_PORT_STAT_LB_PORT_DROP_FRAMES)); > - > - p->ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; > - p->ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; > - p->ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; > - p->ovflow3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; > - p->trunc0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; > - p->trunc1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; > - p->trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; > - p->trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; > - > -#undef GET_STAT > -#undef GET_STAT_COM > -} > - > -/** > * t4_wol_magic_enable - enable/disable magic packet WoL > * @adap: the adapter > * @port: the physical port index > @@ -2584,30 +2245,6 @@ int t4_alloc_vi(struct adapter *adap, un > } > > /** > - * t4_free_vi - free a virtual interface > - * @adap: the adapter > - * @mbox: mailbox to use for the FW command > - * @pf: the PF owning the VI > - * @vf: the VF owning the VI > - * @viid: virtual interface identifiler > - * > - * Free a previously allocated virtual interface. > - */ > -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, > - unsigned int vf, unsigned int viid) > -{ > - struct fw_vi_cmd c; > - > - memset(&c, 0, sizeof(c)); > - c.op_to_vfn = htonl(FW_CMD_OP(FW_VI_CMD) | FW_CMD_REQUEST | > - FW_CMD_EXEC | FW_VI_CMD_PFN(pf) | > - FW_VI_CMD_VFN(vf)); > - c.alloc_to_len16 = htonl(FW_VI_CMD_FREE | FW_LEN16(c)); > - c.type_viid = htons(FW_VI_CMD_VIID(viid)); > - return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); > -} > - > -/** > * t4_set_rxmode - set Rx properties of a virtual interface > * @adap: the adapter > * @mbox: mailbox to use for the FW command > @@ -2832,37 +2469,6 @@ int t4_identify_port(struct adapter *ada > return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); > } > > -/** > - * t4_iq_start_stop - enable/disable an ingress queue and its FLs > - * @adap: the adapter > - * @mbox: mailbox to use for the FW command > - * @start: %true to enable the queues, %false to disable them > - * @pf: the PF owning the queues > - * @vf: the VF owning the queues > - * @iqid: ingress queue id > - * @fl0id: FL0 queue id or 0xffff if no attached FL0 > - * @fl1id: FL1 queue id or 0xffff if no attached FL1 > - * > - * Starts or stops an ingress queue and its associated FLs, if any. > - */ > -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, > - unsigned int pf, unsigned int vf, unsigned int iqid, > - unsigned int fl0id, unsigned int fl1id) > -{ > - struct fw_iq_cmd c; > - > - memset(&c, 0, sizeof(c)); > - c.op_to_vfn = htonl(FW_CMD_OP(FW_IQ_CMD) | FW_CMD_REQUEST | > - FW_CMD_EXEC | FW_IQ_CMD_PFN(pf) | > - FW_IQ_CMD_VFN(vf)); > - c.alloc_to_len16 = htonl(FW_IQ_CMD_IQSTART(start) | > - FW_IQ_CMD_IQSTOP(!start) | FW_LEN16(c)); > - c.iqid = htons(iqid); > - c.fl0id = htons(fl0id); > - c.fl1id = htons(fl1id); > - return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); > -} > - > /** > * t4_iq_free - free an ingress queue and its FLs > * @adap: the adapter > > ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/3] cxgb4: function namespace cleanup (v2) 2010-10-15 22:43 ` [PATCH 2/3] cxgb4: " Stephen Hemminger 2010-10-15 23:29 ` Joe Perches 2010-10-15 23:34 ` Dimitris Michailidis @ 2010-10-16 0:10 ` Stephen Hemminger 2010-10-16 1:11 ` Dimitris Michailidis 2 siblings, 1 reply; 20+ messages in thread From: Stephen Hemminger @ 2010-10-16 0:10 UTC (permalink / raw) To: Stephen Hemminger Cc: Divy Le Ray, David S. Miller, Casey Leedom, Dimitris Michailidis, netdev Make functions only used in one file local. Remove lots of dead code, relating to unsupported functions in mainline driver like RSS, IPv6, and TCP offload. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> --- Patch against version in linux-next. It keeps the hooks necessary for iscsi. drivers/net/cxgb4/cxgb4.h | 17 - drivers/net/cxgb4/cxgb4_main.c | 78 -------- drivers/net/cxgb4/cxgb4_uld.h | 8 drivers/net/cxgb4/l2t.c | 34 --- drivers/net/cxgb4/l2t.h | 3 drivers/net/cxgb4/t4_hw.c | 394 ----------------------------------------- 6 files changed, 3 insertions(+), 531 deletions(-) --- a/drivers/net/cxgb4/cxgb4_main.c 2010-10-15 16:58:22.899742447 -0700 +++ b/drivers/net/cxgb4/cxgb4_main.c 2010-10-15 17:02:22.336255220 -0700 @@ -880,7 +880,7 @@ void *t4_alloc_mem(size_t size) /* * Free memory allocated through alloc_mem(). */ -void t4_free_mem(void *addr) +static void t4_free_mem(void *addr) { if (is_vmalloc_addr(addr)) vfree(addr); @@ -2207,8 +2207,8 @@ static void mk_tid_release(struct sk_buf * Queue a TID release request and if necessary schedule a work queue to * process it. */ -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, - unsigned int tid) +static void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, + unsigned int tid) { void **p = &t->tid_tab[tid]; struct adapter *adap = container_of(t, struct adapter, tids); @@ -2223,7 +2223,6 @@ void cxgb4_queue_tid_release(struct tid_ } spin_unlock_bh(&adap->tid_release_lock); } -EXPORT_SYMBOL(cxgb4_queue_tid_release); /* * Process the list of pending TID release requests. @@ -2356,48 +2355,6 @@ int cxgb4_create_server(const struct net EXPORT_SYMBOL(cxgb4_create_server); /** - * cxgb4_create_server6 - create an IPv6 server - * @dev: the device - * @stid: the server TID - * @sip: local IPv6 address to bind server to - * @sport: the server's TCP port - * @queue: queue to direct messages from this server to - * - * Create an IPv6 server for the given port and address. - * Returns <0 on error and one of the %NET_XMIT_* values on success. - */ -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, - const struct in6_addr *sip, __be16 sport, - unsigned int queue) -{ - unsigned int chan; - struct sk_buff *skb; - struct adapter *adap; - struct cpl_pass_open_req6 *req; - - skb = alloc_skb(sizeof(*req), GFP_KERNEL); - if (!skb) - return -ENOMEM; - - adap = netdev2adap(dev); - req = (struct cpl_pass_open_req6 *)__skb_put(skb, sizeof(*req)); - INIT_TP_WR(req, 0); - OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ6, stid)); - req->local_port = sport; - req->peer_port = htons(0); - req->local_ip_hi = *(__be64 *)(sip->s6_addr); - req->local_ip_lo = *(__be64 *)(sip->s6_addr + 8); - req->peer_ip_hi = cpu_to_be64(0); - req->peer_ip_lo = cpu_to_be64(0); - chan = rxq_to_chan(&adap->sge, queue); - req->opt0 = cpu_to_be64(TX_CHAN(chan)); - req->opt1 = cpu_to_be64(CONN_POLICY_ASK | - SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); - return t4_mgmt_tx(adap, skb); -} -EXPORT_SYMBOL(cxgb4_create_server6); - -/** * cxgb4_best_mtu - find the entry in the MTU table closest to an MTU * @mtus: the HW MTU table * @mtu: the target MTU @@ -2456,35 +2413,6 @@ unsigned int cxgb4_port_idx(const struct } EXPORT_SYMBOL(cxgb4_port_idx); -/** - * cxgb4_netdev_by_hwid - return the net device of a HW port - * @pdev: identifies the adapter - * @id: the HW port id - * - * Return the net device associated with the interface with the given HW - * id. - */ -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id) -{ - const struct adapter *adap = pci_get_drvdata(pdev); - - if (!adap || id >= NCHAN) - return NULL; - id = adap->chan_map[id]; - return id < MAX_NPORTS ? adap->port[id] : NULL; -} -EXPORT_SYMBOL(cxgb4_netdev_by_hwid); - -void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6) -{ - struct adapter *adap = pci_get_drvdata(pdev); - - spin_lock(&adap->stats_lock); - t4_tp_get_tcp_stats(adap, v4, v6); - spin_unlock(&adap->stats_lock); -} -EXPORT_SYMBOL(cxgb4_get_tcp_stats); void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, const unsigned int *pgsz_order) --- a/drivers/net/cxgb4/cxgb4_uld.h 2010-10-15 16:58:22.875741593 -0700 +++ b/drivers/net/cxgb4/cxgb4_uld.h 2010-10-15 17:07:33.695516682 -0700 @@ -139,16 +139,11 @@ int cxgb4_alloc_stid(struct tid_info *t, void cxgb4_free_atid(struct tid_info *t, unsigned int atid); void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family); void cxgb4_remove_tid(struct tid_info *t, unsigned int qid, unsigned int tid); -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, - unsigned int tid); struct in6_addr; int cxgb4_create_server(const struct net_device *dev, unsigned int stid, __be32 sip, __be16 sport, unsigned int queue); -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, - const struct in6_addr *sip, __be16 sport, - unsigned int queue); static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue) { @@ -233,11 +228,8 @@ int cxgb4_ofld_send(struct net_device *d unsigned int cxgb4_port_chan(const struct net_device *dev); unsigned int cxgb4_port_viid(const struct net_device *dev); unsigned int cxgb4_port_idx(const struct net_device *dev); -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id); unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu, unsigned int *idx); -void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6); void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, const unsigned int *pgsz_order); struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, --- a/drivers/net/cxgb4/cxgb4.h 2010-10-15 16:58:22.847740597 -0700 +++ b/drivers/net/cxgb4/cxgb4.h 2010-10-15 17:00:42.852719427 -0700 @@ -592,7 +592,6 @@ void t4_os_portmod_changed(const struct void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat); void *t4_alloc_mem(size_t size); -void t4_free_mem(void *addr); void t4_free_sge_resources(struct adapter *adap); irq_handler_t t4_intr_handler(struct adapter *adap); @@ -651,7 +650,6 @@ static inline int t4_wr_mbox_ns(struct a void t4_intr_enable(struct adapter *adapter); void t4_intr_disable(struct adapter *adapter); -void t4_intr_clear(struct adapter *adapter); int t4_slow_intr_handler(struct adapter *adapter); int t4_wait_dev_ready(struct adapter *adap); @@ -664,26 +662,16 @@ int t4_check_fw_version(struct adapter * int t4_prep_adapter(struct adapter *adapter); int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); void t4_fatal_err(struct adapter *adapter); -int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, - int filter_index, int enable); -void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, - int filter_index, int *enabled); int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, int start, int n, const u16 *rspq, unsigned int nrspq); int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, unsigned int flags); -int t4_read_rss(struct adapter *adapter, u16 *entries); int t4_mc_read(struct adapter *adap, u32 addr, __be32 *data, u64 *parity); int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity); void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); - void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); -void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6); void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, const unsigned short *alpha, const unsigned short *beta); @@ -711,8 +699,6 @@ int t4_cfg_pfvf(struct adapter *adap, un int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, unsigned int *rss_size); -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, - unsigned int vf, unsigned int viid); int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, int mtu, int promisc, int all_multi, int bcast, int vlanex, bool sleep_ok); @@ -731,9 +717,6 @@ int t4_mdio_rd(struct adapter *adap, uns unsigned int mmd, unsigned int reg, u16 *valp); int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, unsigned int mmd, unsigned int reg, u16 val); -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, - unsigned int pf, unsigned int vf, unsigned int iqid, - unsigned int fl0id, unsigned int fl1id); int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int iqtype, unsigned int iqid, unsigned int fl0id, unsigned int fl1id); --- a/drivers/net/cxgb4/l2t.c 2010-10-15 16:58:22.883741877 -0700 +++ b/drivers/net/cxgb4/l2t.c 2010-10-15 17:00:42.856719569 -0700 @@ -481,40 +481,6 @@ void t4_l2t_update(struct adapter *adap, handle_failed_resolution(adap, arpq); } -/* - * Allocate an L2T entry for use by a switching rule. Such entries need to be - * explicitly freed and while busy they are not on any hash chain, so normal - * address resolution updates do not see them. - */ -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d) -{ - struct l2t_entry *e; - - write_lock_bh(&d->lock); - e = alloc_l2e(d); - if (e) { - spin_lock(&e->lock); /* avoid race with t4_l2t_free */ - e->state = L2T_STATE_SWITCHING; - atomic_set(&e->refcnt, 1); - spin_unlock(&e->lock); - } - write_unlock_bh(&d->lock); - return e; -} - -/* - * Sets/updates the contents of a switching L2T entry that has been allocated - * with an earlier call to @t4_l2t_alloc_switching. - */ -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, - u8 port, u8 *eth_addr) -{ - e->vlan = vlan; - e->lport = port; - memcpy(e->dmac, eth_addr, ETH_ALEN); - return write_l2e(adap, e, 0); -} - struct l2t_data *t4_init_l2t(void) { int i; --- a/drivers/net/cxgb4/l2t.h 2010-10-15 16:58:22.855740881 -0700 +++ b/drivers/net/cxgb4/l2t.h 2010-10-15 17:00:42.856719569 -0700 @@ -100,9 +100,6 @@ struct l2t_entry *cxgb4_l2t_get(struct l unsigned int priority); void t4_l2t_update(struct adapter *adap, struct neighbour *neigh); -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d); -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, - u8 port, u8 *eth_addr); struct l2t_data *t4_init_l2t(void); void do_l2t_write_rpl(struct adapter *p, const struct cpl_l2t_write_rpl *rpl); --- a/drivers/net/cxgb4/t4_hw.c 2010-10-15 16:58:22.839740313 -0700 +++ b/drivers/net/cxgb4/t4_hw.c 2010-10-15 17:00:42.860719711 -0700 @@ -97,53 +97,6 @@ void t4_set_reg_field(struct adapter *ad (void) t4_read_reg(adapter, addr); /* flush */ } -/** - * t4_read_indirect - read indirectly addressed registers - * @adap: the adapter - * @addr_reg: register holding the indirect address - * @data_reg: register holding the value of the indirect register - * @vals: where the read register values are stored - * @nregs: how many indirect registers to read - * @start_idx: index of first indirect register to read - * - * Reads registers that are accessed indirectly through an address/data - * register pair. - */ -static void t4_read_indirect(struct adapter *adap, unsigned int addr_reg, - unsigned int data_reg, u32 *vals, - unsigned int nregs, unsigned int start_idx) -{ - while (nregs--) { - t4_write_reg(adap, addr_reg, start_idx); - *vals++ = t4_read_reg(adap, data_reg); - start_idx++; - } -} - -#if 0 -/** - * t4_write_indirect - write indirectly addressed registers - * @adap: the adapter - * @addr_reg: register holding the indirect addresses - * @data_reg: register holding the value for the indirect registers - * @vals: values to write - * @nregs: how many indirect registers to write - * @start_idx: address of first indirect register to write - * - * Writes a sequential block of registers that are accessed indirectly - * through an address/data register pair. - */ -static void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, - unsigned int data_reg, const u32 *vals, - unsigned int nregs, unsigned int start_idx) -{ - while (nregs--) { - t4_write_reg(adap, addr_reg, start_idx++); - t4_write_reg(adap, data_reg, *vals++); - } -} -#endif - /* * Get the reply to a mailbox command and store it in @rpl in big-endian order. */ @@ -1560,44 +1513,6 @@ void t4_intr_disable(struct adapter *ada } /** - * t4_intr_clear - clear all interrupts - * @adapter: the adapter whose interrupts should be cleared - * - * Clears all interrupts. The caller must be a PCI function managing - * global interrupts. - */ -void t4_intr_clear(struct adapter *adapter) -{ - static const unsigned int cause_reg[] = { - SGE_INT_CAUSE1, SGE_INT_CAUSE2, SGE_INT_CAUSE3, - PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, - PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, - PCIE_NONFAT_ERR, PCIE_INT_CAUSE, - MC_INT_CAUSE, - MA_INT_WRAP_STATUS, MA_PARITY_ERROR_STATUS, MA_INT_CAUSE, - EDC_INT_CAUSE, EDC_REG(EDC_INT_CAUSE, 1), - CIM_HOST_INT_CAUSE, CIM_HOST_UPACC_INT_CAUSE, - MYPF_REG(CIM_PF_HOST_INT_CAUSE), - TP_INT_CAUSE, - ULP_RX_INT_CAUSE, ULP_TX_INT_CAUSE, - PM_RX_INT_CAUSE, PM_TX_INT_CAUSE, - MPS_RX_PERR_INT_CAUSE, - CPL_INTR_CAUSE, - MYPF_REG(PL_PF_INT_CAUSE), - PL_PL_INT_CAUSE, - LE_DB_INT_CAUSE, - }; - - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(cause_reg); ++i) - t4_write_reg(adapter, cause_reg[i], 0xffffffff); - - t4_write_reg(adapter, PL_INT_CAUSE, GLBL_INTR_MASK); - (void) t4_read_reg(adapter, PL_INT_CAUSE); /* flush */ -} - -/** * hash_mac_addr - return the hash value of a MAC address * @addr: the 48-bit Ethernet MAC address * @@ -1709,98 +1624,6 @@ int t4_config_glbl_rss(struct adapter *a return t4_wr_mbox(adapter, mbox, &c, sizeof(c), NULL); } -/* Read an RSS table row */ -static int rd_rss_row(struct adapter *adap, int row, u32 *val) -{ - t4_write_reg(adap, TP_RSS_LKP_TABLE, 0xfff00000 | row); - return t4_wait_op_done_val(adap, TP_RSS_LKP_TABLE, LKPTBLROWVLD, 1, - 5, 0, val); -} - -/** - * t4_read_rss - read the contents of the RSS mapping table - * @adapter: the adapter - * @map: holds the contents of the RSS mapping table - * - * Reads the contents of the RSS hash->queue mapping table. - */ -int t4_read_rss(struct adapter *adapter, u16 *map) -{ - u32 val; - int i, ret; - - for (i = 0; i < RSS_NENTRIES / 2; ++i) { - ret = rd_rss_row(adapter, i, &val); - if (ret) - return ret; - *map++ = LKPTBLQUEUE0_GET(val); - *map++ = LKPTBLQUEUE1_GET(val); - } - return 0; -} - -/** - * t4_tp_get_tcp_stats - read TP's TCP MIB counters - * @adap: the adapter - * @v4: holds the TCP/IP counter values - * @v6: holds the TCP/IPv6 counter values - * - * Returns the values of TP's TCP/IP and TCP/IPv6 MIB counters. - * Either @v4 or @v6 may be %NULL to skip the corresponding stats. - */ -void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, - struct tp_tcp_stats *v6) -{ - u32 val[TP_MIB_TCP_RXT_SEG_LO - TP_MIB_TCP_OUT_RST + 1]; - -#define STAT_IDX(x) ((TP_MIB_TCP_##x) - TP_MIB_TCP_OUT_RST) -#define STAT(x) val[STAT_IDX(x)] -#define STAT64(x) (((u64)STAT(x##_HI) << 32) | STAT(x##_LO)) - - if (v4) { - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, val, - ARRAY_SIZE(val), TP_MIB_TCP_OUT_RST); - v4->tcpOutRsts = STAT(OUT_RST); - v4->tcpInSegs = STAT64(IN_SEG); - v4->tcpOutSegs = STAT64(OUT_SEG); - v4->tcpRetransSegs = STAT64(RXT_SEG); - } - if (v6) { - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, val, - ARRAY_SIZE(val), TP_MIB_TCP_V6OUT_RST); - v6->tcpOutRsts = STAT(OUT_RST); - v6->tcpInSegs = STAT64(IN_SEG); - v6->tcpOutSegs = STAT64(OUT_SEG); - v6->tcpRetransSegs = STAT64(RXT_SEG); - } -#undef STAT64 -#undef STAT -#undef STAT_IDX -} - -/** - * t4_tp_get_err_stats - read TP's error MIB counters - * @adap: the adapter - * @st: holds the counter values - * - * Returns the values of TP's error counters. - */ -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) -{ - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->macInErrs, - 12, TP_MIB_MAC_IN_ERR_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlCongDrops, - 8, TP_MIB_TNL_CNG_DROP_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlTxDrops, - 4, TP_MIB_TNL_DROP_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->ofldVlanDrops, - 4, TP_MIB_OFD_VLN_DROP_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tcp6InErrs, - 4, TP_MIB_TCP_V6IN_ERR_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, &st->ofldNoNeigh, - 2, TP_MIB_OFD_ARP_DROP); -} - /** * t4_read_mtu_tbl - returns the values in the HW path MTU table * @adap: the adapter @@ -1916,122 +1739,6 @@ void t4_load_mtus(struct adapter *adap, } /** - * t4_set_trace_filter - configure one of the tracing filters - * @adap: the adapter - * @tp: the desired trace filter parameters - * @idx: which filter to configure - * @enable: whether to enable or disable the filter - * - * Configures one of the tracing filters available in HW. If @enable is - * %0 @tp is not examined and may be %NULL. - */ -int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, - int idx, int enable) -{ - int i, ofst = idx * 4; - u32 data_reg, mask_reg, cfg; - u32 multitrc = TRCMULTIFILTER; - - if (!enable) { - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - goto out; - } - - if (tp->port > 11 || tp->invert > 1 || tp->skip_len > 0x1f || - tp->skip_ofst > 0x1f || tp->min_len > 0x1ff || - tp->snap_len > 9600 || (idx && tp->snap_len > 256)) - return -EINVAL; - - if (tp->snap_len > 256) { /* must be tracer 0 */ - if ((t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 4) | - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 8) | - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 12)) & TFEN) - return -EINVAL; /* other tracers are enabled */ - multitrc = 0; - } else if (idx) { - i = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B); - if (TFCAPTUREMAX_GET(i) > 256 && - (t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A) & TFEN)) - return -EINVAL; - } - - /* stop the tracer we'll be changing */ - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - - /* disable tracing globally if running in the wrong single/multi mode */ - cfg = t4_read_reg(adap, MPS_TRC_CFG); - if ((cfg & TRCEN) && multitrc != (cfg & TRCMULTIFILTER)) { - t4_write_reg(adap, MPS_TRC_CFG, cfg ^ TRCEN); - t4_read_reg(adap, MPS_TRC_CFG); /* flush */ - msleep(1); - if (!(t4_read_reg(adap, MPS_TRC_CFG) & TRCFIFOEMPTY)) - return -ETIMEDOUT; - } - /* - * At this point either the tracing is enabled and in the right mode or - * disabled. - */ - - idx *= (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH); - data_reg = MPS_TRC_FILTER0_MATCH + idx; - mask_reg = MPS_TRC_FILTER0_DONT_CARE + idx; - - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { - t4_write_reg(adap, data_reg, tp->data[i]); - t4_write_reg(adap, mask_reg, ~tp->mask[i]); - } - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst, - TFCAPTUREMAX(tp->snap_len) | - TFMINPKTSIZE(tp->min_len)); - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, - TFOFFSET(tp->skip_ofst) | TFLENGTH(tp->skip_len) | - TFPORT(tp->port) | TFEN | - (tp->invert ? TFINVERTMATCH : 0)); - - cfg &= ~TRCMULTIFILTER; - t4_write_reg(adap, MPS_TRC_CFG, cfg | TRCEN | multitrc); -out: t4_read_reg(adap, MPS_TRC_CFG); /* flush */ - return 0; -} - -/** - * t4_get_trace_filter - query one of the tracing filters - * @adap: the adapter - * @tp: the current trace filter parameters - * @idx: which trace filter to query - * @enabled: non-zero if the filter is enabled - * - * Returns the current settings of one of the HW tracing filters. - */ -void t4_get_trace_filter(struct adapter *adap, struct trace_params *tp, int idx, - int *enabled) -{ - u32 ctla, ctlb; - int i, ofst = idx * 4; - u32 data_reg, mask_reg; - - ctla = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst); - ctlb = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst); - - *enabled = !!(ctla & TFEN); - tp->snap_len = TFCAPTUREMAX_GET(ctlb); - tp->min_len = TFMINPKTSIZE_GET(ctlb); - tp->skip_ofst = TFOFFSET_GET(ctla); - tp->skip_len = TFLENGTH_GET(ctla); - tp->invert = !!(ctla & TFINVERTMATCH); - tp->port = TFPORT_GET(ctla); - - ofst = (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH) * idx; - data_reg = MPS_TRC_FILTER0_MATCH + ofst; - mask_reg = MPS_TRC_FILTER0_DONT_CARE + ofst; - - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { - tp->mask[i] = ~t4_read_reg(adap, mask_reg); - tp->data[i] = t4_read_reg(adap, data_reg) & tp->mask[i]; - } -} - -/** * get_mps_bg_map - return the buffer groups associated with a port * @adap: the adapter * @idx: the port index @@ -2133,52 +1840,6 @@ void t4_get_port_stats(struct adapter *a } /** - * t4_get_lb_stats - collect loopback port statistics - * @adap: the adapter - * @idx: the loopback port index - * @p: the stats structure to fill - * - * Return HW statistics for the given loopback port. - */ -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) -{ - u32 bgmap = get_mps_bg_map(adap, idx); - -#define GET_STAT(name) \ - t4_read_reg64(adap, PORT_REG(idx, MPS_PORT_STAT_LB_PORT_##name##_L)) -#define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) - - p->octets = GET_STAT(BYTES); - p->frames = GET_STAT(FRAMES); - p->bcast_frames = GET_STAT(BCAST); - p->mcast_frames = GET_STAT(MCAST); - p->ucast_frames = GET_STAT(UCAST); - p->error_frames = GET_STAT(ERROR); - - p->frames_64 = GET_STAT(64B); - p->frames_65_127 = GET_STAT(65B_127B); - p->frames_128_255 = GET_STAT(128B_255B); - p->frames_256_511 = GET_STAT(256B_511B); - p->frames_512_1023 = GET_STAT(512B_1023B); - p->frames_1024_1518 = GET_STAT(1024B_1518B); - p->frames_1519_max = GET_STAT(1519B_MAX); - p->drop = t4_read_reg(adap, PORT_REG(idx, - MPS_PORT_STAT_LB_PORT_DROP_FRAMES)); - - p->ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; - p->ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; - p->ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; - p->ovflow3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; - p->trunc0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; - p->trunc1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; - p->trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; - p->trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; - -#undef GET_STAT -#undef GET_STAT_COM -} - -/** * t4_wol_magic_enable - enable/disable magic packet WoL * @adap: the adapter * @port: the physical port index @@ -2584,30 +2245,6 @@ int t4_alloc_vi(struct adapter *adap, un } /** - * t4_free_vi - free a virtual interface - * @adap: the adapter - * @mbox: mailbox to use for the FW command - * @pf: the PF owning the VI - * @vf: the VF owning the VI - * @viid: virtual interface identifiler - * - * Free a previously allocated virtual interface. - */ -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, - unsigned int vf, unsigned int viid) -{ - struct fw_vi_cmd c; - - memset(&c, 0, sizeof(c)); - c.op_to_vfn = htonl(FW_CMD_OP(FW_VI_CMD) | FW_CMD_REQUEST | - FW_CMD_EXEC | FW_VI_CMD_PFN(pf) | - FW_VI_CMD_VFN(vf)); - c.alloc_to_len16 = htonl(FW_VI_CMD_FREE | FW_LEN16(c)); - c.type_viid = htons(FW_VI_CMD_VIID(viid)); - return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); -} - -/** * t4_set_rxmode - set Rx properties of a virtual interface * @adap: the adapter * @mbox: mailbox to use for the FW command @@ -2832,37 +2469,6 @@ int t4_identify_port(struct adapter *ada return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); } -/** - * t4_iq_start_stop - enable/disable an ingress queue and its FLs - * @adap: the adapter - * @mbox: mailbox to use for the FW command - * @start: %true to enable the queues, %false to disable them - * @pf: the PF owning the queues - * @vf: the VF owning the queues - * @iqid: ingress queue id - * @fl0id: FL0 queue id or 0xffff if no attached FL0 - * @fl1id: FL1 queue id or 0xffff if no attached FL1 - * - * Starts or stops an ingress queue and its associated FLs, if any. - */ -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, - unsigned int pf, unsigned int vf, unsigned int iqid, - unsigned int fl0id, unsigned int fl1id) -{ - struct fw_iq_cmd c; - - memset(&c, 0, sizeof(c)); - c.op_to_vfn = htonl(FW_CMD_OP(FW_IQ_CMD) | FW_CMD_REQUEST | - FW_CMD_EXEC | FW_IQ_CMD_PFN(pf) | - FW_IQ_CMD_VFN(vf)); - c.alloc_to_len16 = htonl(FW_IQ_CMD_IQSTART(start) | - FW_IQ_CMD_IQSTOP(!start) | FW_LEN16(c)); - c.iqid = htons(iqid); - c.fl0id = htons(fl0id); - c.fl1id = htons(fl1id); - return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); -} - /** * t4_iq_free - free an ingress queue and its FLs * @adap: the adapter ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2) 2010-10-16 0:10 ` [PATCH 2/3] cxgb4: function namespace cleanup (v2) Stephen Hemminger @ 2010-10-16 1:11 ` Dimitris Michailidis 2010-10-16 4:23 ` Stephen Hemminger 0 siblings, 1 reply; 20+ messages in thread From: Dimitris Michailidis @ 2010-10-16 1:11 UTC (permalink / raw) To: Stephen Hemminger Cc: Divy Le Ray, David S. Miller, Casey Leedom, netdev, Steve Wise Stephen Hemminger wrote: > Make functions only used in one file local. > Remove lots of dead code, relating to unsupported functions > in mainline driver like RSS, IPv6, and TCP offload. Thanks, this looks OK. One exception, cxgb4_get_tcp_stats was intended to be used by the rdma driver. I see that driver doesn't call it presently but if you don't mind can we give Steve a few hours to tell us if he has any imminent plans to use it. If he doesn't offer to do something to use it for .37 it goes. > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> > > --- > Patch against version in linux-next. It keeps the hooks > necessary for iscsi. > > drivers/net/cxgb4/cxgb4.h | 17 - > drivers/net/cxgb4/cxgb4_main.c | 78 -------- > drivers/net/cxgb4/cxgb4_uld.h | 8 > drivers/net/cxgb4/l2t.c | 34 --- > drivers/net/cxgb4/l2t.h | 3 > drivers/net/cxgb4/t4_hw.c | 394 ----------------------------------------- > 6 files changed, 3 insertions(+), 531 deletions(-) > > --- a/drivers/net/cxgb4/cxgb4_main.c 2010-10-15 16:58:22.899742447 -0700 > +++ b/drivers/net/cxgb4/cxgb4_main.c 2010-10-15 17:02:22.336255220 -0700 > @@ -880,7 +880,7 @@ void *t4_alloc_mem(size_t size) > /* > * Free memory allocated through alloc_mem(). > */ > -void t4_free_mem(void *addr) > +static void t4_free_mem(void *addr) > { > if (is_vmalloc_addr(addr)) > vfree(addr); > @@ -2207,8 +2207,8 @@ static void mk_tid_release(struct sk_buf > * Queue a TID release request and if necessary schedule a work queue to > * process it. > */ > -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, > - unsigned int tid) > +static void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, > + unsigned int tid) > { > void **p = &t->tid_tab[tid]; > struct adapter *adap = container_of(t, struct adapter, tids); > @@ -2223,7 +2223,6 @@ void cxgb4_queue_tid_release(struct tid_ > } > spin_unlock_bh(&adap->tid_release_lock); > } > -EXPORT_SYMBOL(cxgb4_queue_tid_release); > > /* > * Process the list of pending TID release requests. > @@ -2356,48 +2355,6 @@ int cxgb4_create_server(const struct net > EXPORT_SYMBOL(cxgb4_create_server); > > /** > - * cxgb4_create_server6 - create an IPv6 server > - * @dev: the device > - * @stid: the server TID > - * @sip: local IPv6 address to bind server to > - * @sport: the server's TCP port > - * @queue: queue to direct messages from this server to > - * > - * Create an IPv6 server for the given port and address. > - * Returns <0 on error and one of the %NET_XMIT_* values on success. > - */ > -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, > - const struct in6_addr *sip, __be16 sport, > - unsigned int queue) > -{ > - unsigned int chan; > - struct sk_buff *skb; > - struct adapter *adap; > - struct cpl_pass_open_req6 *req; > - > - skb = alloc_skb(sizeof(*req), GFP_KERNEL); > - if (!skb) > - return -ENOMEM; > - > - adap = netdev2adap(dev); > - req = (struct cpl_pass_open_req6 *)__skb_put(skb, sizeof(*req)); > - INIT_TP_WR(req, 0); > - OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ6, stid)); > - req->local_port = sport; > - req->peer_port = htons(0); > - req->local_ip_hi = *(__be64 *)(sip->s6_addr); > - req->local_ip_lo = *(__be64 *)(sip->s6_addr + 8); > - req->peer_ip_hi = cpu_to_be64(0); > - req->peer_ip_lo = cpu_to_be64(0); > - chan = rxq_to_chan(&adap->sge, queue); > - req->opt0 = cpu_to_be64(TX_CHAN(chan)); > - req->opt1 = cpu_to_be64(CONN_POLICY_ASK | > - SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); > - return t4_mgmt_tx(adap, skb); > -} > -EXPORT_SYMBOL(cxgb4_create_server6); > - > -/** > * cxgb4_best_mtu - find the entry in the MTU table closest to an MTU > * @mtus: the HW MTU table > * @mtu: the target MTU > @@ -2456,35 +2413,6 @@ unsigned int cxgb4_port_idx(const struct > } > EXPORT_SYMBOL(cxgb4_port_idx); > > -/** > - * cxgb4_netdev_by_hwid - return the net device of a HW port > - * @pdev: identifies the adapter > - * @id: the HW port id > - * > - * Return the net device associated with the interface with the given HW > - * id. > - */ > -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id) > -{ > - const struct adapter *adap = pci_get_drvdata(pdev); > - > - if (!adap || id >= NCHAN) > - return NULL; > - id = adap->chan_map[id]; > - return id < MAX_NPORTS ? adap->port[id] : NULL; > -} > -EXPORT_SYMBOL(cxgb4_netdev_by_hwid); > - > -void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, > - struct tp_tcp_stats *v6) > -{ > - struct adapter *adap = pci_get_drvdata(pdev); > - > - spin_lock(&adap->stats_lock); > - t4_tp_get_tcp_stats(adap, v4, v6); > - spin_unlock(&adap->stats_lock); > -} > -EXPORT_SYMBOL(cxgb4_get_tcp_stats); > > void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, > const unsigned int *pgsz_order) > --- a/drivers/net/cxgb4/cxgb4_uld.h 2010-10-15 16:58:22.875741593 -0700 > +++ b/drivers/net/cxgb4/cxgb4_uld.h 2010-10-15 17:07:33.695516682 -0700 > @@ -139,16 +139,11 @@ int cxgb4_alloc_stid(struct tid_info *t, > void cxgb4_free_atid(struct tid_info *t, unsigned int atid); > void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family); > void cxgb4_remove_tid(struct tid_info *t, unsigned int qid, unsigned int tid); > -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, > - unsigned int tid); > > struct in6_addr; > > int cxgb4_create_server(const struct net_device *dev, unsigned int stid, > __be32 sip, __be16 sport, unsigned int queue); > -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, > - const struct in6_addr *sip, __be16 sport, > - unsigned int queue); > > static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue) > { > @@ -233,11 +228,8 @@ int cxgb4_ofld_send(struct net_device *d > unsigned int cxgb4_port_chan(const struct net_device *dev); > unsigned int cxgb4_port_viid(const struct net_device *dev); > unsigned int cxgb4_port_idx(const struct net_device *dev); > -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id); > unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu, > unsigned int *idx); > -void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, > - struct tp_tcp_stats *v6); > void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, > const unsigned int *pgsz_order); > struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, > --- a/drivers/net/cxgb4/cxgb4.h 2010-10-15 16:58:22.847740597 -0700 > +++ b/drivers/net/cxgb4/cxgb4.h 2010-10-15 17:00:42.852719427 -0700 > @@ -592,7 +592,6 @@ void t4_os_portmod_changed(const struct > void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat); > > void *t4_alloc_mem(size_t size); > -void t4_free_mem(void *addr); > > void t4_free_sge_resources(struct adapter *adap); > irq_handler_t t4_intr_handler(struct adapter *adap); > @@ -651,7 +650,6 @@ static inline int t4_wr_mbox_ns(struct a > > void t4_intr_enable(struct adapter *adapter); > void t4_intr_disable(struct adapter *adapter); > -void t4_intr_clear(struct adapter *adapter); > int t4_slow_intr_handler(struct adapter *adapter); > > int t4_wait_dev_ready(struct adapter *adap); > @@ -664,26 +662,16 @@ int t4_check_fw_version(struct adapter * > int t4_prep_adapter(struct adapter *adapter); > int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); > void t4_fatal_err(struct adapter *adapter); > -int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, > - int filter_index, int enable); > -void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, > - int filter_index, int *enabled); > int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, > int start, int n, const u16 *rspq, unsigned int nrspq); > int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, > unsigned int flags); > -int t4_read_rss(struct adapter *adapter, u16 *entries); > int t4_mc_read(struct adapter *adap, u32 addr, __be32 *data, u64 *parity); > int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, > u64 *parity); > > void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); > -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); > - > void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); > -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); > -void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, > - struct tp_tcp_stats *v6); > void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, > const unsigned short *alpha, const unsigned short *beta); > > @@ -711,8 +699,6 @@ int t4_cfg_pfvf(struct adapter *adap, un > int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, > unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, > unsigned int *rss_size); > -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, > - unsigned int vf, unsigned int viid); > int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, > int mtu, int promisc, int all_multi, int bcast, int vlanex, > bool sleep_ok); > @@ -731,9 +717,6 @@ int t4_mdio_rd(struct adapter *adap, uns > unsigned int mmd, unsigned int reg, u16 *valp); > int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, > unsigned int mmd, unsigned int reg, u16 val); > -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, > - unsigned int pf, unsigned int vf, unsigned int iqid, > - unsigned int fl0id, unsigned int fl1id); > int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, > unsigned int vf, unsigned int iqtype, unsigned int iqid, > unsigned int fl0id, unsigned int fl1id); > --- a/drivers/net/cxgb4/l2t.c 2010-10-15 16:58:22.883741877 -0700 > +++ b/drivers/net/cxgb4/l2t.c 2010-10-15 17:00:42.856719569 -0700 > @@ -481,40 +481,6 @@ void t4_l2t_update(struct adapter *adap, > handle_failed_resolution(adap, arpq); > } > > -/* > - * Allocate an L2T entry for use by a switching rule. Such entries need to be > - * explicitly freed and while busy they are not on any hash chain, so normal > - * address resolution updates do not see them. > - */ > -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d) > -{ > - struct l2t_entry *e; > - > - write_lock_bh(&d->lock); > - e = alloc_l2e(d); > - if (e) { > - spin_lock(&e->lock); /* avoid race with t4_l2t_free */ > - e->state = L2T_STATE_SWITCHING; > - atomic_set(&e->refcnt, 1); > - spin_unlock(&e->lock); > - } > - write_unlock_bh(&d->lock); > - return e; > -} > - > -/* > - * Sets/updates the contents of a switching L2T entry that has been allocated > - * with an earlier call to @t4_l2t_alloc_switching. > - */ > -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, > - u8 port, u8 *eth_addr) > -{ > - e->vlan = vlan; > - e->lport = port; > - memcpy(e->dmac, eth_addr, ETH_ALEN); > - return write_l2e(adap, e, 0); > -} > - > struct l2t_data *t4_init_l2t(void) > { > int i; > --- a/drivers/net/cxgb4/l2t.h 2010-10-15 16:58:22.855740881 -0700 > +++ b/drivers/net/cxgb4/l2t.h 2010-10-15 17:00:42.856719569 -0700 > @@ -100,9 +100,6 @@ struct l2t_entry *cxgb4_l2t_get(struct l > unsigned int priority); > > void t4_l2t_update(struct adapter *adap, struct neighbour *neigh); > -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d); > -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, > - u8 port, u8 *eth_addr); > struct l2t_data *t4_init_l2t(void); > void do_l2t_write_rpl(struct adapter *p, const struct cpl_l2t_write_rpl *rpl); > > --- a/drivers/net/cxgb4/t4_hw.c 2010-10-15 16:58:22.839740313 -0700 > +++ b/drivers/net/cxgb4/t4_hw.c 2010-10-15 17:00:42.860719711 -0700 > @@ -97,53 +97,6 @@ void t4_set_reg_field(struct adapter *ad > (void) t4_read_reg(adapter, addr); /* flush */ > } > > -/** > - * t4_read_indirect - read indirectly addressed registers > - * @adap: the adapter > - * @addr_reg: register holding the indirect address > - * @data_reg: register holding the value of the indirect register > - * @vals: where the read register values are stored > - * @nregs: how many indirect registers to read > - * @start_idx: index of first indirect register to read > - * > - * Reads registers that are accessed indirectly through an address/data > - * register pair. > - */ > -static void t4_read_indirect(struct adapter *adap, unsigned int addr_reg, > - unsigned int data_reg, u32 *vals, > - unsigned int nregs, unsigned int start_idx) > -{ > - while (nregs--) { > - t4_write_reg(adap, addr_reg, start_idx); > - *vals++ = t4_read_reg(adap, data_reg); > - start_idx++; > - } > -} > - > -#if 0 > -/** > - * t4_write_indirect - write indirectly addressed registers > - * @adap: the adapter > - * @addr_reg: register holding the indirect addresses > - * @data_reg: register holding the value for the indirect registers > - * @vals: values to write > - * @nregs: how many indirect registers to write > - * @start_idx: address of first indirect register to write > - * > - * Writes a sequential block of registers that are accessed indirectly > - * through an address/data register pair. > - */ > -static void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, > - unsigned int data_reg, const u32 *vals, > - unsigned int nregs, unsigned int start_idx) > -{ > - while (nregs--) { > - t4_write_reg(adap, addr_reg, start_idx++); > - t4_write_reg(adap, data_reg, *vals++); > - } > -} > -#endif > - > /* > * Get the reply to a mailbox command and store it in @rpl in big-endian order. > */ > @@ -1560,44 +1513,6 @@ void t4_intr_disable(struct adapter *ada > } > > /** > - * t4_intr_clear - clear all interrupts > - * @adapter: the adapter whose interrupts should be cleared > - * > - * Clears all interrupts. The caller must be a PCI function managing > - * global interrupts. > - */ > -void t4_intr_clear(struct adapter *adapter) > -{ > - static const unsigned int cause_reg[] = { > - SGE_INT_CAUSE1, SGE_INT_CAUSE2, SGE_INT_CAUSE3, > - PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, > - PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, > - PCIE_NONFAT_ERR, PCIE_INT_CAUSE, > - MC_INT_CAUSE, > - MA_INT_WRAP_STATUS, MA_PARITY_ERROR_STATUS, MA_INT_CAUSE, > - EDC_INT_CAUSE, EDC_REG(EDC_INT_CAUSE, 1), > - CIM_HOST_INT_CAUSE, CIM_HOST_UPACC_INT_CAUSE, > - MYPF_REG(CIM_PF_HOST_INT_CAUSE), > - TP_INT_CAUSE, > - ULP_RX_INT_CAUSE, ULP_TX_INT_CAUSE, > - PM_RX_INT_CAUSE, PM_TX_INT_CAUSE, > - MPS_RX_PERR_INT_CAUSE, > - CPL_INTR_CAUSE, > - MYPF_REG(PL_PF_INT_CAUSE), > - PL_PL_INT_CAUSE, > - LE_DB_INT_CAUSE, > - }; > - > - unsigned int i; > - > - for (i = 0; i < ARRAY_SIZE(cause_reg); ++i) > - t4_write_reg(adapter, cause_reg[i], 0xffffffff); > - > - t4_write_reg(adapter, PL_INT_CAUSE, GLBL_INTR_MASK); > - (void) t4_read_reg(adapter, PL_INT_CAUSE); /* flush */ > -} > - > -/** > * hash_mac_addr - return the hash value of a MAC address > * @addr: the 48-bit Ethernet MAC address > * > @@ -1709,98 +1624,6 @@ int t4_config_glbl_rss(struct adapter *a > return t4_wr_mbox(adapter, mbox, &c, sizeof(c), NULL); > } > > -/* Read an RSS table row */ > -static int rd_rss_row(struct adapter *adap, int row, u32 *val) > -{ > - t4_write_reg(adap, TP_RSS_LKP_TABLE, 0xfff00000 | row); > - return t4_wait_op_done_val(adap, TP_RSS_LKP_TABLE, LKPTBLROWVLD, 1, > - 5, 0, val); > -} > - > -/** > - * t4_read_rss - read the contents of the RSS mapping table > - * @adapter: the adapter > - * @map: holds the contents of the RSS mapping table > - * > - * Reads the contents of the RSS hash->queue mapping table. > - */ > -int t4_read_rss(struct adapter *adapter, u16 *map) > -{ > - u32 val; > - int i, ret; > - > - for (i = 0; i < RSS_NENTRIES / 2; ++i) { > - ret = rd_rss_row(adapter, i, &val); > - if (ret) > - return ret; > - *map++ = LKPTBLQUEUE0_GET(val); > - *map++ = LKPTBLQUEUE1_GET(val); > - } > - return 0; > -} > - > -/** > - * t4_tp_get_tcp_stats - read TP's TCP MIB counters > - * @adap: the adapter > - * @v4: holds the TCP/IP counter values > - * @v6: holds the TCP/IPv6 counter values > - * > - * Returns the values of TP's TCP/IP and TCP/IPv6 MIB counters. > - * Either @v4 or @v6 may be %NULL to skip the corresponding stats. > - */ > -void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, > - struct tp_tcp_stats *v6) > -{ > - u32 val[TP_MIB_TCP_RXT_SEG_LO - TP_MIB_TCP_OUT_RST + 1]; > - > -#define STAT_IDX(x) ((TP_MIB_TCP_##x) - TP_MIB_TCP_OUT_RST) > -#define STAT(x) val[STAT_IDX(x)] > -#define STAT64(x) (((u64)STAT(x##_HI) << 32) | STAT(x##_LO)) > - > - if (v4) { > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, val, > - ARRAY_SIZE(val), TP_MIB_TCP_OUT_RST); > - v4->tcpOutRsts = STAT(OUT_RST); > - v4->tcpInSegs = STAT64(IN_SEG); > - v4->tcpOutSegs = STAT64(OUT_SEG); > - v4->tcpRetransSegs = STAT64(RXT_SEG); > - } > - if (v6) { > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, val, > - ARRAY_SIZE(val), TP_MIB_TCP_V6OUT_RST); > - v6->tcpOutRsts = STAT(OUT_RST); > - v6->tcpInSegs = STAT64(IN_SEG); > - v6->tcpOutSegs = STAT64(OUT_SEG); > - v6->tcpRetransSegs = STAT64(RXT_SEG); > - } > -#undef STAT64 > -#undef STAT > -#undef STAT_IDX > -} > - > -/** > - * t4_tp_get_err_stats - read TP's error MIB counters > - * @adap: the adapter > - * @st: holds the counter values > - * > - * Returns the values of TP's error counters. > - */ > -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) > -{ > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->macInErrs, > - 12, TP_MIB_MAC_IN_ERR_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlCongDrops, > - 8, TP_MIB_TNL_CNG_DROP_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlTxDrops, > - 4, TP_MIB_TNL_DROP_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->ofldVlanDrops, > - 4, TP_MIB_OFD_VLN_DROP_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tcp6InErrs, > - 4, TP_MIB_TCP_V6IN_ERR_0); > - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, &st->ofldNoNeigh, > - 2, TP_MIB_OFD_ARP_DROP); > -} > - > /** > * t4_read_mtu_tbl - returns the values in the HW path MTU table > * @adap: the adapter > @@ -1916,122 +1739,6 @@ void t4_load_mtus(struct adapter *adap, > } > > /** > - * t4_set_trace_filter - configure one of the tracing filters > - * @adap: the adapter > - * @tp: the desired trace filter parameters > - * @idx: which filter to configure > - * @enable: whether to enable or disable the filter > - * > - * Configures one of the tracing filters available in HW. If @enable is > - * %0 @tp is not examined and may be %NULL. > - */ > -int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, > - int idx, int enable) > -{ > - int i, ofst = idx * 4; > - u32 data_reg, mask_reg, cfg; > - u32 multitrc = TRCMULTIFILTER; > - > - if (!enable) { > - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); > - goto out; > - } > - > - if (tp->port > 11 || tp->invert > 1 || tp->skip_len > 0x1f || > - tp->skip_ofst > 0x1f || tp->min_len > 0x1ff || > - tp->snap_len > 9600 || (idx && tp->snap_len > 256)) > - return -EINVAL; > - > - if (tp->snap_len > 256) { /* must be tracer 0 */ > - if ((t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 4) | > - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 8) | > - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 12)) & TFEN) > - return -EINVAL; /* other tracers are enabled */ > - multitrc = 0; > - } else if (idx) { > - i = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B); > - if (TFCAPTUREMAX_GET(i) > 256 && > - (t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A) & TFEN)) > - return -EINVAL; > - } > - > - /* stop the tracer we'll be changing */ > - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); > - > - /* disable tracing globally if running in the wrong single/multi mode */ > - cfg = t4_read_reg(adap, MPS_TRC_CFG); > - if ((cfg & TRCEN) && multitrc != (cfg & TRCMULTIFILTER)) { > - t4_write_reg(adap, MPS_TRC_CFG, cfg ^ TRCEN); > - t4_read_reg(adap, MPS_TRC_CFG); /* flush */ > - msleep(1); > - if (!(t4_read_reg(adap, MPS_TRC_CFG) & TRCFIFOEMPTY)) > - return -ETIMEDOUT; > - } > - /* > - * At this point either the tracing is enabled and in the right mode or > - * disabled. > - */ > - > - idx *= (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH); > - data_reg = MPS_TRC_FILTER0_MATCH + idx; > - mask_reg = MPS_TRC_FILTER0_DONT_CARE + idx; > - > - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { > - t4_write_reg(adap, data_reg, tp->data[i]); > - t4_write_reg(adap, mask_reg, ~tp->mask[i]); > - } > - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst, > - TFCAPTUREMAX(tp->snap_len) | > - TFMINPKTSIZE(tp->min_len)); > - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, > - TFOFFSET(tp->skip_ofst) | TFLENGTH(tp->skip_len) | > - TFPORT(tp->port) | TFEN | > - (tp->invert ? TFINVERTMATCH : 0)); > - > - cfg &= ~TRCMULTIFILTER; > - t4_write_reg(adap, MPS_TRC_CFG, cfg | TRCEN | multitrc); > -out: t4_read_reg(adap, MPS_TRC_CFG); /* flush */ > - return 0; > -} > - > -/** > - * t4_get_trace_filter - query one of the tracing filters > - * @adap: the adapter > - * @tp: the current trace filter parameters > - * @idx: which trace filter to query > - * @enabled: non-zero if the filter is enabled > - * > - * Returns the current settings of one of the HW tracing filters. > - */ > -void t4_get_trace_filter(struct adapter *adap, struct trace_params *tp, int idx, > - int *enabled) > -{ > - u32 ctla, ctlb; > - int i, ofst = idx * 4; > - u32 data_reg, mask_reg; > - > - ctla = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst); > - ctlb = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst); > - > - *enabled = !!(ctla & TFEN); > - tp->snap_len = TFCAPTUREMAX_GET(ctlb); > - tp->min_len = TFMINPKTSIZE_GET(ctlb); > - tp->skip_ofst = TFOFFSET_GET(ctla); > - tp->skip_len = TFLENGTH_GET(ctla); > - tp->invert = !!(ctla & TFINVERTMATCH); > - tp->port = TFPORT_GET(ctla); > - > - ofst = (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH) * idx; > - data_reg = MPS_TRC_FILTER0_MATCH + ofst; > - mask_reg = MPS_TRC_FILTER0_DONT_CARE + ofst; > - > - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { > - tp->mask[i] = ~t4_read_reg(adap, mask_reg); > - tp->data[i] = t4_read_reg(adap, data_reg) & tp->mask[i]; > - } > -} > - > -/** > * get_mps_bg_map - return the buffer groups associated with a port > * @adap: the adapter > * @idx: the port index > @@ -2133,52 +1840,6 @@ void t4_get_port_stats(struct adapter *a > } > > /** > - * t4_get_lb_stats - collect loopback port statistics > - * @adap: the adapter > - * @idx: the loopback port index > - * @p: the stats structure to fill > - * > - * Return HW statistics for the given loopback port. > - */ > -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) > -{ > - u32 bgmap = get_mps_bg_map(adap, idx); > - > -#define GET_STAT(name) \ > - t4_read_reg64(adap, PORT_REG(idx, MPS_PORT_STAT_LB_PORT_##name##_L)) > -#define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) > - > - p->octets = GET_STAT(BYTES); > - p->frames = GET_STAT(FRAMES); > - p->bcast_frames = GET_STAT(BCAST); > - p->mcast_frames = GET_STAT(MCAST); > - p->ucast_frames = GET_STAT(UCAST); > - p->error_frames = GET_STAT(ERROR); > - > - p->frames_64 = GET_STAT(64B); > - p->frames_65_127 = GET_STAT(65B_127B); > - p->frames_128_255 = GET_STAT(128B_255B); > - p->frames_256_511 = GET_STAT(256B_511B); > - p->frames_512_1023 = GET_STAT(512B_1023B); > - p->frames_1024_1518 = GET_STAT(1024B_1518B); > - p->frames_1519_max = GET_STAT(1519B_MAX); > - p->drop = t4_read_reg(adap, PORT_REG(idx, > - MPS_PORT_STAT_LB_PORT_DROP_FRAMES)); > - > - p->ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; > - p->ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; > - p->ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; > - p->ovflow3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; > - p->trunc0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; > - p->trunc1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; > - p->trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; > - p->trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; > - > -#undef GET_STAT > -#undef GET_STAT_COM > -} > - > -/** > * t4_wol_magic_enable - enable/disable magic packet WoL > * @adap: the adapter > * @port: the physical port index > @@ -2584,30 +2245,6 @@ int t4_alloc_vi(struct adapter *adap, un > } > > /** > - * t4_free_vi - free a virtual interface > - * @adap: the adapter > - * @mbox: mailbox to use for the FW command > - * @pf: the PF owning the VI > - * @vf: the VF owning the VI > - * @viid: virtual interface identifiler > - * > - * Free a previously allocated virtual interface. > - */ > -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, > - unsigned int vf, unsigned int viid) > -{ > - struct fw_vi_cmd c; > - > - memset(&c, 0, sizeof(c)); > - c.op_to_vfn = htonl(FW_CMD_OP(FW_VI_CMD) | FW_CMD_REQUEST | > - FW_CMD_EXEC | FW_VI_CMD_PFN(pf) | > - FW_VI_CMD_VFN(vf)); > - c.alloc_to_len16 = htonl(FW_VI_CMD_FREE | FW_LEN16(c)); > - c.type_viid = htons(FW_VI_CMD_VIID(viid)); > - return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); > -} > - > -/** > * t4_set_rxmode - set Rx properties of a virtual interface > * @adap: the adapter > * @mbox: mailbox to use for the FW command > @@ -2832,37 +2469,6 @@ int t4_identify_port(struct adapter *ada > return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); > } > > -/** > - * t4_iq_start_stop - enable/disable an ingress queue and its FLs > - * @adap: the adapter > - * @mbox: mailbox to use for the FW command > - * @start: %true to enable the queues, %false to disable them > - * @pf: the PF owning the queues > - * @vf: the VF owning the queues > - * @iqid: ingress queue id > - * @fl0id: FL0 queue id or 0xffff if no attached FL0 > - * @fl1id: FL1 queue id or 0xffff if no attached FL1 > - * > - * Starts or stops an ingress queue and its associated FLs, if any. > - */ > -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, > - unsigned int pf, unsigned int vf, unsigned int iqid, > - unsigned int fl0id, unsigned int fl1id) > -{ > - struct fw_iq_cmd c; > - > - memset(&c, 0, sizeof(c)); > - c.op_to_vfn = htonl(FW_CMD_OP(FW_IQ_CMD) | FW_CMD_REQUEST | > - FW_CMD_EXEC | FW_IQ_CMD_PFN(pf) | > - FW_IQ_CMD_VFN(vf)); > - c.alloc_to_len16 = htonl(FW_IQ_CMD_IQSTART(start) | > - FW_IQ_CMD_IQSTOP(!start) | FW_LEN16(c)); > - c.iqid = htons(iqid); > - c.fl0id = htons(fl0id); > - c.fl1id = htons(fl1id); > - return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); > -} > - > /** > * t4_iq_free - free an ingress queue and its FLs > * @adap: the adapter ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2) 2010-10-16 1:11 ` Dimitris Michailidis @ 2010-10-16 4:23 ` Stephen Hemminger 2010-10-16 6:16 ` Dimitris Michailidis 0 siblings, 1 reply; 20+ messages in thread From: Stephen Hemminger @ 2010-10-16 4:23 UTC (permalink / raw) To: Dimitris Michailidis Cc: Divy Le Ray, David S. Miller, Casey Leedom, netdev, Steve Wise On Fri, 15 Oct 2010 18:11:42 -0700 Dimitris Michailidis <dm@chelsio.com> wrote: > Stephen Hemminger wrote: > > Make functions only used in one file local. > > Remove lots of dead code, relating to unsupported functions > > in mainline driver like RSS, IPv6, and TCP offload. > > Thanks, this looks OK. One exception, cxgb4_get_tcp_stats was intended to > be used by the rdma driver. I see that driver doesn't call it presently but > if you don't mind can we give Steve a few hours to tell us if he has any > imminent plans to use it. If he doesn't offer to do something to use it for > .37 it goes. The kernel source tree is not your development place holder tree. At least #ifdef the code out for now. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2) 2010-10-16 4:23 ` Stephen Hemminger @ 2010-10-16 6:16 ` Dimitris Michailidis 2010-10-17 3:30 ` Steve Wise 0 siblings, 1 reply; 20+ messages in thread From: Dimitris Michailidis @ 2010-10-16 6:16 UTC (permalink / raw) To: Stephen Hemminger Cc: Divy Le Ray, David S. Miller, Casey Leedom, netdev, Steve Wise Stephen Hemminger wrote: > On Fri, 15 Oct 2010 18:11:42 -0700 > Dimitris Michailidis <dm@chelsio.com> wrote: > >> Stephen Hemminger wrote: >>> Make functions only used in one file local. >>> Remove lots of dead code, relating to unsupported functions >>> in mainline driver like RSS, IPv6, and TCP offload. >> Thanks, this looks OK. One exception, cxgb4_get_tcp_stats was intended to >> be used by the rdma driver. I see that driver doesn't call it presently but >> if you don't mind can we give Steve a few hours to tell us if he has any >> imminent plans to use it. If he doesn't offer to do something to use it for >> .37 it goes. > > The kernel source tree is not your development place holder tree. > At least #ifdef the code out for now. I am trying to protect Stephen Rothwell's time by checking that the IB folks don't plan to add a call to this in their tree while we remove the function in net-next. There's supposed to be a call in the IB driver. I don't know why there isn't one or whether they are planning to fix it for .37. I see the potential for a linux-next conflict and I am trying to avoid it. #ifdef doesn't help, if it's not needed we can remove it for good. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2) 2010-10-16 6:16 ` Dimitris Michailidis @ 2010-10-17 3:30 ` Steve Wise 2010-10-18 14:31 ` David Miller 2010-10-18 14:47 ` [PATCH 2/3] cxgb4: function namespace cleanup (v2) Stephen Hemminger 0 siblings, 2 replies; 20+ messages in thread From: Steve Wise @ 2010-10-17 3:30 UTC (permalink / raw) To: Dimitris Michailidis Cc: Stephen Hemminger, Divy Le Ray, David S. Miller, Casey Leedom, netdev On 10/16/2010 1:16 AM, Dimitris Michailidis wrote: > Stephen Hemminger wrote: >> On Fri, 15 Oct 2010 18:11:42 -0700 >> Dimitris Michailidis <dm@chelsio.com> wrote: >> >>> Stephen Hemminger wrote: >>>> Make functions only used in one file local. >>>> Remove lots of dead code, relating to unsupported functions >>>> in mainline driver like RSS, IPv6, and TCP offload. >>> Thanks, this looks OK. One exception, cxgb4_get_tcp_stats was >>> intended to be used by the rdma driver. I see that driver doesn't >>> call it presently but if you don't mind can we give Steve a few >>> hours to tell us if he has any imminent plans to use it. If he >>> doesn't offer to do something to use it for .37 it goes. >> >> The kernel source tree is not your development place holder tree. >> At least #ifdef the code out for now. > > I am trying to protect Stephen Rothwell's time by checking that the IB > folks don't plan to add a call to this in their tree while we remove > the function in net-next. There's supposed to be a call in the IB > driver. I don't know why there isn't one or whether they are planning > to fix it for .37. I see the potential for a linux-next conflict and > I am trying to avoid it. #ifdef doesn't help, if it's not needed we > can remove it for good. I'll add a patch this week to utilize the tcp stats. Steve. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2) 2010-10-17 3:30 ` Steve Wise @ 2010-10-18 14:31 ` David Miller 2010-10-18 15:39 ` [PATCH 2/3] cxgb4: function namespace cleanup (v3) Stephen Hemminger 2010-10-18 14:47 ` [PATCH 2/3] cxgb4: function namespace cleanup (v2) Stephen Hemminger 1 sibling, 1 reply; 20+ messages in thread From: David Miller @ 2010-10-18 14:31 UTC (permalink / raw) To: swise; +Cc: dm, shemminger, divy, leedom, netdev From: Steve Wise <swise@opengridcomputing.com> Date: Sat, 16 Oct 2010 22:30:16 -0500 > I'll add a patch this week to utilize the tcp stats. Ok, thanks Steve. Stephen, please respin the two cxgb4 patches without the tcp stat function removal. ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/3] cxgb4: function namespace cleanup (v3) 2010-10-18 14:31 ` David Miller @ 2010-10-18 15:39 ` Stephen Hemminger 2010-10-18 23:16 ` Dimitris Michailidis 0 siblings, 1 reply; 20+ messages in thread From: Stephen Hemminger @ 2010-10-18 15:39 UTC (permalink / raw) To: David Miller; +Cc: swise, dm, divy, leedom, netdev Make functions only used in one file local. Remove lots of dead code, relating to unsupported functions in mainline driver like RSS, IPv6, and TCP offload. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> --- Patch against version in linux-next. It keeps the hooks necessary for iscsi and get_tcp_stats. drivers/net/cxgb4/cxgb4.h | 15 - drivers/net/cxgb4/cxgb4_main.c | 68 -------- drivers/net/cxgb4/cxgb4_uld.h | 6 drivers/net/cxgb4/l2t.c | 34 ---- drivers/net/cxgb4/l2t.h | 3 drivers/net/cxgb4/t4_hw.c | 332 ----------------------------------------- 6 files changed, 3 insertions(+), 455 deletions(-) --- a/drivers/net/cxgb4/cxgb4_main.c 2010-10-18 08:33:48.369371944 -0700 +++ b/drivers/net/cxgb4/cxgb4_main.c 2010-10-18 08:34:44.910406405 -0700 @@ -880,7 +880,7 @@ void *t4_alloc_mem(size_t size) /* * Free memory allocated through alloc_mem(). */ -void t4_free_mem(void *addr) +static void t4_free_mem(void *addr) { if (is_vmalloc_addr(addr)) vfree(addr); @@ -2206,8 +2206,8 @@ static void mk_tid_release(struct sk_buf * Queue a TID release request and if necessary schedule a work queue to * process it. */ -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, - unsigned int tid) +static void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, + unsigned int tid) { void **p = &t->tid_tab[tid]; struct adapter *adap = container_of(t, struct adapter, tids); @@ -2222,7 +2222,6 @@ void cxgb4_queue_tid_release(struct tid_ } spin_unlock_bh(&adap->tid_release_lock); } -EXPORT_SYMBOL(cxgb4_queue_tid_release); /* * Process the list of pending TID release requests. @@ -2355,48 +2354,6 @@ int cxgb4_create_server(const struct net EXPORT_SYMBOL(cxgb4_create_server); /** - * cxgb4_create_server6 - create an IPv6 server - * @dev: the device - * @stid: the server TID - * @sip: local IPv6 address to bind server to - * @sport: the server's TCP port - * @queue: queue to direct messages from this server to - * - * Create an IPv6 server for the given port and address. - * Returns <0 on error and one of the %NET_XMIT_* values on success. - */ -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, - const struct in6_addr *sip, __be16 sport, - unsigned int queue) -{ - unsigned int chan; - struct sk_buff *skb; - struct adapter *adap; - struct cpl_pass_open_req6 *req; - - skb = alloc_skb(sizeof(*req), GFP_KERNEL); - if (!skb) - return -ENOMEM; - - adap = netdev2adap(dev); - req = (struct cpl_pass_open_req6 *)__skb_put(skb, sizeof(*req)); - INIT_TP_WR(req, 0); - OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ6, stid)); - req->local_port = sport; - req->peer_port = htons(0); - req->local_ip_hi = *(__be64 *)(sip->s6_addr); - req->local_ip_lo = *(__be64 *)(sip->s6_addr + 8); - req->peer_ip_hi = cpu_to_be64(0); - req->peer_ip_lo = cpu_to_be64(0); - chan = rxq_to_chan(&adap->sge, queue); - req->opt0 = cpu_to_be64(TX_CHAN(chan)); - req->opt1 = cpu_to_be64(CONN_POLICY_ASK | - SYN_RSS_ENABLE | SYN_RSS_QUEUE(queue)); - return t4_mgmt_tx(adap, skb); -} -EXPORT_SYMBOL(cxgb4_create_server6); - -/** * cxgb4_best_mtu - find the entry in the MTU table closest to an MTU * @mtus: the HW MTU table * @mtu: the target MTU @@ -2455,25 +2412,6 @@ unsigned int cxgb4_port_idx(const struct } EXPORT_SYMBOL(cxgb4_port_idx); -/** - * cxgb4_netdev_by_hwid - return the net device of a HW port - * @pdev: identifies the adapter - * @id: the HW port id - * - * Return the net device associated with the interface with the given HW - * id. - */ -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id) -{ - const struct adapter *adap = pci_get_drvdata(pdev); - - if (!adap || id >= NCHAN) - return NULL; - id = adap->chan_map[id]; - return id < MAX_NPORTS ? adap->port[id] : NULL; -} -EXPORT_SYMBOL(cxgb4_netdev_by_hwid); - void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, struct tp_tcp_stats *v6) { --- a/drivers/net/cxgb4/cxgb4_uld.h 2010-10-18 08:33:48.339371406 -0700 +++ b/drivers/net/cxgb4/cxgb4_uld.h 2010-10-18 08:34:44.910406405 -0700 @@ -139,16 +139,11 @@ int cxgb4_alloc_stid(struct tid_info *t, void cxgb4_free_atid(struct tid_info *t, unsigned int atid); void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family); void cxgb4_remove_tid(struct tid_info *t, unsigned int qid, unsigned int tid); -void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan, - unsigned int tid); struct in6_addr; int cxgb4_create_server(const struct net_device *dev, unsigned int stid, __be32 sip, __be16 sport, unsigned int queue); -int cxgb4_create_server6(const struct net_device *dev, unsigned int stid, - const struct in6_addr *sip, __be16 sport, - unsigned int queue); static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue) { @@ -233,7 +228,6 @@ int cxgb4_ofld_send(struct net_device *d unsigned int cxgb4_port_chan(const struct net_device *dev); unsigned int cxgb4_port_viid(const struct net_device *dev); unsigned int cxgb4_port_idx(const struct net_device *dev); -struct net_device *cxgb4_netdev_by_hwid(struct pci_dev *pdev, unsigned int id); unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu, unsigned int *idx); void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4, --- a/drivers/net/cxgb4/cxgb4.h 2010-10-18 08:33:48.319371031 -0700 +++ b/drivers/net/cxgb4/cxgb4.h 2010-10-18 08:34:44.910406405 -0700 @@ -592,7 +592,6 @@ void t4_os_portmod_changed(const struct void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat); void *t4_alloc_mem(size_t size); -void t4_free_mem(void *addr); void t4_free_sge_resources(struct adapter *adap); irq_handler_t t4_intr_handler(struct adapter *adap); @@ -651,7 +650,6 @@ static inline int t4_wr_mbox_ns(struct a void t4_intr_enable(struct adapter *adapter); void t4_intr_disable(struct adapter *adapter); -void t4_intr_clear(struct adapter *adapter); int t4_slow_intr_handler(struct adapter *adapter); int t4_wait_dev_ready(struct adapter *adap); @@ -664,24 +662,16 @@ int t4_check_fw_version(struct adapter * int t4_prep_adapter(struct adapter *adapter); int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); void t4_fatal_err(struct adapter *adapter); -int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, - int filter_index, int enable); -void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, - int filter_index, int *enabled); int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, int start, int n, const u16 *rspq, unsigned int nrspq); int t4_config_glbl_rss(struct adapter *adapter, int mbox, unsigned int mode, unsigned int flags); -int t4_read_rss(struct adapter *adapter, u16 *entries); int t4_mc_read(struct adapter *adap, u32 addr, __be32 *data, u64 *parity); int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity); void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p); - void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log); -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st); void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, struct tp_tcp_stats *v6); void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, @@ -711,8 +701,6 @@ int t4_cfg_pfvf(struct adapter *adap, un int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, unsigned int *rss_size); -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, - unsigned int vf, unsigned int viid); int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, int mtu, int promisc, int all_multi, int bcast, int vlanex, bool sleep_ok); @@ -731,9 +719,6 @@ int t4_mdio_rd(struct adapter *adap, uns unsigned int mmd, unsigned int reg, u16 *valp); int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, unsigned int mmd, unsigned int reg, u16 val); -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, - unsigned int pf, unsigned int vf, unsigned int iqid, - unsigned int fl0id, unsigned int fl1id); int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int iqtype, unsigned int iqid, unsigned int fl0id, unsigned int fl1id); --- a/drivers/net/cxgb4/l2t.c 2010-10-18 08:33:48.349371585 -0700 +++ b/drivers/net/cxgb4/l2t.c 2010-10-18 08:34:44.920406584 -0700 @@ -481,40 +481,6 @@ void t4_l2t_update(struct adapter *adap, handle_failed_resolution(adap, arpq); } -/* - * Allocate an L2T entry for use by a switching rule. Such entries need to be - * explicitly freed and while busy they are not on any hash chain, so normal - * address resolution updates do not see them. - */ -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d) -{ - struct l2t_entry *e; - - write_lock_bh(&d->lock); - e = alloc_l2e(d); - if (e) { - spin_lock(&e->lock); /* avoid race with t4_l2t_free */ - e->state = L2T_STATE_SWITCHING; - atomic_set(&e->refcnt, 1); - spin_unlock(&e->lock); - } - write_unlock_bh(&d->lock); - return e; -} - -/* - * Sets/updates the contents of a switching L2T entry that has been allocated - * with an earlier call to @t4_l2t_alloc_switching. - */ -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, - u8 port, u8 *eth_addr) -{ - e->vlan = vlan; - e->lport = port; - memcpy(e->dmac, eth_addr, ETH_ALEN); - return write_l2e(adap, e, 0); -} - struct l2t_data *t4_init_l2t(void) { int i; --- a/drivers/net/cxgb4/l2t.h 2010-10-18 08:33:48.329371216 -0700 +++ b/drivers/net/cxgb4/l2t.h 2010-10-18 08:34:44.920406584 -0700 @@ -100,9 +100,6 @@ struct l2t_entry *cxgb4_l2t_get(struct l unsigned int priority); void t4_l2t_update(struct adapter *adap, struct neighbour *neigh); -struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d); -int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, - u8 port, u8 *eth_addr); struct l2t_data *t4_init_l2t(void); void do_l2t_write_rpl(struct adapter *p, const struct cpl_l2t_write_rpl *rpl); --- a/drivers/net/cxgb4/t4_hw.c 2010-10-18 08:33:48.309370846 -0700 +++ b/drivers/net/cxgb4/t4_hw.c 2010-10-18 08:34:44.920406584 -0700 @@ -120,30 +120,6 @@ static void t4_read_indirect(struct adap } } -#if 0 -/** - * t4_write_indirect - write indirectly addressed registers - * @adap: the adapter - * @addr_reg: register holding the indirect addresses - * @data_reg: register holding the value for the indirect registers - * @vals: values to write - * @nregs: how many indirect registers to write - * @start_idx: address of first indirect register to write - * - * Writes a sequential block of registers that are accessed indirectly - * through an address/data register pair. - */ -static void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, - unsigned int data_reg, const u32 *vals, - unsigned int nregs, unsigned int start_idx) -{ - while (nregs--) { - t4_write_reg(adap, addr_reg, start_idx++); - t4_write_reg(adap, data_reg, *vals++); - } -} -#endif - /* * Get the reply to a mailbox command and store it in @rpl in big-endian order. */ @@ -1560,44 +1536,6 @@ void t4_intr_disable(struct adapter *ada } /** - * t4_intr_clear - clear all interrupts - * @adapter: the adapter whose interrupts should be cleared - * - * Clears all interrupts. The caller must be a PCI function managing - * global interrupts. - */ -void t4_intr_clear(struct adapter *adapter) -{ - static const unsigned int cause_reg[] = { - SGE_INT_CAUSE1, SGE_INT_CAUSE2, SGE_INT_CAUSE3, - PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, - PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, - PCIE_NONFAT_ERR, PCIE_INT_CAUSE, - MC_INT_CAUSE, - MA_INT_WRAP_STATUS, MA_PARITY_ERROR_STATUS, MA_INT_CAUSE, - EDC_INT_CAUSE, EDC_REG(EDC_INT_CAUSE, 1), - CIM_HOST_INT_CAUSE, CIM_HOST_UPACC_INT_CAUSE, - MYPF_REG(CIM_PF_HOST_INT_CAUSE), - TP_INT_CAUSE, - ULP_RX_INT_CAUSE, ULP_TX_INT_CAUSE, - PM_RX_INT_CAUSE, PM_TX_INT_CAUSE, - MPS_RX_PERR_INT_CAUSE, - CPL_INTR_CAUSE, - MYPF_REG(PL_PF_INT_CAUSE), - PL_PL_INT_CAUSE, - LE_DB_INT_CAUSE, - }; - - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(cause_reg); ++i) - t4_write_reg(adapter, cause_reg[i], 0xffffffff); - - t4_write_reg(adapter, PL_INT_CAUSE, GLBL_INTR_MASK); - (void) t4_read_reg(adapter, PL_INT_CAUSE); /* flush */ -} - -/** * hash_mac_addr - return the hash value of a MAC address * @addr: the 48-bit Ethernet MAC address * @@ -1709,36 +1647,6 @@ int t4_config_glbl_rss(struct adapter *a return t4_wr_mbox(adapter, mbox, &c, sizeof(c), NULL); } -/* Read an RSS table row */ -static int rd_rss_row(struct adapter *adap, int row, u32 *val) -{ - t4_write_reg(adap, TP_RSS_LKP_TABLE, 0xfff00000 | row); - return t4_wait_op_done_val(adap, TP_RSS_LKP_TABLE, LKPTBLROWVLD, 1, - 5, 0, val); -} - -/** - * t4_read_rss - read the contents of the RSS mapping table - * @adapter: the adapter - * @map: holds the contents of the RSS mapping table - * - * Reads the contents of the RSS hash->queue mapping table. - */ -int t4_read_rss(struct adapter *adapter, u16 *map) -{ - u32 val; - int i, ret; - - for (i = 0; i < RSS_NENTRIES / 2; ++i) { - ret = rd_rss_row(adapter, i, &val); - if (ret) - return ret; - *map++ = LKPTBLQUEUE0_GET(val); - *map++ = LKPTBLQUEUE1_GET(val); - } - return 0; -} - /** * t4_tp_get_tcp_stats - read TP's TCP MIB counters * @adap: the adapter @@ -1779,29 +1687,6 @@ void t4_tp_get_tcp_stats(struct adapter } /** - * t4_tp_get_err_stats - read TP's error MIB counters - * @adap: the adapter - * @st: holds the counter values - * - * Returns the values of TP's error counters. - */ -void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) -{ - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->macInErrs, - 12, TP_MIB_MAC_IN_ERR_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlCongDrops, - 8, TP_MIB_TNL_CNG_DROP_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tnlTxDrops, - 4, TP_MIB_TNL_DROP_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->ofldVlanDrops, - 4, TP_MIB_OFD_VLN_DROP_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, st->tcp6InErrs, - 4, TP_MIB_TCP_V6IN_ERR_0); - t4_read_indirect(adap, TP_MIB_INDEX, TP_MIB_DATA, &st->ofldNoNeigh, - 2, TP_MIB_OFD_ARP_DROP); -} - -/** * t4_read_mtu_tbl - returns the values in the HW path MTU table * @adap: the adapter * @mtus: where to store the MTU values @@ -1916,122 +1801,6 @@ void t4_load_mtus(struct adapter *adap, } /** - * t4_set_trace_filter - configure one of the tracing filters - * @adap: the adapter - * @tp: the desired trace filter parameters - * @idx: which filter to configure - * @enable: whether to enable or disable the filter - * - * Configures one of the tracing filters available in HW. If @enable is - * %0 @tp is not examined and may be %NULL. - */ -int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, - int idx, int enable) -{ - int i, ofst = idx * 4; - u32 data_reg, mask_reg, cfg; - u32 multitrc = TRCMULTIFILTER; - - if (!enable) { - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - goto out; - } - - if (tp->port > 11 || tp->invert > 1 || tp->skip_len > 0x1f || - tp->skip_ofst > 0x1f || tp->min_len > 0x1ff || - tp->snap_len > 9600 || (idx && tp->snap_len > 256)) - return -EINVAL; - - if (tp->snap_len > 256) { /* must be tracer 0 */ - if ((t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 4) | - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 8) | - t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + 12)) & TFEN) - return -EINVAL; /* other tracers are enabled */ - multitrc = 0; - } else if (idx) { - i = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B); - if (TFCAPTUREMAX_GET(i) > 256 && - (t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A) & TFEN)) - return -EINVAL; - } - - /* stop the tracer we'll be changing */ - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, 0); - - /* disable tracing globally if running in the wrong single/multi mode */ - cfg = t4_read_reg(adap, MPS_TRC_CFG); - if ((cfg & TRCEN) && multitrc != (cfg & TRCMULTIFILTER)) { - t4_write_reg(adap, MPS_TRC_CFG, cfg ^ TRCEN); - t4_read_reg(adap, MPS_TRC_CFG); /* flush */ - msleep(1); - if (!(t4_read_reg(adap, MPS_TRC_CFG) & TRCFIFOEMPTY)) - return -ETIMEDOUT; - } - /* - * At this point either the tracing is enabled and in the right mode or - * disabled. - */ - - idx *= (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH); - data_reg = MPS_TRC_FILTER0_MATCH + idx; - mask_reg = MPS_TRC_FILTER0_DONT_CARE + idx; - - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { - t4_write_reg(adap, data_reg, tp->data[i]); - t4_write_reg(adap, mask_reg, ~tp->mask[i]); - } - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst, - TFCAPTUREMAX(tp->snap_len) | - TFMINPKTSIZE(tp->min_len)); - t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst, - TFOFFSET(tp->skip_ofst) | TFLENGTH(tp->skip_len) | - TFPORT(tp->port) | TFEN | - (tp->invert ? TFINVERTMATCH : 0)); - - cfg &= ~TRCMULTIFILTER; - t4_write_reg(adap, MPS_TRC_CFG, cfg | TRCEN | multitrc); -out: t4_read_reg(adap, MPS_TRC_CFG); /* flush */ - return 0; -} - -/** - * t4_get_trace_filter - query one of the tracing filters - * @adap: the adapter - * @tp: the current trace filter parameters - * @idx: which trace filter to query - * @enabled: non-zero if the filter is enabled - * - * Returns the current settings of one of the HW tracing filters. - */ -void t4_get_trace_filter(struct adapter *adap, struct trace_params *tp, int idx, - int *enabled) -{ - u32 ctla, ctlb; - int i, ofst = idx * 4; - u32 data_reg, mask_reg; - - ctla = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A + ofst); - ctlb = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B + ofst); - - *enabled = !!(ctla & TFEN); - tp->snap_len = TFCAPTUREMAX_GET(ctlb); - tp->min_len = TFMINPKTSIZE_GET(ctlb); - tp->skip_ofst = TFOFFSET_GET(ctla); - tp->skip_len = TFLENGTH_GET(ctla); - tp->invert = !!(ctla & TFINVERTMATCH); - tp->port = TFPORT_GET(ctla); - - ofst = (MPS_TRC_FILTER1_MATCH - MPS_TRC_FILTER0_MATCH) * idx; - data_reg = MPS_TRC_FILTER0_MATCH + ofst; - mask_reg = MPS_TRC_FILTER0_DONT_CARE + ofst; - - for (i = 0; i < TRACE_LEN / 4; i++, data_reg += 4, mask_reg += 4) { - tp->mask[i] = ~t4_read_reg(adap, mask_reg); - tp->data[i] = t4_read_reg(adap, data_reg) & tp->mask[i]; - } -} - -/** * get_mps_bg_map - return the buffer groups associated with a port * @adap: the adapter * @idx: the port index @@ -2133,52 +1902,6 @@ void t4_get_port_stats(struct adapter *a } /** - * t4_get_lb_stats - collect loopback port statistics - * @adap: the adapter - * @idx: the loopback port index - * @p: the stats structure to fill - * - * Return HW statistics for the given loopback port. - */ -void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) -{ - u32 bgmap = get_mps_bg_map(adap, idx); - -#define GET_STAT(name) \ - t4_read_reg64(adap, PORT_REG(idx, MPS_PORT_STAT_LB_PORT_##name##_L)) -#define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) - - p->octets = GET_STAT(BYTES); - p->frames = GET_STAT(FRAMES); - p->bcast_frames = GET_STAT(BCAST); - p->mcast_frames = GET_STAT(MCAST); - p->ucast_frames = GET_STAT(UCAST); - p->error_frames = GET_STAT(ERROR); - - p->frames_64 = GET_STAT(64B); - p->frames_65_127 = GET_STAT(65B_127B); - p->frames_128_255 = GET_STAT(128B_255B); - p->frames_256_511 = GET_STAT(256B_511B); - p->frames_512_1023 = GET_STAT(512B_1023B); - p->frames_1024_1518 = GET_STAT(1024B_1518B); - p->frames_1519_max = GET_STAT(1519B_MAX); - p->drop = t4_read_reg(adap, PORT_REG(idx, - MPS_PORT_STAT_LB_PORT_DROP_FRAMES)); - - p->ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; - p->ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; - p->ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; - p->ovflow3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; - p->trunc0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; - p->trunc1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; - p->trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; - p->trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; - -#undef GET_STAT -#undef GET_STAT_COM -} - -/** * t4_wol_magic_enable - enable/disable magic packet WoL * @adap: the adapter * @port: the physical port index @@ -2584,30 +2307,6 @@ int t4_alloc_vi(struct adapter *adap, un } /** - * t4_free_vi - free a virtual interface - * @adap: the adapter - * @mbox: mailbox to use for the FW command - * @pf: the PF owning the VI - * @vf: the VF owning the VI - * @viid: virtual interface identifiler - * - * Free a previously allocated virtual interface. - */ -int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, - unsigned int vf, unsigned int viid) -{ - struct fw_vi_cmd c; - - memset(&c, 0, sizeof(c)); - c.op_to_vfn = htonl(FW_CMD_OP(FW_VI_CMD) | FW_CMD_REQUEST | - FW_CMD_EXEC | FW_VI_CMD_PFN(pf) | - FW_VI_CMD_VFN(vf)); - c.alloc_to_len16 = htonl(FW_VI_CMD_FREE | FW_LEN16(c)); - c.type_viid = htons(FW_VI_CMD_VIID(viid)); - return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); -} - -/** * t4_set_rxmode - set Rx properties of a virtual interface * @adap: the adapter * @mbox: mailbox to use for the FW command @@ -2832,37 +2531,6 @@ int t4_identify_port(struct adapter *ada return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); } -/** - * t4_iq_start_stop - enable/disable an ingress queue and its FLs - * @adap: the adapter - * @mbox: mailbox to use for the FW command - * @start: %true to enable the queues, %false to disable them - * @pf: the PF owning the queues - * @vf: the VF owning the queues - * @iqid: ingress queue id - * @fl0id: FL0 queue id or 0xffff if no attached FL0 - * @fl1id: FL1 queue id or 0xffff if no attached FL1 - * - * Starts or stops an ingress queue and its associated FLs, if any. - */ -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, - unsigned int pf, unsigned int vf, unsigned int iqid, - unsigned int fl0id, unsigned int fl1id) -{ - struct fw_iq_cmd c; - - memset(&c, 0, sizeof(c)); - c.op_to_vfn = htonl(FW_CMD_OP(FW_IQ_CMD) | FW_CMD_REQUEST | - FW_CMD_EXEC | FW_IQ_CMD_PFN(pf) | - FW_IQ_CMD_VFN(vf)); - c.alloc_to_len16 = htonl(FW_IQ_CMD_IQSTART(start) | - FW_IQ_CMD_IQSTOP(!start) | FW_LEN16(c)); - c.iqid = htons(iqid); - c.fl0id = htons(fl0id); - c.fl1id = htons(fl1id); - return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); -} - /** * t4_iq_free - free an ingress queue and its FLs * @adap: the adapter ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v3) 2010-10-18 15:39 ` [PATCH 2/3] cxgb4: function namespace cleanup (v3) Stephen Hemminger @ 2010-10-18 23:16 ` Dimitris Michailidis 2010-10-21 11:30 ` David Miller 0 siblings, 1 reply; 20+ messages in thread From: Dimitris Michailidis @ 2010-10-18 23:16 UTC (permalink / raw) To: Stephen Hemminger; +Cc: David Miller, swise, divy, leedom, netdev Stephen Hemminger wrote: > Make functions only used in one file local. > Remove lots of dead code, relating to unsupported functions > in mainline driver like RSS, IPv6, and TCP offload. > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Dimitris Michailidis <dm@chelsio.com> Thanks much. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v3) 2010-10-18 23:16 ` Dimitris Michailidis @ 2010-10-21 11:30 ` David Miller 0 siblings, 0 replies; 20+ messages in thread From: David Miller @ 2010-10-21 11:30 UTC (permalink / raw) To: dm; +Cc: shemminger, swise, divy, leedom, netdev From: Dimitris Michailidis <dm@chelsio.com> Date: Mon, 18 Oct 2010 16:16:24 -0700 > Stephen Hemminger wrote: >> Make functions only used in one file local. >> Remove lots of dead code, relating to unsupported functions >> in mainline driver like RSS, IPv6, and TCP offload. >> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> > > Acked-by: Dimitris Michailidis <dm@chelsio.com> Applied. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2) 2010-10-17 3:30 ` Steve Wise 2010-10-18 14:31 ` David Miller @ 2010-10-18 14:47 ` Stephen Hemminger 2010-10-18 14:53 ` Steve Wise 1 sibling, 1 reply; 20+ messages in thread From: Stephen Hemminger @ 2010-10-18 14:47 UTC (permalink / raw) To: Steve Wise Cc: Dimitris Michailidis, Divy Le Ray, David S. Miller, Casey Leedom, netdev On Sat, 16 Oct 2010 22:30:16 -0500 Steve Wise <swise@opengridcomputing.com> wrote: > > On 10/16/2010 1:16 AM, Dimitris Michailidis wrote: > > Stephen Hemminger wrote: > >> On Fri, 15 Oct 2010 18:11:42 -0700 > >> Dimitris Michailidis <dm@chelsio.com> wrote: > >> > >>> Stephen Hemminger wrote: > >>>> Make functions only used in one file local. > >>>> Remove lots of dead code, relating to unsupported functions > >>>> in mainline driver like RSS, IPv6, and TCP offload. > >>> Thanks, this looks OK. One exception, cxgb4_get_tcp_stats was > >>> intended to be used by the rdma driver. I see that driver doesn't > >>> call it presently but if you don't mind can we give Steve a few > >>> hours to tell us if he has any imminent plans to use it. If he > >>> doesn't offer to do something to use it for .37 it goes. > >> > >> The kernel source tree is not your development place holder tree. > >> At least #ifdef the code out for now. > > > > I am trying to protect Stephen Rothwell's time by checking that the IB > > folks don't plan to add a call to this in their tree while we remove > > the function in net-next. There's supposed to be a call in the IB > > driver. I don't know why there isn't one or whether they are planning > > to fix it for .37. I see the potential for a linux-next conflict and > > I am trying to avoid it. #ifdef doesn't help, if it's not needed we > > can remove it for good. > > I'll add a patch this week to utilize the tcp stats. In cxgb4 only or both cxgb3 and cxgb4? ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] cxgb4: function namespace cleanup (v2) 2010-10-18 14:47 ` [PATCH 2/3] cxgb4: function namespace cleanup (v2) Stephen Hemminger @ 2010-10-18 14:53 ` Steve Wise 0 siblings, 0 replies; 20+ messages in thread From: Steve Wise @ 2010-10-18 14:53 UTC (permalink / raw) To: Stephen Hemminger Cc: Dimitris Michailidis, Divy Le Ray, David S. Miller, Casey Leedom, netdev On 10/18/2010 09:47 AM, Stephen Hemminger wrote: > On Sat, 16 Oct 2010 22:30:16 -0500 > Steve Wise<swise@opengridcomputing.com> wrote: > > >> On 10/16/2010 1:16 AM, Dimitris Michailidis wrote: >> >>> Stephen Hemminger wrote: >>> >>>> On Fri, 15 Oct 2010 18:11:42 -0700 >>>> Dimitris Michailidis<dm@chelsio.com> wrote: >>>> >>>> >>>>> Stephen Hemminger wrote: >>>>> >>>>>> Make functions only used in one file local. >>>>>> Remove lots of dead code, relating to unsupported functions >>>>>> in mainline driver like RSS, IPv6, and TCP offload. >>>>>> >>>>> Thanks, this looks OK. One exception, cxgb4_get_tcp_stats was >>>>> intended to be used by the rdma driver. I see that driver doesn't >>>>> call it presently but if you don't mind can we give Steve a few >>>>> hours to tell us if he has any imminent plans to use it. If he >>>>> doesn't offer to do something to use it for .37 it goes. >>>>> >>>> The kernel source tree is not your development place holder tree. >>>> At least #ifdef the code out for now. >>>> >>> I am trying to protect Stephen Rothwell's time by checking that the IB >>> folks don't plan to add a call to this in their tree while we remove >>> the function in net-next. There's supposed to be a call in the IB >>> driver. I don't know why there isn't one or whether they are planning >>> to fix it for .37. I see the potential for a linux-next conflict and >>> I am trying to avoid it. #ifdef doesn't help, if it's not needed we >>> can remove it for good. >>> >> I'll add a patch this week to utilize the tcp stats. >> > In cxgb4 only or both cxgb3 and cxgb4? > iw_cxgb3 already uses the cxgb3 TCP MIB. Steve. ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 3/3] cxgb4vf: function namespace cleanup 2010-10-15 22:43 [PATCH 0/3] Chelsio driver namespace cleanups Stephen Hemminger 2010-10-15 22:43 ` [PATCH 1/3] cxgb3: function namespace cleanup Stephen Hemminger 2010-10-15 22:43 ` [PATCH 2/3] cxgb4: " Stephen Hemminger @ 2010-10-15 22:43 ` Stephen Hemminger 2 siblings, 0 replies; 20+ messages in thread From: Stephen Hemminger @ 2010-10-15 22:43 UTC (permalink / raw) To: Divy Le Ray, David S. Miller, Casey Leedom, Dimitris Michailidis; +Cc: netdev [-- Attachment #1: cxgb4vf-local.patch --] [-- Type: text/plain, Size: 2603 bytes --] Where possible make functions local. Compile tested only Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> --- drivers/net/cxgb4vf/sge.c | 6 +++--- drivers/net/cxgb4vf/t4vf_common.h | 1 - drivers/net/cxgb4vf/t4vf_hw.c | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) --- a/drivers/net/cxgb4vf/sge.c 2010-10-15 13:35:37.841741143 -0700 +++ b/drivers/net/cxgb4vf/sge.c 2010-10-15 13:37:26.753998981 -0700 @@ -1361,7 +1361,7 @@ out_free: * Releases the pages of a packet gather list. We do not own the last * page on the list and do not free it. */ -void t4vf_pktgl_free(const struct pkt_gl *gl) +static void t4vf_pktgl_free(const struct pkt_gl *gl) { int frag; @@ -1636,7 +1636,7 @@ static inline void rspq_next(struct sge_ * on this queue. If the system is under memory shortage use a fairly * long delay to help recovery. */ -int process_responses(struct sge_rspq *rspq, int budget) +static int process_responses(struct sge_rspq *rspq, int budget) { struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); int budget_left = budget; @@ -1888,7 +1888,7 @@ static unsigned int process_intrq(struct * The MSI interrupt handler handles data events from SGE response queues as * well as error and other async events as they all use the same MSI vector. */ -irqreturn_t t4vf_intr_msi(int irq, void *cookie) +static irqreturn_t t4vf_intr_msi(int irq, void *cookie) { struct adapter *adapter = cookie; --- a/drivers/net/cxgb4vf/t4vf_common.h 2010-10-15 13:38:12.555553059 -0700 +++ b/drivers/net/cxgb4vf/t4vf_common.h 2010-10-15 13:38:30.716055176 -0700 @@ -235,7 +235,6 @@ static inline int t4vf_wr_mbox_ns(struct int __devinit t4vf_wait_dev_ready(struct adapter *); int __devinit t4vf_port_init(struct adapter *, int); -int t4vf_query_params(struct adapter *, unsigned int, const u32 *, u32 *); int t4vf_set_params(struct adapter *, unsigned int, const u32 *, const u32 *); int t4vf_get_sge_params(struct adapter *); --- a/drivers/net/cxgb4vf/t4vf_hw.c 2010-10-15 13:35:44.638006598 -0700 +++ b/drivers/net/cxgb4vf/t4vf_hw.c 2010-10-15 13:38:04.503330665 -0700 @@ -335,8 +335,8 @@ int __devinit t4vf_port_init(struct adap * Reads the values of firmware or device parameters. Up to 7 parameters * can be queried at once. */ -int t4vf_query_params(struct adapter *adapter, unsigned int nparams, - const u32 *params, u32 *vals) +static int t4vf_query_params(struct adapter *adapter, unsigned int nparams, + const u32 *params, u32 *vals) { int i, ret; struct fw_params_cmd cmd, rpl; ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2010-10-21 14:19 UTC | newest] Thread overview: 20+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-10-15 22:43 [PATCH 0/3] Chelsio driver namespace cleanups Stephen Hemminger 2010-10-15 22:43 ` [PATCH 1/3] cxgb3: function namespace cleanup Stephen Hemminger 2010-10-19 1:14 ` Divy Le Ray 2010-10-21 14:19 ` David Miller 2010-10-15 22:43 ` [PATCH 2/3] cxgb4: " Stephen Hemminger 2010-10-15 23:29 ` Joe Perches 2010-10-15 23:50 ` Stephen Hemminger 2010-10-15 23:34 ` Dimitris Michailidis 2010-10-16 0:10 ` [PATCH 2/3] cxgb4: function namespace cleanup (v2) Stephen Hemminger 2010-10-16 1:11 ` Dimitris Michailidis 2010-10-16 4:23 ` Stephen Hemminger 2010-10-16 6:16 ` Dimitris Michailidis 2010-10-17 3:30 ` Steve Wise 2010-10-18 14:31 ` David Miller 2010-10-18 15:39 ` [PATCH 2/3] cxgb4: function namespace cleanup (v3) Stephen Hemminger 2010-10-18 23:16 ` Dimitris Michailidis 2010-10-21 11:30 ` David Miller 2010-10-18 14:47 ` [PATCH 2/3] cxgb4: function namespace cleanup (v2) Stephen Hemminger 2010-10-18 14:53 ` Steve Wise 2010-10-15 22:43 ` [PATCH 3/3] cxgb4vf: function namespace cleanup Stephen Hemminger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).