aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/cxgb3_main.c
diff options
context:
space:
mode:
authorKaren Xie <kxie@chelsio.com>2009-10-08 05:11:05 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-13 06:44:06 -0400
commitf14d42f314cb45a080bf84ecadf8b9b1eebbe9fd (patch)
treefb89056f265802233d87db2a41d3d35646665878 /drivers/net/cxgb3/cxgb3_main.c
parentbcd5149ded6b2edbf3732fa1483600a716b1cba6 (diff)
cxgb3: Added private MAC address and provisioning packet handler for iSCSI
This patch added support of private MAC address per port and provisioning packet handler for iSCSI traffic only. The above changes are isolated to the cxgb3 driver, independent of any scsi or iscsi driver changes. Acked-by: Karen Xie <kxie@chelsio.com> Acked-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: Rakesh Ranjan <rakesh@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3/cxgb3_main.c')
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 34e776c5f06b..c9113d3297ee 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -344,8 +344,10 @@ static void link_start(struct net_device *dev)
344 344
345 init_rx_mode(&rm, dev, dev->mc_list); 345 init_rx_mode(&rm, dev, dev->mc_list);
346 t3_mac_reset(mac); 346 t3_mac_reset(mac);
347 t3_mac_set_num_ucast(mac, MAX_MAC_IDX);
347 t3_mac_set_mtu(mac, dev->mtu); 348 t3_mac_set_mtu(mac, dev->mtu);
348 t3_mac_set_address(mac, 0, dev->dev_addr); 349 t3_mac_set_address(mac, LAN_MAC_IDX, dev->dev_addr);
350 t3_mac_set_address(mac, SAN_MAC_IDX, pi->iscsic.mac_addr);
349 t3_mac_set_rx_mode(mac, &rm); 351 t3_mac_set_rx_mode(mac, &rm);
350 t3_link_start(&pi->phy, mac, &pi->link_config); 352 t3_link_start(&pi->phy, mac, &pi->link_config);
351 t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX); 353 t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
@@ -903,6 +905,7 @@ static inline int offload_tx(struct t3cdev *tdev, struct sk_buff *skb)
903static int write_smt_entry(struct adapter *adapter, int idx) 905static int write_smt_entry(struct adapter *adapter, int idx)
904{ 906{
905 struct cpl_smt_write_req *req; 907 struct cpl_smt_write_req *req;
908 struct port_info *pi = netdev_priv(adapter->port[idx]);
906 struct sk_buff *skb = alloc_skb(sizeof(*req), GFP_KERNEL); 909 struct sk_buff *skb = alloc_skb(sizeof(*req), GFP_KERNEL);
907 910
908 if (!skb) 911 if (!skb)
@@ -913,8 +916,8 @@ static int write_smt_entry(struct adapter *adapter, int idx)
913 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, idx)); 916 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, idx));
914 req->mtu_idx = NMTUS - 1; /* should be 0 but there's a T3 bug */ 917 req->mtu_idx = NMTUS - 1; /* should be 0 but there's a T3 bug */
915 req->iff = idx; 918 req->iff = idx;
916 memset(req->src_mac1, 0, sizeof(req->src_mac1));
917 memcpy(req->src_mac0, adapter->port[idx]->dev_addr, ETH_ALEN); 919 memcpy(req->src_mac0, adapter->port[idx]->dev_addr, ETH_ALEN);
920 memcpy(req->src_mac1, pi->iscsic.mac_addr, ETH_ALEN);
918 skb->priority = 1; 921 skb->priority = 1;
919 offload_tx(&adapter->tdev, skb); 922 offload_tx(&adapter->tdev, skb);
920 return 0; 923 return 0;
@@ -2516,7 +2519,7 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p)
2516 return -EINVAL; 2519 return -EINVAL;
2517 2520
2518 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); 2521 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
2519 t3_mac_set_address(&pi->mac, 0, dev->dev_addr); 2522 t3_mac_set_address(&pi->mac, LAN_MAC_IDX, dev->dev_addr);
2520 if (offload_running(adapter)) 2523 if (offload_running(adapter))
2521 write_smt_entry(adapter, pi->port_id); 2524 write_smt_entry(adapter, pi->port_id);
2522 return 0; 2525 return 0;
@@ -2654,7 +2657,7 @@ static void check_t3b2_mac(struct adapter *adapter)
2654 struct cmac *mac = &p->mac; 2657 struct cmac *mac = &p->mac;
2655 2658
2656 t3_mac_set_mtu(mac, dev->mtu); 2659 t3_mac_set_mtu(mac, dev->mtu);
2657 t3_mac_set_address(mac, 0, dev->dev_addr); 2660 t3_mac_set_address(mac, LAN_MAC_IDX, dev->dev_addr);
2658 cxgb_set_rxmode(dev); 2661 cxgb_set_rxmode(dev);
2659 t3_link_start(&p->phy, mac, &p->link_config); 2662 t3_link_start(&p->phy, mac, &p->link_config);
2660 t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX); 2663 t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
@@ -3112,6 +3115,14 @@ static const struct net_device_ops cxgb_netdev_ops = {
3112#endif 3115#endif
3113}; 3116};
3114 3117
3118static void __devinit cxgb3_init_iscsi_mac(struct net_device *dev)
3119{
3120 struct port_info *pi = netdev_priv(dev);
3121
3122 memcpy(pi->iscsic.mac_addr, dev->dev_addr, ETH_ALEN);
3123 pi->iscsic.mac_addr[3] |= 0x80;
3124}
3125
3115static int __devinit init_one(struct pci_dev *pdev, 3126static int __devinit init_one(struct pci_dev *pdev,
3116 const struct pci_device_id *ent) 3127 const struct pci_device_id *ent)
3117{ 3128{
@@ -3270,6 +3281,9 @@ static int __devinit init_one(struct pci_dev *pdev,
3270 goto out_free_dev; 3281 goto out_free_dev;
3271 } 3282 }
3272 3283
3284 for_each_port(adapter, i)
3285 cxgb3_init_iscsi_mac(adapter->port[i]);
3286
3273 /* Driver's ready. Reflect it on LEDs */ 3287 /* Driver's ready. Reflect it on LEDs */
3274 t3_led_ready(adapter); 3288 t3_led_ready(adapter);
3275 3289