aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/sge.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/sge.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/sge.c')
-rw-r--r--drivers/net/cxgb3/sge.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index f86612857a73..b7f4ee40879c 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1946,10 +1946,9 @@ static void restart_tx(struct sge_qset *qs)
1946 * Check if the ARP request is probing the private IP address 1946 * Check if the ARP request is probing the private IP address
1947 * dedicated to iSCSI, generate an ARP reply if so. 1947 * dedicated to iSCSI, generate an ARP reply if so.
1948 */ 1948 */
1949static void cxgb3_arp_process(struct adapter *adapter, struct sk_buff *skb) 1949static void cxgb3_arp_process(struct port_info *pi, struct sk_buff *skb)
1950{ 1950{
1951 struct net_device *dev = skb->dev; 1951 struct net_device *dev = skb->dev;
1952 struct port_info *pi;
1953 struct arphdr *arp; 1952 struct arphdr *arp;
1954 unsigned char *arp_ptr; 1953 unsigned char *arp_ptr;
1955 unsigned char *sha; 1954 unsigned char *sha;
@@ -1972,12 +1971,11 @@ static void cxgb3_arp_process(struct adapter *adapter, struct sk_buff *skb)
1972 arp_ptr += dev->addr_len; 1971 arp_ptr += dev->addr_len;
1973 memcpy(&tip, arp_ptr, sizeof(tip)); 1972 memcpy(&tip, arp_ptr, sizeof(tip));
1974 1973
1975 pi = netdev_priv(dev);
1976 if (tip != pi->iscsi_ipv4addr) 1974 if (tip != pi->iscsi_ipv4addr)
1977 return; 1975 return;
1978 1976
1979 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha, 1977 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
1980 dev->dev_addr, sha); 1978 pi->iscsic.mac_addr, sha);
1981 1979
1982} 1980}
1983 1981
@@ -1986,6 +1984,19 @@ static inline int is_arp(struct sk_buff *skb)
1986 return skb->protocol == htons(ETH_P_ARP); 1984 return skb->protocol == htons(ETH_P_ARP);
1987} 1985}
1988 1986
1987static void cxgb3_process_iscsi_prov_pack(struct port_info *pi,
1988 struct sk_buff *skb)
1989{
1990 if (is_arp(skb)) {
1991 cxgb3_arp_process(pi, skb);
1992 return;
1993 }
1994
1995 if (pi->iscsic.recv)
1996 pi->iscsic.recv(pi, skb);
1997
1998}
1999
1989/** 2000/**
1990 * rx_eth - process an ingress ethernet packet 2001 * rx_eth - process an ingress ethernet packet
1991 * @adap: the adapter 2002 * @adap: the adapter
@@ -2024,13 +2035,12 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
2024 vlan_gro_receive(&qs->napi, grp, 2035 vlan_gro_receive(&qs->napi, grp,
2025 ntohs(p->vlan), skb); 2036 ntohs(p->vlan), skb);
2026 else { 2037 else {
2027 if (unlikely(pi->iscsi_ipv4addr && 2038 if (unlikely(pi->iscsic.flags)) {
2028 is_arp(skb))) {
2029 unsigned short vtag = ntohs(p->vlan) & 2039 unsigned short vtag = ntohs(p->vlan) &
2030 VLAN_VID_MASK; 2040 VLAN_VID_MASK;
2031 skb->dev = vlan_group_get_device(grp, 2041 skb->dev = vlan_group_get_device(grp,
2032 vtag); 2042 vtag);
2033 cxgb3_arp_process(adap, skb); 2043 cxgb3_process_iscsi_prov_pack(pi, skb);
2034 } 2044 }
2035 __vlan_hwaccel_rx(skb, grp, ntohs(p->vlan), 2045 __vlan_hwaccel_rx(skb, grp, ntohs(p->vlan),
2036 rq->polling); 2046 rq->polling);
@@ -2041,8 +2051,8 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
2041 if (lro) 2051 if (lro)
2042 napi_gro_receive(&qs->napi, skb); 2052 napi_gro_receive(&qs->napi, skb);
2043 else { 2053 else {
2044 if (unlikely(pi->iscsi_ipv4addr && is_arp(skb))) 2054 if (unlikely(pi->iscsic.flags))
2045 cxgb3_arp_process(adap, skb); 2055 cxgb3_process_iscsi_prov_pack(pi, skb);
2046 netif_receive_skb(skb); 2056 netif_receive_skb(skb);
2047 } 2057 }
2048 } else 2058 } else