aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c104
1 files changed, 85 insertions, 19 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index efb175b1e438..ee80f6f45015 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -39,6 +39,7 @@
39#include <net/ip6_checksum.h> 39#include <net/ip6_checksum.h>
40#include <linux/ethtool.h> 40#include <linux/ethtool.h>
41#include <linux/if_vlan.h> 41#include <linux/if_vlan.h>
42#include <scsi/fc/fc_fcoe.h>
42 43
43#include "ixgbe.h" 44#include "ixgbe.h"
44#include "ixgbe_common.h" 45#include "ixgbe_common.h"
@@ -1810,6 +1811,11 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
1810 /* Decide whether to use packet split mode or not */ 1811 /* Decide whether to use packet split mode or not */
1811 adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; 1812 adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED;
1812 1813
1814#ifdef IXGBE_FCOE
1815 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
1816 adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED;
1817#endif /* IXGBE_FCOE */
1818
1813 /* Set the RX buffer length according to the mode */ 1819 /* Set the RX buffer length according to the mode */
1814 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { 1820 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) {
1815 rx_buf_len = IXGBE_RX_HDR_SIZE; 1821 rx_buf_len = IXGBE_RX_HDR_SIZE;
@@ -2241,6 +2247,11 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
2241 netif_set_gso_max_size(netdev, 65536); 2247 netif_set_gso_max_size(netdev, 65536);
2242#endif 2248#endif
2243 2249
2250#ifdef IXGBE_FCOE
2251 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
2252 ixgbe_configure_fcoe(adapter);
2253
2254#endif /* IXGBE_FCOE */
2244 ixgbe_configure_tx(adapter); 2255 ixgbe_configure_tx(adapter);
2245 ixgbe_configure_rx(adapter); 2256 ixgbe_configure_rx(adapter);
2246 for (i = 0; i < adapter->num_rx_queues; i++) 2257 for (i = 0; i < adapter->num_rx_queues; i++)
@@ -3401,6 +3412,9 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
3401 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599; 3412 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599;
3402 adapter->flags |= IXGBE_FLAG_RSC_CAPABLE; 3413 adapter->flags |= IXGBE_FLAG_RSC_CAPABLE;
3403 adapter->flags |= IXGBE_FLAG_RSC_ENABLED; 3414 adapter->flags |= IXGBE_FLAG_RSC_ENABLED;
3415#ifdef IXGBE_FCOE
3416 adapter->flags |= IXGBE_FLAG_FCOE_ENABLED;
3417#endif /* IXGBE_FCOE */
3404 } 3418 }
3405 3419
3406#ifdef CONFIG_IXGBE_DCB 3420#ifdef CONFIG_IXGBE_DCB
@@ -4416,10 +4430,12 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
4416 4430
4417static int ixgbe_tx_map(struct ixgbe_adapter *adapter, 4431static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
4418 struct ixgbe_ring *tx_ring, 4432 struct ixgbe_ring *tx_ring,
4419 struct sk_buff *skb, unsigned int first) 4433 struct sk_buff *skb, u32 tx_flags,
4434 unsigned int first)
4420{ 4435{
4421 struct ixgbe_tx_buffer *tx_buffer_info; 4436 struct ixgbe_tx_buffer *tx_buffer_info;
4422 unsigned int len = skb_headlen(skb); 4437 unsigned int len;
4438 unsigned int total = skb->len;
4423 unsigned int offset = 0, size, count = 0, i; 4439 unsigned int offset = 0, size, count = 0, i;
4424 unsigned int nr_frags = skb_shinfo(skb)->nr_frags; 4440 unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
4425 unsigned int f; 4441 unsigned int f;
@@ -4434,6 +4450,11 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
4434 4450
4435 map = skb_shinfo(skb)->dma_maps; 4451 map = skb_shinfo(skb)->dma_maps;
4436 4452
4453 if (tx_flags & IXGBE_TX_FLAGS_FCOE)
4454 /* excluding fcoe_crc_eof for FCoE */
4455 total -= sizeof(struct fcoe_crc_eof);
4456
4457 len = min(skb_headlen(skb), total);
4437 while (len) { 4458 while (len) {
4438 tx_buffer_info = &tx_ring->tx_buffer_info[i]; 4459 tx_buffer_info = &tx_ring->tx_buffer_info[i];
4439 size = min(len, (uint)IXGBE_MAX_DATA_PER_TXD); 4460 size = min(len, (uint)IXGBE_MAX_DATA_PER_TXD);
@@ -4444,6 +4465,7 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
4444 tx_buffer_info->next_to_watch = i; 4465 tx_buffer_info->next_to_watch = i;
4445 4466
4446 len -= size; 4467 len -= size;
4468 total -= size;
4447 offset += size; 4469 offset += size;
4448 count++; 4470 count++;
4449 4471
@@ -4458,7 +4480,7 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
4458 struct skb_frag_struct *frag; 4480 struct skb_frag_struct *frag;
4459 4481
4460 frag = &skb_shinfo(skb)->frags[f]; 4482 frag = &skb_shinfo(skb)->frags[f];
4461 len = frag->size; 4483 len = min((unsigned int)frag->size, total);
4462 offset = 0; 4484 offset = 0;
4463 4485
4464 while (len) { 4486 while (len) {
@@ -4475,9 +4497,12 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
4475 tx_buffer_info->next_to_watch = i; 4497 tx_buffer_info->next_to_watch = i;
4476 4498
4477 len -= size; 4499 len -= size;
4500 total -= size;
4478 offset += size; 4501 offset += size;
4479 count++; 4502 count++;
4480 } 4503 }
4504 if (total == 0)
4505 break;
4481 } 4506 }
4482 4507
4483 tx_ring->tx_buffer_info[i].skb = skb; 4508 tx_ring->tx_buffer_info[i].skb = skb;
@@ -4519,6 +4544,13 @@ static void ixgbe_tx_queue(struct ixgbe_adapter *adapter,
4519 olinfo_status |= IXGBE_TXD_POPTS_TXSM << 4544 olinfo_status |= IXGBE_TXD_POPTS_TXSM <<
4520 IXGBE_ADVTXD_POPTS_SHIFT; 4545 IXGBE_ADVTXD_POPTS_SHIFT;
4521 4546
4547 if (tx_flags & IXGBE_TX_FLAGS_FCOE) {
4548 olinfo_status |= IXGBE_ADVTXD_CC;
4549 olinfo_status |= (1 << IXGBE_ADVTXD_IDX_SHIFT);
4550 if (tx_flags & IXGBE_TX_FLAGS_FSO)
4551 cmd_type_len |= IXGBE_ADVTXD_DCMD_TSE;
4552 }
4553
4522 olinfo_status |= ((paylen - hdr_len) << IXGBE_ADVTXD_PAYLEN_SHIFT); 4554 olinfo_status |= ((paylen - hdr_len) << IXGBE_ADVTXD_PAYLEN_SHIFT);
4523 4555
4524 i = tx_ring->next_to_use; 4556 i = tx_ring->next_to_use;
@@ -4615,10 +4647,16 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
4615 tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT; 4647 tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT;
4616 tx_flags |= IXGBE_TX_FLAGS_VLAN; 4648 tx_flags |= IXGBE_TX_FLAGS_VLAN;
4617 } 4649 }
4618 /* three things can cause us to need a context descriptor */ 4650
4651 if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) &&
4652 (skb->protocol == htons(ETH_P_FCOE)))
4653 tx_flags |= IXGBE_TX_FLAGS_FCOE;
4654
4655 /* four things can cause us to need a context descriptor */
4619 if (skb_is_gso(skb) || 4656 if (skb_is_gso(skb) ||
4620 (skb->ip_summed == CHECKSUM_PARTIAL) || 4657 (skb->ip_summed == CHECKSUM_PARTIAL) ||
4621 (tx_flags & IXGBE_TX_FLAGS_VLAN)) 4658 (tx_flags & IXGBE_TX_FLAGS_VLAN) ||
4659 (tx_flags & IXGBE_TX_FLAGS_FCOE))
4622 count++; 4660 count++;
4623 4661
4624 count += TXD_USE_COUNT(skb_headlen(skb)); 4662 count += TXD_USE_COUNT(skb_headlen(skb));
@@ -4630,23 +4668,35 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
4630 return NETDEV_TX_BUSY; 4668 return NETDEV_TX_BUSY;
4631 } 4669 }
4632 4670
4633 if (skb->protocol == htons(ETH_P_IP))
4634 tx_flags |= IXGBE_TX_FLAGS_IPV4;
4635 first = tx_ring->next_to_use; 4671 first = tx_ring->next_to_use;
4636 tso = ixgbe_tso(adapter, tx_ring, skb, tx_flags, &hdr_len); 4672 if (tx_flags & IXGBE_TX_FLAGS_FCOE) {
4637 if (tso < 0) { 4673#ifdef IXGBE_FCOE
4638 dev_kfree_skb_any(skb); 4674 /* setup tx offload for FCoE */
4639 return NETDEV_TX_OK; 4675 tso = ixgbe_fso(adapter, tx_ring, skb, tx_flags, &hdr_len);
4640 } 4676 if (tso < 0) {
4641 4677 dev_kfree_skb_any(skb);
4642 if (tso) 4678 return NETDEV_TX_OK;
4643 tx_flags |= IXGBE_TX_FLAGS_TSO; 4679 }
4644 else if (ixgbe_tx_csum(adapter, tx_ring, skb, tx_flags) && 4680 if (tso)
4645 (skb->ip_summed == CHECKSUM_PARTIAL)) 4681 tx_flags |= IXGBE_TX_FLAGS_FSO;
4646 tx_flags |= IXGBE_TX_FLAGS_CSUM; 4682#endif /* IXGBE_FCOE */
4683 } else {
4684 if (skb->protocol == htons(ETH_P_IP))
4685 tx_flags |= IXGBE_TX_FLAGS_IPV4;
4686 tso = ixgbe_tso(adapter, tx_ring, skb, tx_flags, &hdr_len);
4687 if (tso < 0) {
4688 dev_kfree_skb_any(skb);
4689 return NETDEV_TX_OK;
4690 }
4647 4691
4648 count = ixgbe_tx_map(adapter, tx_ring, skb, first); 4692 if (tso)
4693 tx_flags |= IXGBE_TX_FLAGS_TSO;
4694 else if (ixgbe_tx_csum(adapter, tx_ring, skb, tx_flags) &&
4695 (skb->ip_summed == CHECKSUM_PARTIAL))
4696 tx_flags |= IXGBE_TX_FLAGS_CSUM;
4697 }
4649 4698
4699 count = ixgbe_tx_map(adapter, tx_ring, skb, tx_flags, first);
4650 if (count) { 4700 if (count) {
4651 ixgbe_tx_queue(adapter, tx_ring, tx_flags, count, skb->len, 4701 ixgbe_tx_queue(adapter, tx_ring, tx_flags, count, skb->len,
4652 hdr_len); 4702 hdr_len);
@@ -4794,6 +4844,9 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4794 const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data]; 4844 const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data];
4795 static int cards_found; 4845 static int cards_found;
4796 int i, err, pci_using_dac; 4846 int i, err, pci_using_dac;
4847#ifdef IXGBE_FCOE
4848 u16 device_caps;
4849#endif
4797 u32 part_num, eec; 4850 u32 part_num, eec;
4798 4851
4799 err = pci_enable_device_mem(pdev); 4852 err = pci_enable_device_mem(pdev);
@@ -4976,6 +5029,19 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4976 netdev->dcbnl_ops = &dcbnl_ops; 5029 netdev->dcbnl_ops = &dcbnl_ops;
4977#endif 5030#endif
4978 5031
5032#ifdef IXGBE_FCOE
5033 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
5034 if (hw->mac.ops.get_device_caps) {
5035 hw->mac.ops.get_device_caps(hw, &device_caps);
5036 if (!(device_caps & IXGBE_DEVICE_CAPS_FCOE_OFFLOADS)) {
5037 netdev->features |= NETIF_F_FCOE_CRC;
5038 netdev->features |= NETIF_F_FSO;
5039 } else {
5040 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
5041 }
5042 }
5043 }
5044#endif /* IXGBE_FCOE */
4979 if (pci_using_dac) 5045 if (pci_using_dac)
4980 netdev->features |= NETIF_F_HIGHDMA; 5046 netdev->features |= NETIF_F_HIGHDMA;
4981 5047