aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/cxgb3_offload.c
diff options
context:
space:
mode:
authorKaren Xie <kxie@chelsio.com>2008-12-19 01:56:20 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-19 01:56:20 -0500
commita109a5b916bc180e14fad0d1e9c37a08c85652c0 (patch)
tree03bf2fffff72aeb2dc881091bb728c83251598c8 /drivers/net/cxgb3/cxgb3_offload.c
parent221b3d60cbb2740ec7d46a4f1ea6d3318a112e51 (diff)
cxgb3: manage private iSCSI IP address
The accelerated iSCSI traffic could use a private IP address unknown to the OS: - The IP address is required in both drivers to manage ARP requests and connection set up. - Added an control call to retrieve the ip address. - Reply to ARP requests dedicated to the private IP address. Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: Karen Xie <kxie@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3/cxgb3_offload.c')
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c67
1 files changed, 49 insertions, 18 deletions
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index 265aa8a15afa..1ce69b742804 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -182,7 +182,9 @@ static struct net_device *get_iff_from_mac(struct adapter *adapter,
182static int cxgb_ulp_iscsi_ctl(struct adapter *adapter, unsigned int req, 182static int cxgb_ulp_iscsi_ctl(struct adapter *adapter, unsigned int req,
183 void *data) 183 void *data)
184{ 184{
185 int i;
185 int ret = 0; 186 int ret = 0;
187 unsigned int val = 0;
186 struct ulp_iscsi_info *uiip = data; 188 struct ulp_iscsi_info *uiip = data;
187 189
188 switch (req) { 190 switch (req) {
@@ -191,32 +193,55 @@ static int cxgb_ulp_iscsi_ctl(struct adapter *adapter, unsigned int req,
191 uiip->llimit = t3_read_reg(adapter, A_ULPRX_ISCSI_LLIMIT); 193 uiip->llimit = t3_read_reg(adapter, A_ULPRX_ISCSI_LLIMIT);
192 uiip->ulimit = t3_read_reg(adapter, A_ULPRX_ISCSI_ULIMIT); 194 uiip->ulimit = t3_read_reg(adapter, A_ULPRX_ISCSI_ULIMIT);
193 uiip->tagmask = t3_read_reg(adapter, A_ULPRX_ISCSI_TAGMASK); 195 uiip->tagmask = t3_read_reg(adapter, A_ULPRX_ISCSI_TAGMASK);
196
197 val = t3_read_reg(adapter, A_ULPRX_ISCSI_PSZ);
198 for (i = 0; i < 4; i++, val >>= 8)
199 uiip->pgsz_factor[i] = val & 0xFF;
200
201 val = t3_read_reg(adapter, A_TP_PARA_REG7);
202 uiip->max_txsz =
203 uiip->max_rxsz = min((val >> S_PMMAXXFERLEN0)&M_PMMAXXFERLEN0,
204 (val >> S_PMMAXXFERLEN1)&M_PMMAXXFERLEN1);
194 /* 205 /*
195 * On tx, the iscsi pdu has to be <= tx page size and has to 206 * On tx, the iscsi pdu has to be <= tx page size and has to
196 * fit into the Tx PM FIFO. 207 * fit into the Tx PM FIFO.
197 */ 208 */
198 uiip->max_txsz = min(adapter->params.tp.tx_pg_size, 209 val = min(adapter->params.tp.tx_pg_size,
199 t3_read_reg(adapter, A_PM1_TX_CFG) >> 17); 210 t3_read_reg(adapter, A_PM1_TX_CFG) >> 17);
200 /* on rx, the iscsi pdu has to be < rx page size and the 211 uiip->max_txsz = min(val, uiip->max_txsz);
201 whole pdu + cpl headers has to fit into one sge buffer */ 212
202 uiip->max_rxsz = min_t(unsigned int, 213 /* set MaxRxData to 16224 */
203 adapter->params.tp.rx_pg_size, 214 val = t3_read_reg(adapter, A_TP_PARA_REG2);
204 (adapter->sge.qs[0].fl[1].buf_size - 215 if ((val >> S_MAXRXDATA) != 0x3f60) {
205 sizeof(struct cpl_rx_data) * 2 - 216 val &= (M_RXCOALESCESIZE << S_RXCOALESCESIZE);
206 sizeof(struct cpl_rx_data_ddp))); 217 val |= V_MAXRXDATA(0x3f60);
218 printk(KERN_INFO
219 "%s, iscsi set MaxRxData to 16224 (0x%x).\n",
220 adapter->name, val);
221 t3_write_reg(adapter, A_TP_PARA_REG2, val);
222 }
223
224 /*
225 * on rx, the iscsi pdu has to be < rx page size and the
226 * the max rx data length programmed in TP
227 */
228 val = min(adapter->params.tp.rx_pg_size,
229 ((t3_read_reg(adapter, A_TP_PARA_REG2)) >>
230 S_MAXRXDATA) & M_MAXRXDATA);
231 uiip->max_rxsz = min(val, uiip->max_rxsz);
207 break; 232 break;
208 case ULP_ISCSI_SET_PARAMS: 233 case ULP_ISCSI_SET_PARAMS:
209 t3_write_reg(adapter, A_ULPRX_ISCSI_TAGMASK, uiip->tagmask); 234 t3_write_reg(adapter, A_ULPRX_ISCSI_TAGMASK, uiip->tagmask);
210 /* set MaxRxData and MaxCoalesceSize to 16224 */
211 t3_write_reg(adapter, A_TP_PARA_REG2, 0x3f603f60);
212 /* program the ddp page sizes */ 235 /* program the ddp page sizes */
213 { 236 for (i = 0; i < 4; i++)
214 int i; 237 val |= (uiip->pgsz_factor[i] & 0xF) << (8 * i);
215 unsigned int val = 0; 238 if (val && (val != t3_read_reg(adapter, A_ULPRX_ISCSI_PSZ))) {
216 for (i = 0; i < 4; i++) 239 printk(KERN_INFO
217 val |= (uiip->pgsz_factor[i] & 0xF) << (8 * i); 240 "%s, setting iscsi pgsz 0x%x, %u,%u,%u,%u.\n",
218 if (val) 241 adapter->name, val, uiip->pgsz_factor[0],
219 t3_write_reg(adapter, A_ULPRX_ISCSI_PSZ, val); 242 uiip->pgsz_factor[1], uiip->pgsz_factor[2],
243 uiip->pgsz_factor[3]);
244 t3_write_reg(adapter, A_ULPRX_ISCSI_PSZ, val);
220 } 245 }
221 break; 246 break;
222 default: 247 default:
@@ -407,6 +432,12 @@ static int cxgb_offload_ctl(struct t3cdev *tdev, unsigned int req, void *data)
407 rx_page_info->page_size = tp->rx_pg_size; 432 rx_page_info->page_size = tp->rx_pg_size;
408 rx_page_info->num = tp->rx_num_pgs; 433 rx_page_info->num = tp->rx_num_pgs;
409 break; 434 break;
435 case GET_ISCSI_IPV4ADDR: {
436 struct iscsi_ipv4addr *p = data;
437 struct port_info *pi = netdev_priv(p->dev);
438 p->ipv4addr = pi->iscsi_ipv4addr;
439 break;
440 }
410 default: 441 default:
411 return -EOPNOTSUPP; 442 return -EOPNOTSUPP;
412 } 443 }