Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/867295/?format=api
{ "id": 867295, "url": "http://patchwork.ozlabs.org/api/patches/867295/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1517170950-26470-1-git-send-email-clabbe@baylibre.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1517170950-26470-1-git-send-email-clabbe@baylibre.com>", "list_archive_url": null, "date": "2018-01-28T20:22:30", "name": "net: ethernet: i40e: remove i40e_fcoe files", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "7fbc6774a5e6d2b2d7f0990234cd8c6814f97065", "submitter": { "id": 73287, "url": "http://patchwork.ozlabs.org/api/people/73287/?format=api", "name": "Corentin LABBE", "email": "clabbe@baylibre.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1517170950-26470-1-git-send-email-clabbe@baylibre.com/mbox/", "series": [ { "id": 25957, "url": "http://patchwork.ozlabs.org/api/series/25957/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=25957", "date": "2018-01-28T20:22:30", "name": "net: ethernet: i40e: remove i40e_fcoe files", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/25957/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/867295/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/867295/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=baylibre-com.20150623.gappssmtp.com\n\theader.i=@baylibre-com.20150623.gappssmtp.com\n\theader.b=\"k5n1Y8hi\"; dkim-atps=neutral" ], "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3zVhYZ2Ssmz9s75\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 30 Jan 2018 07:53:22 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 55A568496B;\n\tMon, 29 Jan 2018 20:53:20 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id Acea4P1nI504; Mon, 29 Jan 2018 20:53:15 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 230C383764;\n\tMon, 29 Jan 2018 20:53:15 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id E291A1CF013\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSun, 28 Jan 2018 20:22:43 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id D0DCC87A31\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSun, 28 Jan 2018 20:22:43 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id awVkZzaGPGIg for <intel-wired-lan@lists.osuosl.org>;\n\tSun, 28 Jan 2018 20:22:40 +0000 (UTC)", "from mail-wr0-f178.google.com (mail-wr0-f178.google.com\n\t[209.85.128.178])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 1E9AB87A1B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSun, 28 Jan 2018 20:22:39 +0000 (UTC)", "by mail-wr0-f178.google.com with SMTP id w50so5032433wrc.2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSun, 28 Jan 2018 12:22:39 -0800 (PST)", "from localhost.localdomain ([51.15.160.169])\n\tby smtp.googlemail.com with ESMTPSA id\n\tb35sm30364274wra.13.2018.01.28.12.22.36\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSun, 28 Jan 2018 12:22:36 -0800 (PST)" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "from auto-whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id;\n\tbh=MoUaS1R0bgGecSqSQLYOF27/a3D/din5z1NgiVPBiPo=;\n\tb=k5n1Y8hi6PpsTbAgDHXx11ntsDbP4ed9A0EYtjggqR/rNSGb9KUFGQ8V8CS7ul6n+b\n\t74X3wMEse5oUIDPoeLB4fwUS/HcEMMnKAHOZ0+Qv9wtADjGzw6pNsYZydG60+bg2j/nP\n\tincCAO70hXeYm2N2GwotlFFXZn/9VYo4L+olwZtCk9g8vN/z4+VliQtUwyd/RwMJc4vD\n\t7QKXyv5ynwFLDpAsyy9MXBRFQd4AvZpSl4UjDdpe3VirRVQv6+CIFQ2NgxKpN0mVzYZL\n\t51yEkbDhF3kD+wMt6ysCETeZh7UjpRTfH3UZY2RLVPXW4S4Pnlt7WA1Uxc8v5yQPGxqy\n\tufGg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=MoUaS1R0bgGecSqSQLYOF27/a3D/din5z1NgiVPBiPo=;\n\tb=ozszJidudLwEt9NhnQftzpg1WiGnMxf0MSZUkPQub+aYA3A4e3Jf5u9v17uvw3LfWS\n\t9Nl3c+kE1zoxpIOOsphtFr+nMkIzjVPEoT2Z/EwkP28QxNmkDPY/1jeTzEECCxrO6gUY\n\tdrHuprjaOixvVmKtsaX/AVpJzf8cjJ8xg3L0ezdt7RqwTaMgzp2UOmxdoYwpPhok3gIx\n\ttBDxPxskeACqjwuJj6NvQ7Mp+7YeD1ThrtR/ugErDfnj2IZcy8zhaQxCpbGgK3/ujKM8\n\tSgndxadoXcpMYTcArsYUddPUwuqQWRMt2mYx/qBm3aMwKNFTUTVn76L0L4+bwiTOBZtL\n\tX84g==", "X-Gm-Message-State": "AKwxyteqittiYWSfsEX6j3PpQXCTOoJdffAdFRbcxHyvUdg17lkc9D7E\n\tqU1E7CsXlh+Aa5BO/04B9bV9gg==", "X-Google-Smtp-Source": "AH8x225U9EuAkA8Us00d/bWuBYhh6A3r2eRRvWiPsoD4KkUcEfxvaaaVAFt9Yjj+mWTyKIuAlRKEGg==", "X-Received": "by 10.223.166.46 with SMTP id k43mr4316104wrc.24.1517170957182; \n\tSun, 28 Jan 2018 12:22:37 -0800 (PST)", "From": "Corentin Labbe <clabbe@baylibre.com>", "To": "jeffrey.t.kirsher@intel.com", "Date": "Sun, 28 Jan 2018 20:22:30 +0000", "Message-Id": "<1517170950-26470-1-git-send-email-clabbe@baylibre.com>", "X-Mailer": "git-send-email 2.7.4", "X-Mailman-Approved-At": "Mon, 29 Jan 2018 20:53:12 +0000", "Subject": "[Intel-wired-lan] [PATCH] net: ethernet: i40e: remove i40e_fcoe\n\tfiles", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.24", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "Cc": "netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,\n\tlinux-kernel@vger.kernel.org, Corentin Labbe <clabbe@baylibre.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "i40e_fcoe support was removed via commit 9eed69a9147c (\"i40e: Drop FCoE code from core driver files\")\nBut this left files in place but uncompilable.\nLet's finish the cleaning.\n\nSigned-off-by: Corentin Labbe <clabbe@baylibre.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_fcoe.c | 1571 ---------------------------\n drivers/net/ethernet/intel/i40e/i40e_fcoe.h | 127 ---\n 2 files changed, 1698 deletions(-)\n delete mode 100644 drivers/net/ethernet/intel/i40e/i40e_fcoe.c\n delete mode 100644 drivers/net/ethernet/intel/i40e/i40e_fcoe.h", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c\ndeleted file mode 100644\nindex 2d1253c5b7a1..000000000000\n--- a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c\n+++ /dev/null\n@@ -1,1571 +0,0 @@\n-/*******************************************************************************\n- *\n- * Intel Ethernet Controller XL710 Family Linux Driver\n- * Copyright(c) 2013 - 2016 Intel Corporation.\n- *\n- * This program is free software; you can redistribute it and/or modify it\n- * under the terms and conditions of the GNU General Public License,\n- * version 2, as published by the Free Software Foundation.\n- *\n- * This program is distributed in the hope it will be useful, but WITHOUT\n- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n- * more details.\n- *\n- * You should have received a copy of the GNU General Public License along\n- * with this program. If not, see <http://www.gnu.org/licenses/>.\n- *\n- * The full GNU General Public License is included in this distribution in\n- * the file called \"COPYING\".\n- *\n- * Contact Information:\n- * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>\n- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497\n- *\n- ******************************************************************************/\n-\n-#include <linux/if_ether.h>\n-#include <scsi/scsi_cmnd.h>\n-#include <scsi/scsi_device.h>\n-#include <scsi/fc/fc_fs.h>\n-#include <scsi/fc/fc_fip.h>\n-#include <scsi/fc/fc_fcoe.h>\n-#include <scsi/libfc.h>\n-#include <scsi/libfcoe.h>\n-#include <uapi/linux/dcbnl.h>\n-\n-#include \"i40e.h\"\n-#include \"i40e_fcoe.h\"\n-\n-/**\n- * i40e_fcoe_sof_is_class2 - returns true if this is a FC Class 2 SOF\n- * @sof: the FCoE start of frame delimiter\n- **/\n-static inline bool i40e_fcoe_sof_is_class2(u8 sof)\n-{\n-\treturn (sof == FC_SOF_I2) || (sof == FC_SOF_N2);\n-}\n-\n-/**\n- * i40e_fcoe_sof_is_class3 - returns true if this is a FC Class 3 SOF\n- * @sof: the FCoE start of frame delimiter\n- **/\n-static inline bool i40e_fcoe_sof_is_class3(u8 sof)\n-{\n-\treturn (sof == FC_SOF_I3) || (sof == FC_SOF_N3);\n-}\n-\n-/**\n- * i40e_fcoe_sof_is_supported - returns true if the FC SOF is supported by HW\n- * @sof: the input SOF value from the frame\n- **/\n-static inline bool i40e_fcoe_sof_is_supported(u8 sof)\n-{\n-\treturn i40e_fcoe_sof_is_class2(sof) ||\n-\t i40e_fcoe_sof_is_class3(sof);\n-}\n-\n-/**\n- * i40e_fcoe_fc_sof - pull the SOF from FCoE header in the frame\n- * @skb: the frame whose EOF is to be pulled from\n- **/\n-static inline int i40e_fcoe_fc_sof(struct sk_buff *skb, u8 *sof)\n-{\n-\t*sof = ((struct fcoe_hdr *)skb_network_header(skb))->fcoe_sof;\n-\n-\tif (!i40e_fcoe_sof_is_supported(*sof))\n-\t\treturn -EINVAL;\n-\treturn 0;\n-}\n-\n-/**\n- * i40e_fcoe_eof_is_supported - returns true if the EOF is supported by HW\n- * @eof: the input EOF value from the frame\n- **/\n-static inline bool i40e_fcoe_eof_is_supported(u8 eof)\n-{\n-\treturn (eof == FC_EOF_N) || (eof == FC_EOF_T) ||\n-\t (eof == FC_EOF_NI) || (eof == FC_EOF_A);\n-}\n-\n-/**\n- * i40e_fcoe_fc_eof - pull EOF from FCoE trailer in the frame\n- * @skb: the frame whose EOF is to be pulled from\n- **/\n-static inline int i40e_fcoe_fc_eof(struct sk_buff *skb, u8 *eof)\n-{\n-\t/* the first byte of the last dword is EOF */\n-\tskb_copy_bits(skb, skb->len - 4, eof, 1);\n-\n-\tif (!i40e_fcoe_eof_is_supported(*eof))\n-\t\treturn -EINVAL;\n-\treturn 0;\n-}\n-\n-/**\n- * i40e_fcoe_ctxt_eof - convert input FC EOF for descriptor programming\n- * @eof: the input eof value from the frame\n- *\n- * The FC EOF is converted to the value understood by HW for descriptor\n- * programming. Never call this w/o calling i40e_fcoe_eof_is_supported()\n- * first and that already checks for all supported valid eof values.\n- **/\n-static inline u32 i40e_fcoe_ctxt_eof(u8 eof)\n-{\n-\tswitch (eof) {\n-\tcase FC_EOF_N:\n-\t\treturn I40E_TX_DESC_CMD_L4T_EOFT_EOF_N;\n-\tcase FC_EOF_T:\n-\t\treturn I40E_TX_DESC_CMD_L4T_EOFT_EOF_T;\n-\tcase FC_EOF_NI:\n-\t\treturn I40E_TX_DESC_CMD_L4T_EOFT_EOF_NI;\n-\tcase FC_EOF_A:\n-\t\treturn I40E_TX_DESC_CMD_L4T_EOFT_EOF_A;\n-\tdefault:\n-\t\t/* Supported valid eof shall be already checked by\n-\t\t * calling i40e_fcoe_eof_is_supported() first,\n-\t\t * therefore this default case shall never hit.\n-\t\t */\n-\t\tWARN_ON(1);\n-\t\treturn -EINVAL;\n-\t}\n-}\n-\n-/**\n- * i40e_fcoe_xid_is_valid - returns true if the exchange id is valid\n- * @xid: the exchange id\n- **/\n-static inline bool i40e_fcoe_xid_is_valid(u16 xid)\n-{\n-\treturn (xid != FC_XID_UNKNOWN) && (xid < I40E_FCOE_DDP_MAX);\n-}\n-\n-/**\n- * i40e_fcoe_ddp_unmap - unmap the mapped sglist associated\n- * @pf: pointer to PF\n- * @ddp: sw DDP context\n- *\n- * Unmap the scatter-gather list associated with the given SW DDP context\n- *\n- * Returns: data length already ddp-ed in bytes\n- *\n- **/\n-static inline void i40e_fcoe_ddp_unmap(struct i40e_pf *pf,\n-\t\t\t\t struct i40e_fcoe_ddp *ddp)\n-{\n-\tif (test_and_set_bit(__I40E_FCOE_DDP_UNMAPPED, &ddp->flags))\n-\t\treturn;\n-\n-\tif (ddp->sgl) {\n-\t\tdma_unmap_sg(&pf->pdev->dev, ddp->sgl, ddp->sgc,\n-\t\t\t DMA_FROM_DEVICE);\n-\t\tddp->sgl = NULL;\n-\t\tddp->sgc = 0;\n-\t}\n-\n-\tif (ddp->pool) {\n-\t\tdma_pool_free(ddp->pool, ddp->udl, ddp->udp);\n-\t\tddp->pool = NULL;\n-\t}\n-}\n-\n-/**\n- * i40e_fcoe_ddp_clear - clear the given SW DDP context\n- * @ddp - SW DDP context\n- **/\n-static inline void i40e_fcoe_ddp_clear(struct i40e_fcoe_ddp *ddp)\n-{\n-\tmemset(ddp, 0, sizeof(struct i40e_fcoe_ddp));\n-\tddp->xid = FC_XID_UNKNOWN;\n-\tddp->flags = __I40E_FCOE_DDP_NONE;\n-}\n-\n-/**\n- * i40e_fcoe_progid_is_fcoe - check if the prog_id is for FCoE\n- * @id: the prog id for the programming status Rx descriptor write-back\n- **/\n-static inline bool i40e_fcoe_progid_is_fcoe(u8 id)\n-{\n-\treturn (id == I40E_RX_PROG_STATUS_DESC_FCOE_CTXT_PROG_STATUS) ||\n-\t (id == I40E_RX_PROG_STATUS_DESC_FCOE_CTXT_INVL_STATUS);\n-}\n-\n-/**\n- * i40e_fcoe_fc_get_xid - get xid from the frame header\n- * @fh: the fc frame header\n- *\n- * In case the incoming frame's exchange is originated from\n- * the initiator, then received frame's exchange id is ANDed\n- * with fc_cpu_mask bits to get the same cpu on which exchange\n- * was originated, otherwise just use the current cpu.\n- *\n- * Returns ox_id if exchange originator, rx_id if responder\n- **/\n-static inline u16 i40e_fcoe_fc_get_xid(struct fc_frame_header *fh)\n-{\n-\tu32 f_ctl = ntoh24(fh->fh_f_ctl);\n-\n-\treturn (f_ctl & FC_FC_EX_CTX) ?\n-\t\tbe16_to_cpu(fh->fh_ox_id) :\n-\t\tbe16_to_cpu(fh->fh_rx_id);\n-}\n-\n-/**\n- * i40e_fcoe_fc_frame_header - get fc frame header from skb\n- * @skb: packet\n- *\n- * This checks if there is a VLAN header and returns the data\n- * pointer to the start of the fc_frame_header.\n- *\n- * Returns pointer to the fc_frame_header\n- **/\n-static inline struct fc_frame_header *i40e_fcoe_fc_frame_header(\n-\tstruct sk_buff *skb)\n-{\n-\tvoid *fh = skb->data + sizeof(struct fcoe_hdr);\n-\n-\tif (eth_hdr(skb)->h_proto == htons(ETH_P_8021Q))\n-\t\tfh += sizeof(struct vlan_hdr);\n-\n-\treturn (struct fc_frame_header *)fh;\n-}\n-\n-/**\n- * i40e_fcoe_ddp_put - release the DDP context for a given exchange id\n- * @netdev: the corresponding net_device\n- * @xid: the exchange id that corresponding DDP context will be released\n- *\n- * This is the implementation of net_device_ops.ndo_fcoe_ddp_done\n- * and it is expected to be called by ULD, i.e., FCP layer of libfc\n- * to release the corresponding ddp context when the I/O is done.\n- *\n- * Returns : data length already ddp-ed in bytes\n- **/\n-static int i40e_fcoe_ddp_put(struct net_device *netdev, u16 xid)\n-{\n-\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n-\tstruct i40e_pf *pf = np->vsi->back;\n-\tstruct i40e_fcoe *fcoe = &pf->fcoe;\n-\tint len = 0;\n-\tstruct i40e_fcoe_ddp *ddp = &fcoe->ddp[xid];\n-\n-\tif (!fcoe || !ddp)\n-\t\tgoto out;\n-\n-\tif (test_bit(__I40E_FCOE_DDP_DONE, &ddp->flags))\n-\t\tlen = ddp->len;\n-\ti40e_fcoe_ddp_unmap(pf, ddp);\n-out:\n-\treturn len;\n-}\n-\n-/**\n- * i40e_fcoe_sw_init - sets up the HW for FCoE\n- * @pf: pointer to PF\n- **/\n-void i40e_init_pf_fcoe(struct i40e_pf *pf)\n-{\n-\tstruct i40e_hw *hw = &pf->hw;\n-\tu32 val;\n-\n-\tpf->flags &= ~I40E_FLAG_FCOE_ENABLED;\n-\tpf->num_fcoe_qps = 0;\n-\tpf->fcoe_hmc_cntx_num = 0;\n-\tpf->fcoe_hmc_filt_num = 0;\n-\n-\tif (!pf->hw.func_caps.fcoe) {\n-\t\tdev_dbg(&pf->pdev->dev, \"FCoE capability is disabled\\n\");\n-\t\treturn;\n-\t}\n-\n-\tif (!pf->hw.func_caps.dcb) {\n-\t\tdev_warn(&pf->pdev->dev,\n-\t\t\t \"Hardware is not DCB capable not enabling FCoE.\\n\");\n-\t\treturn;\n-\t}\n-\n-\t/* enable FCoE hash filter */\n-\tval = i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1));\n-\tval |= BIT(I40E_FILTER_PCTYPE_FCOE_OX - 32);\n-\tval |= BIT(I40E_FILTER_PCTYPE_FCOE_RX - 32);\n-\tval &= I40E_PFQF_HENA_PTYPE_ENA_MASK;\n-\ti40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), val);\n-\n-\t/* enable flag */\n-\tpf->flags |= I40E_FLAG_FCOE_ENABLED;\n-\tpf->num_fcoe_qps = I40E_DEFAULT_FCOE;\n-\n-\t/* Reserve 4K DDP contexts and 20K filter size for FCoE */\n-\tpf->fcoe_hmc_cntx_num = BIT(I40E_DMA_CNTX_SIZE_4K) *\n-\t\t\t\tI40E_DMA_CNTX_BASE_SIZE;\n-\tpf->fcoe_hmc_filt_num = pf->fcoe_hmc_cntx_num +\n-\t\t\t\tBIT(I40E_HASH_FILTER_SIZE_16K) *\n-\t\t\t\tI40E_HASH_FILTER_BASE_SIZE;\n-\n-\t/* FCoE object: max 16K filter buckets and 4K DMA contexts */\n-\tpf->filter_settings.fcoe_filt_num = I40E_HASH_FILTER_SIZE_16K;\n-\tpf->filter_settings.fcoe_cntx_num = I40E_DMA_CNTX_SIZE_4K;\n-\n-\t/* Setup max frame with FCoE_MTU plus L2 overheads */\n-\tval = i40e_read_rx_ctl(hw, I40E_GLFCOE_RCTL);\n-\tval &= ~I40E_GLFCOE_RCTL_MAX_SIZE_MASK;\n-\tval |= ((FCOE_MTU + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN)\n-\t\t << I40E_GLFCOE_RCTL_MAX_SIZE_SHIFT);\n-\ti40e_write_rx_ctl(hw, I40E_GLFCOE_RCTL, val);\n-\n-\tdev_info(&pf->pdev->dev, \"FCoE is supported.\\n\");\n-}\n-\n-/**\n- * i40e_get_fcoe_tc_map - Return TC map for FCoE APP\n- * @pf: pointer to PF\n- *\n- **/\n-u8 i40e_get_fcoe_tc_map(struct i40e_pf *pf)\n-{\n-\tstruct i40e_dcb_app_priority_table app;\n-\tstruct i40e_hw *hw = &pf->hw;\n-\tu8 enabled_tc = 0;\n-\tu8 tc, i;\n-\t/* Get the FCoE APP TLV */\n-\tstruct i40e_dcbx_config *dcbcfg = &hw->local_dcbx_config;\n-\n-\tfor (i = 0; i < dcbcfg->numapps; i++) {\n-\t\tapp = dcbcfg->app[i];\n-\t\tif (app.selector == IEEE_8021QAZ_APP_SEL_ETHERTYPE &&\n-\t\t app.protocolid == ETH_P_FCOE) {\n-\t\t\ttc = dcbcfg->etscfg.prioritytable[app.priority];\n-\t\t\tenabled_tc |= BIT(tc);\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\n-\t/* TC0 if there is no TC defined for FCoE APP TLV */\n-\tenabled_tc = enabled_tc ? enabled_tc : 0x1;\n-\n-\treturn enabled_tc;\n-}\n-\n-/**\n- * i40e_fcoe_vsi_init - prepares the VSI context for creating a FCoE VSI\n- * @vsi: pointer to the associated VSI struct\n- * @ctxt: pointer to the associated VSI context to be passed to HW\n- *\n- * Returns 0 on success or < 0 on error\n- **/\n-int i40e_fcoe_vsi_init(struct i40e_vsi *vsi, struct i40e_vsi_context *ctxt)\n-{\n-\tstruct i40e_aqc_vsi_properties_data *info = &ctxt->info;\n-\tstruct i40e_pf *pf = vsi->back;\n-\tstruct i40e_hw *hw = &pf->hw;\n-\tu8 enabled_tc = 0;\n-\n-\tif (!(pf->flags & I40E_FLAG_FCOE_ENABLED)) {\n-\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\"FCoE is not enabled for this device\\n\");\n-\t\treturn -EPERM;\n-\t}\n-\n-\t/* initialize the hardware for FCoE */\n-\tctxt->pf_num = hw->pf_id;\n-\tctxt->vf_num = 0;\n-\tctxt->uplink_seid = vsi->uplink_seid;\n-\tctxt->connection_type = I40E_AQ_VSI_CONN_TYPE_NORMAL;\n-\tctxt->flags = I40E_AQ_VSI_TYPE_PF;\n-\n-\t/* FCoE VSI would need the following sections */\n-\tinfo->valid_sections |= cpu_to_le16(I40E_AQ_VSI_PROP_QUEUE_OPT_VALID);\n-\n-\t/* FCoE VSI does not need these sections */\n-\tinfo->valid_sections &= cpu_to_le16(~(I40E_AQ_VSI_PROP_SECURITY_VALID |\n-\t\t\t\t\t I40E_AQ_VSI_PROP_VLAN_VALID |\n-\t\t\t\t\t I40E_AQ_VSI_PROP_CAS_PV_VALID |\n-\t\t\t\t\t I40E_AQ_VSI_PROP_INGRESS_UP_VALID |\n-\t\t\t\t\t I40E_AQ_VSI_PROP_EGRESS_UP_VALID));\n-\n-\tif (i40e_is_vsi_uplink_mode_veb(vsi)) {\n-\t\tinfo->valid_sections |=\n-\t\t\t\tcpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);\n-\t\tinfo->switch_id =\n-\t\t\t\tcpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB);\n-\t}\n-\tenabled_tc = i40e_get_fcoe_tc_map(pf);\n-\ti40e_vsi_setup_queue_map(vsi, ctxt, enabled_tc, true);\n-\n-\t/* set up queue option section: only enable FCoE */\n-\tinfo->queueing_opt_flags = I40E_AQ_VSI_QUE_OPT_FCOE_ENA;\n-\n-\treturn 0;\n-}\n-\n-/**\n- * i40e_fcoe_enable - this is the implementation of ndo_fcoe_enable,\n- * indicating the upper FCoE protocol stack is ready to use FCoE\n- * offload features.\n- *\n- * @netdev: pointer to the netdev that FCoE is created on\n- *\n- * Returns 0 on success\n- *\n- * in RTNL\n- *\n- **/\n-int i40e_fcoe_enable(struct net_device *netdev)\n-{\n-\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n-\tstruct i40e_vsi *vsi = np->vsi;\n-\tstruct i40e_pf *pf = vsi->back;\n-\tstruct i40e_fcoe *fcoe = &pf->fcoe;\n-\n-\tif (!(pf->flags & I40E_FLAG_FCOE_ENABLED)) {\n-\t\tnetdev_err(netdev, \"HW does not support FCoE.\\n\");\n-\t\treturn -ENODEV;\n-\t}\n-\n-\tif (vsi->type != I40E_VSI_FCOE) {\n-\t\tnetdev_err(netdev, \"interface does not support FCoE.\\n\");\n-\t\treturn -EBUSY;\n-\t}\n-\n-\tatomic_inc(&fcoe->refcnt);\n-\n-\treturn 0;\n-}\n-\n-/**\n- * i40e_fcoe_disable- disables FCoE for upper FCoE protocol stack.\n- * @dev: pointer to the netdev that FCoE is created on\n- *\n- * Returns 0 on success\n- *\n- **/\n-int i40e_fcoe_disable(struct net_device *netdev)\n-{\n-\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n-\tstruct i40e_vsi *vsi = np->vsi;\n-\tstruct i40e_pf *pf = vsi->back;\n-\tstruct i40e_fcoe *fcoe = &pf->fcoe;\n-\n-\tif (!(pf->flags & I40E_FLAG_FCOE_ENABLED)) {\n-\t\tnetdev_err(netdev, \"device does not support FCoE\\n\");\n-\t\treturn -ENODEV;\n-\t}\n-\tif (vsi->type != I40E_VSI_FCOE)\n-\t\treturn -EBUSY;\n-\n-\tif (!atomic_dec_and_test(&fcoe->refcnt))\n-\t\treturn -EINVAL;\n-\n-\tnetdev_info(netdev, \"FCoE disabled\\n\");\n-\n-\treturn 0;\n-}\n-\n-/**\n- * i40e_fcoe_dma_pool_free - free the per cpu pool for FCoE DDP\n- * @fcoe: the FCoE sw object\n- * @dev: the device that the pool is associated with\n- * @cpu: the cpu for this pool\n- *\n- **/\n-static void i40e_fcoe_dma_pool_free(struct i40e_fcoe *fcoe,\n-\t\t\t\t struct device *dev,\n-\t\t\t\t unsigned int cpu)\n-{\n-\tstruct i40e_fcoe_ddp_pool *ddp_pool;\n-\n-\tddp_pool = per_cpu_ptr(fcoe->ddp_pool, cpu);\n-\tif (!ddp_pool->pool) {\n-\t\tdev_warn(dev, \"DDP pool already freed for cpu %d\\n\", cpu);\n-\t\treturn;\n-\t}\n-\tdma_pool_destroy(ddp_pool->pool);\n-\tddp_pool->pool = NULL;\n-}\n-\n-/**\n- * i40e_fcoe_dma_pool_create - per cpu pool for FCoE DDP\n- * @fcoe: the FCoE sw object\n- * @dev: the device that the pool is associated with\n- * @cpu: the cpu for this pool\n- *\n- * Returns 0 on successful or non zero on failure\n- *\n- **/\n-static int i40e_fcoe_dma_pool_create(struct i40e_fcoe *fcoe,\n-\t\t\t\t struct device *dev,\n-\t\t\t\t unsigned int cpu)\n-{\n-\tstruct i40e_fcoe_ddp_pool *ddp_pool;\n-\tstruct dma_pool *pool;\n-\tchar pool_name[32];\n-\n-\tddp_pool = per_cpu_ptr(fcoe->ddp_pool, cpu);\n-\tif (ddp_pool && ddp_pool->pool) {\n-\t\tdev_warn(dev, \"DDP pool already allocated for cpu %d\\n\", cpu);\n-\t\treturn 0;\n-\t}\n-\tsnprintf(pool_name, sizeof(pool_name), \"i40e_fcoe_ddp_%d\", cpu);\n-\tpool = dma_pool_create(pool_name, dev, I40E_FCOE_DDP_PTR_MAX,\n-\t\t\t I40E_FCOE_DDP_PTR_ALIGN, PAGE_SIZE);\n-\tif (!pool) {\n-\t\tdev_err(dev, \"dma_pool_create %s failed\\n\", pool_name);\n-\t\treturn -ENOMEM;\n-\t}\n-\tddp_pool->pool = pool;\n-\treturn 0;\n-}\n-\n-/**\n- * i40e_fcoe_free_ddp_resources - release FCoE DDP resources\n- * @vsi: the vsi FCoE is associated with\n- *\n- **/\n-void i40e_fcoe_free_ddp_resources(struct i40e_vsi *vsi)\n-{\n-\tstruct i40e_pf *pf = vsi->back;\n-\tstruct i40e_fcoe *fcoe = &pf->fcoe;\n-\tint cpu, i;\n-\n-\t/* do nothing if not FCoE VSI */\n-\tif (vsi->type != I40E_VSI_FCOE)\n-\t\treturn;\n-\n-\t/* do nothing if no DDP pools were allocated */\n-\tif (!fcoe->ddp_pool)\n-\t\treturn;\n-\n-\tfor (i = 0; i < I40E_FCOE_DDP_MAX; i++)\n-\t\ti40e_fcoe_ddp_put(vsi->netdev, i);\n-\n-\tfor_each_possible_cpu(cpu)\n-\t\ti40e_fcoe_dma_pool_free(fcoe, &pf->pdev->dev, cpu);\n-\n-\tfree_percpu(fcoe->ddp_pool);\n-\tfcoe->ddp_pool = NULL;\n-\n-\tnetdev_info(vsi->netdev, \"VSI %d,%d FCoE DDP resources released\\n\",\n-\t\t vsi->id, vsi->seid);\n-}\n-\n-/**\n- * i40e_fcoe_setup_ddp_resources - allocate per cpu DDP resources\n- * @vsi: the VSI FCoE is associated with\n- *\n- * Returns 0 on successful or non zero on failure\n- *\n- **/\n-int i40e_fcoe_setup_ddp_resources(struct i40e_vsi *vsi)\n-{\n-\tstruct i40e_pf *pf = vsi->back;\n-\tstruct device *dev = &pf->pdev->dev;\n-\tstruct i40e_fcoe *fcoe = &pf->fcoe;\n-\tunsigned int cpu;\n-\tint i;\n-\n-\tif (vsi->type != I40E_VSI_FCOE)\n-\t\treturn -ENODEV;\n-\n-\t/* do nothing if no DDP pools were allocated */\n-\tif (fcoe->ddp_pool)\n-\t\treturn -EEXIST;\n-\n-\t/* allocate per CPU memory to track DDP pools */\n-\tfcoe->ddp_pool = alloc_percpu(struct i40e_fcoe_ddp_pool);\n-\tif (!fcoe->ddp_pool) {\n-\t\tdev_err(&pf->pdev->dev, \"failed to allocate percpu DDP\\n\");\n-\t\treturn -ENOMEM;\n-\t}\n-\n-\t/* allocate pci pool for each cpu */\n-\tfor_each_possible_cpu(cpu) {\n-\t\tif (!i40e_fcoe_dma_pool_create(fcoe, dev, cpu))\n-\t\t\tcontinue;\n-\n-\t\tdev_err(dev, \"failed to alloc DDP pool on cpu:%d\\n\", cpu);\n-\t\ti40e_fcoe_free_ddp_resources(vsi);\n-\t\treturn -ENOMEM;\n-\t}\n-\n-\t/* initialize the sw context */\n-\tfor (i = 0; i < I40E_FCOE_DDP_MAX; i++)\n-\t\ti40e_fcoe_ddp_clear(&fcoe->ddp[i]);\n-\n-\tnetdev_info(vsi->netdev, \"VSI %d,%d FCoE DDP resources allocated\\n\",\n-\t\t vsi->id, vsi->seid);\n-\n-\treturn 0;\n-}\n-\n-/**\n- * i40e_fcoe_handle_status - check the Programming Status for FCoE\n- * @rx_ring: the Rx ring for this descriptor\n- * @rx_desc: the Rx descriptor for Programming Status, not a packet descriptor.\n- *\n- * Check if this is the Rx Programming Status descriptor write-back for FCoE.\n- * This is used to verify if the context/filter programming or invalidation\n- * requested by SW to the HW is successful or not and take actions accordingly.\n- **/\n-void i40e_fcoe_handle_status(struct i40e_ring *rx_ring,\n-\t\t\t union i40e_rx_desc *rx_desc, u8 prog_id)\n-{\n-\tstruct i40e_pf *pf = rx_ring->vsi->back;\n-\tstruct i40e_fcoe *fcoe = &pf->fcoe;\n-\tstruct i40e_fcoe_ddp *ddp;\n-\tu32 error;\n-\tu16 xid;\n-\tu64 qw;\n-\n-\t/* we only care for FCoE here */\n-\tif (!i40e_fcoe_progid_is_fcoe(prog_id))\n-\t\treturn;\n-\n-\txid = le32_to_cpu(rx_desc->wb.qword0.hi_dword.fcoe_param) &\n-\t (I40E_FCOE_DDP_MAX - 1);\n-\n-\tif (!i40e_fcoe_xid_is_valid(xid))\n-\t\treturn;\n-\n-\tddp = &fcoe->ddp[xid];\n-\tWARN_ON(xid != ddp->xid);\n-\n-\tqw = le64_to_cpu(rx_desc->wb.qword1.status_error_len);\n-\terror = (qw & I40E_RX_PROG_STATUS_DESC_QW1_ERROR_MASK) >>\n-\t\tI40E_RX_PROG_STATUS_DESC_QW1_ERROR_SHIFT;\n-\n-\t/* DDP context programming status: failure or success */\n-\tif (prog_id == I40E_RX_PROG_STATUS_DESC_FCOE_CTXT_PROG_STATUS) {\n-\t\tif (I40E_RX_PROG_FCOE_ERROR_TBL_FULL(error)) {\n-\t\t\tdev_err(&pf->pdev->dev, \"xid %x ddp->xid %x TABLE FULL\\n\",\n-\t\t\t\txid, ddp->xid);\n-\t\t\tddp->prerr |= I40E_RX_PROG_FCOE_ERROR_TBL_FULL_BIT;\n-\t\t}\n-\t\tif (I40E_RX_PROG_FCOE_ERROR_CONFLICT(error)) {\n-\t\t\tdev_err(&pf->pdev->dev, \"xid %x ddp->xid %x CONFLICT\\n\",\n-\t\t\t\txid, ddp->xid);\n-\t\t\tddp->prerr |= I40E_RX_PROG_FCOE_ERROR_CONFLICT_BIT;\n-\t\t}\n-\t}\n-\n-\t/* DDP context invalidation status: failure or success */\n-\tif (prog_id == I40E_RX_PROG_STATUS_DESC_FCOE_CTXT_INVL_STATUS) {\n-\t\tif (I40E_RX_PROG_FCOE_ERROR_INVLFAIL(error)) {\n-\t\t\tdev_err(&pf->pdev->dev, \"xid %x ddp->xid %x INVALIDATION FAILURE\\n\",\n-\t\t\t\txid, ddp->xid);\n-\t\t\tddp->prerr |= I40E_RX_PROG_FCOE_ERROR_INVLFAIL_BIT;\n-\t\t}\n-\t\t/* clear the flag so we can retry invalidation */\n-\t\tclear_bit(__I40E_FCOE_DDP_ABORTED, &ddp->flags);\n-\t}\n-\n-\t/* unmap DMA */\n-\ti40e_fcoe_ddp_unmap(pf, ddp);\n-\ti40e_fcoe_ddp_clear(ddp);\n-}\n-\n-/**\n- * i40e_fcoe_handle_offload - check ddp status and mark it done\n- * @adapter: i40e adapter\n- * @rx_desc: advanced rx descriptor\n- * @skb: the skb holding the received data\n- *\n- * This checks ddp status.\n- *\n- * Returns : < 0 indicates an error or not a FCOE ddp, 0 indicates\n- * not passing the skb to ULD, > 0 indicates is the length of data\n- * being ddped.\n- *\n- **/\n-int i40e_fcoe_handle_offload(struct i40e_ring *rx_ring,\n-\t\t\t union i40e_rx_desc *rx_desc,\n-\t\t\t struct sk_buff *skb)\n-{\n-\tstruct i40e_pf *pf = rx_ring->vsi->back;\n-\tstruct i40e_fcoe *fcoe = &pf->fcoe;\n-\tstruct fc_frame_header *fh = NULL;\n-\tstruct i40e_fcoe_ddp *ddp = NULL;\n-\tu32 status, fltstat;\n-\tu32 error, fcerr;\n-\tint rc = -EINVAL;\n-\tu16 ptype;\n-\tu16 xid;\n-\tu64 qw;\n-\n-\t/* check this rxd is for programming status */\n-\tqw = le64_to_cpu(rx_desc->wb.qword1.status_error_len);\n-\t/* packet descriptor, check packet type */\n-\tptype = (qw & I40E_RXD_QW1_PTYPE_MASK) >> I40E_RXD_QW1_PTYPE_SHIFT;\n-\tif (!i40e_rx_is_fcoe(ptype))\n-\t\tgoto out_no_ddp;\n-\n-\terror = (qw & I40E_RXD_QW1_ERROR_MASK) >> I40E_RXD_QW1_ERROR_SHIFT;\n-\tfcerr = (error >> I40E_RX_DESC_ERROR_L3L4E_SHIFT) &\n-\t\t I40E_RX_DESC_FCOE_ERROR_MASK;\n-\n-\t/* check stateless offload error */\n-\tif (unlikely(fcerr == I40E_RX_DESC_ERROR_L3L4E_PROT)) {\n-\t\tdev_err(&pf->pdev->dev, \"Protocol Error\\n\");\n-\t\tskb->ip_summed = CHECKSUM_NONE;\n-\t} else {\n-\t\tskb->ip_summed = CHECKSUM_UNNECESSARY;\n-\t}\n-\n-\t/* check hw status on ddp */\n-\tstatus = (qw & I40E_RXD_QW1_STATUS_MASK) >> I40E_RXD_QW1_STATUS_SHIFT;\n-\tfltstat = (status >> I40E_RX_DESC_STATUS_FLTSTAT_SHIFT) &\n-\t\t I40E_RX_DESC_FLTSTAT_FCMASK;\n-\n-\t/* now we are ready to check DDP */\n-\tfh = i40e_fcoe_fc_frame_header(skb);\n-\txid = i40e_fcoe_fc_get_xid(fh);\n-\tif (!i40e_fcoe_xid_is_valid(xid))\n-\t\tgoto out_no_ddp;\n-\n-\t/* non DDP normal receive, return to the protocol stack */\n-\tif (fltstat == I40E_RX_DESC_FLTSTAT_NOMTCH)\n-\t\tgoto out_no_ddp;\n-\n-\t/* do we have a sw ddp context setup ? */\n-\tddp = &fcoe->ddp[xid];\n-\tif (!ddp->sgl)\n-\t\tgoto out_no_ddp;\n-\n-\t/* fetch xid from hw rxd wb, which should match up the sw ctxt */\n-\txid = le16_to_cpu(rx_desc->wb.qword0.lo_dword.mirr_fcoe.fcoe_ctx_id);\n-\tif (ddp->xid != xid) {\n-\t\tdev_err(&pf->pdev->dev, \"xid 0x%x does not match ctx_xid 0x%x\\n\",\n-\t\t\tddp->xid, xid);\n-\t\tgoto out_put_ddp;\n-\t}\n-\n-\t/* the same exchange has already errored out */\n-\tif (ddp->fcerr) {\n-\t\tdev_err(&pf->pdev->dev, \"xid 0x%x fcerr 0x%x reported fcer 0x%x\\n\",\n-\t\t\txid, ddp->fcerr, fcerr);\n-\t\tgoto out_put_ddp;\n-\t}\n-\n-\t/* fcoe param is valid by now with correct DDPed length */\n-\tddp->len = le32_to_cpu(rx_desc->wb.qword0.hi_dword.fcoe_param);\n-\tddp->fcerr = fcerr;\n-\t/* header posting only, useful only for target mode and debugging */\n-\tif (fltstat == I40E_RX_DESC_FLTSTAT_DDP) {\n-\t\t/* For target mode, we get header of the last packet but it\n-\t\t * does not have the FCoE trailer field, i.e., CRC and EOF\n-\t\t * Ordered Set since they are offloaded by the HW, so fill\n-\t\t * it up correspondingly to allow the packet to pass through\n-\t\t * to the upper protocol stack.\n-\t\t */\n-\t\tu32 f_ctl = ntoh24(fh->fh_f_ctl);\n-\n-\t\tif ((f_ctl & FC_FC_END_SEQ) &&\n-\t\t (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA)) {\n-\t\t\tstruct fcoe_crc_eof *crc = NULL;\n-\n-\t\t\tcrc = skb_put(skb, sizeof(*crc));\n-\t\t\tcrc->fcoe_eof = FC_EOF_T;\n-\t\t} else {\n-\t\t\t/* otherwise, drop the header only frame */\n-\t\t\trc = 0;\n-\t\t\tgoto out_no_ddp;\n-\t\t}\n-\t}\n-\n-out_put_ddp:\n-\t/* either we got RSP or we have an error, unmap DMA in both cases */\n-\ti40e_fcoe_ddp_unmap(pf, ddp);\n-\tif (ddp->len && !ddp->fcerr) {\n-\t\tint pkts;\n-\n-\t\trc = ddp->len;\n-\t\ti40e_fcoe_ddp_clear(ddp);\n-\t\tddp->len = rc;\n-\t\tpkts = DIV_ROUND_UP(rc, 2048);\n-\t\trx_ring->stats.bytes += rc;\n-\t\trx_ring->stats.packets += pkts;\n-\t\trx_ring->q_vector->rx.total_bytes += rc;\n-\t\trx_ring->q_vector->rx.total_packets += pkts;\n-\t\tset_bit(__I40E_FCOE_DDP_DONE, &ddp->flags);\n-\t}\n-\n-out_no_ddp:\n-\treturn rc;\n-}\n-\n-/**\n- * i40e_fcoe_ddp_setup - called to set up ddp context\n- * @netdev: the corresponding net_device\n- * @xid: the exchange id requesting ddp\n- * @sgl: the scatter-gather list for this request\n- * @sgc: the number of scatter-gather items\n- * @target_mode: indicates this is a DDP request for target\n- *\n- * Returns : 1 for success and 0 for no DDP on this I/O\n- **/\n-static int i40e_fcoe_ddp_setup(struct net_device *netdev, u16 xid,\n-\t\t\t struct scatterlist *sgl, unsigned int sgc,\n-\t\t\t int target_mode)\n-{\n-\tstatic const unsigned int bufflen = I40E_FCOE_DDP_BUF_MIN;\n-\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n-\tstruct i40e_fcoe_ddp_pool *ddp_pool;\n-\tstruct i40e_pf *pf = np->vsi->back;\n-\tstruct i40e_fcoe *fcoe = &pf->fcoe;\n-\tunsigned int i, j, dmacount;\n-\tstruct i40e_fcoe_ddp *ddp;\n-\tunsigned int firstoff = 0;\n-\tunsigned int thisoff = 0;\n-\tunsigned int thislen = 0;\n-\tstruct scatterlist *sg;\n-\tdma_addr_t addr = 0;\n-\tunsigned int len;\n-\n-\tif (xid >= I40E_FCOE_DDP_MAX) {\n-\t\tdev_warn(&pf->pdev->dev, \"xid=0x%x out-of-range\\n\", xid);\n-\t\treturn 0;\n-\t}\n-\n-\t/* no DDP if we are already down or resetting */\n-\tif (test_bit(__I40E_DOWN, &pf->state) ||\n-\t test_bit(__I40E_NEEDS_RESTART, &pf->state)) {\n-\t\tdev_info(&pf->pdev->dev, \"xid=0x%x device in reset/down\\n\",\n-\t\t\t xid);\n-\t\treturn 0;\n-\t}\n-\n-\tddp = &fcoe->ddp[xid];\n-\tif (ddp->sgl) {\n-\t\tdev_info(&pf->pdev->dev, \"xid 0x%x w/ non-null sgl=%p nents=%d\\n\",\n-\t\t\t xid, ddp->sgl, ddp->sgc);\n-\t\treturn 0;\n-\t}\n-\ti40e_fcoe_ddp_clear(ddp);\n-\n-\tif (!fcoe->ddp_pool) {\n-\t\tdev_info(&pf->pdev->dev, \"No DDP pool, xid 0x%x\\n\", xid);\n-\t\treturn 0;\n-\t}\n-\n-\tddp_pool = per_cpu_ptr(fcoe->ddp_pool, get_cpu());\n-\tif (!ddp_pool->pool) {\n-\t\tdev_info(&pf->pdev->dev, \"No percpu ddp pool, xid 0x%x\\n\", xid);\n-\t\tgoto out_noddp;\n-\t}\n-\n-\t/* setup dma from scsi command sgl */\n-\tdmacount = dma_map_sg(&pf->pdev->dev, sgl, sgc, DMA_FROM_DEVICE);\n-\tif (dmacount == 0) {\n-\t\tdev_info(&pf->pdev->dev, \"dma_map_sg for sgl %p, sgc %d failed\\n\",\n-\t\t\t sgl, sgc);\n-\t\tgoto out_noddp_unmap;\n-\t}\n-\n-\t/* alloc the udl from our ddp pool */\n-\tddp->udl = dma_pool_alloc(ddp_pool->pool, GFP_ATOMIC, &ddp->udp);\n-\tif (!ddp->udl) {\n-\t\tdev_info(&pf->pdev->dev,\n-\t\t\t \"Failed allocated ddp context, xid 0x%x\\n\", xid);\n-\t\tgoto out_noddp_unmap;\n-\t}\n-\n-\tj = 0;\n-\tddp->len = 0;\n-\tfor_each_sg(sgl, sg, dmacount, i) {\n-\t\taddr = sg_dma_address(sg);\n-\t\tlen = sg_dma_len(sg);\n-\t\tddp->len += len;\n-\t\twhile (len) {\n-\t\t\t/* max number of buffers allowed in one DDP context */\n-\t\t\tif (j >= I40E_FCOE_DDP_BUFFCNT_MAX) {\n-\t\t\t\tdev_info(&pf->pdev->dev,\n-\t\t\t\t\t \"xid=%x:%d,%d,%d:addr=%llx not enough descriptors\\n\",\n-\t\t\t\t\t xid, i, j, dmacount, (u64)addr);\n-\t\t\t\tgoto out_noddp_free;\n-\t\t\t}\n-\n-\t\t\t/* get the offset of length of current buffer */\n-\t\t\tthisoff = addr & ((dma_addr_t)bufflen - 1);\n-\t\t\tthislen = min_t(unsigned int, (bufflen - thisoff), len);\n-\t\t\t/* all but the 1st buffer (j == 0)\n-\t\t\t * must be aligned on bufflen\n-\t\t\t */\n-\t\t\tif ((j != 0) && (thisoff))\n-\t\t\t\tgoto out_noddp_free;\n-\n-\t\t\t/* all but the last buffer\n-\t\t\t * ((i == (dmacount - 1)) && (thislen == len))\n-\t\t\t * must end at bufflen\n-\t\t\t */\n-\t\t\tif (((i != (dmacount - 1)) || (thislen != len)) &&\n-\t\t\t ((thislen + thisoff) != bufflen))\n-\t\t\t\tgoto out_noddp_free;\n-\n-\t\t\tddp->udl[j] = (u64)(addr - thisoff);\n-\t\t\t/* only the first buffer may have none-zero offset */\n-\t\t\tif (j == 0)\n-\t\t\t\tfirstoff = thisoff;\n-\t\t\tlen -= thislen;\n-\t\t\taddr += thislen;\n-\t\t\tj++;\n-\t\t}\n-\t}\n-\t/* only the last buffer may have non-full bufflen */\n-\tddp->lastsize = thisoff + thislen;\n-\tddp->firstoff = firstoff;\n-\tddp->list_len = j;\n-\tddp->pool = ddp_pool->pool;\n-\tddp->sgl = sgl;\n-\tddp->sgc = sgc;\n-\tddp->xid = xid;\n-\tif (target_mode)\n-\t\tset_bit(__I40E_FCOE_DDP_TARGET, &ddp->flags);\n-\tset_bit(__I40E_FCOE_DDP_INITALIZED, &ddp->flags);\n-\n-\tput_cpu();\n-\treturn 1; /* Success */\n-\n-out_noddp_free:\n-\tdma_pool_free(ddp->pool, ddp->udl, ddp->udp);\n-\ti40e_fcoe_ddp_clear(ddp);\n-\n-out_noddp_unmap:\n-\tdma_unmap_sg(&pf->pdev->dev, sgl, sgc, DMA_FROM_DEVICE);\n-out_noddp:\n-\tput_cpu();\n-\treturn 0;\n-}\n-\n-/**\n- * i40e_fcoe_ddp_get - called to set up ddp context in initiator mode\n- * @netdev: the corresponding net_device\n- * @xid: the exchange id requesting ddp\n- * @sgl: the scatter-gather list for this request\n- * @sgc: the number of scatter-gather items\n- *\n- * This is the implementation of net_device_ops.ndo_fcoe_ddp_setup\n- * and is expected to be called from ULD, e.g., FCP layer of libfc\n- * to set up ddp for the corresponding xid of the given sglist for\n- * the corresponding I/O.\n- *\n- * Returns : 1 for success and 0 for no ddp\n- **/\n-static int i40e_fcoe_ddp_get(struct net_device *netdev, u16 xid,\n-\t\t\t struct scatterlist *sgl, unsigned int sgc)\n-{\n-\treturn i40e_fcoe_ddp_setup(netdev, xid, sgl, sgc, 0);\n-}\n-\n-/**\n- * i40e_fcoe_ddp_target - called to set up ddp context in target mode\n- * @netdev: the corresponding net_device\n- * @xid: the exchange id requesting ddp\n- * @sgl: the scatter-gather list for this request\n- * @sgc: the number of scatter-gather items\n- *\n- * This is the implementation of net_device_ops.ndo_fcoe_ddp_target\n- * and is expected to be called from ULD, e.g., FCP layer of libfc\n- * to set up ddp for the corresponding xid of the given sglist for\n- * the corresponding I/O. The DDP in target mode is a write I/O request\n- * from the initiator.\n- *\n- * Returns : 1 for success and 0 for no ddp\n- **/\n-static int i40e_fcoe_ddp_target(struct net_device *netdev, u16 xid,\n-\t\t\t\tstruct scatterlist *sgl, unsigned int sgc)\n-{\n-\treturn i40e_fcoe_ddp_setup(netdev, xid, sgl, sgc, 1);\n-}\n-\n-/**\n- * i40e_fcoe_program_ddp - programs the HW DDP related descriptors\n- * @tx_ring: transmit ring for this packet\n- * @skb: the packet to be sent out\n- * @sof: the SOF to indicate class of service\n- *\n- * Determine if it is READ/WRITE command, and finds out if there is\n- * a matching SW DDP context for this command. DDP is applicable\n- * only in case of READ if initiator or WRITE in case of\n- * responder (via checking XFER_RDY).\n- *\n- * Note: caller checks sof and ddp sw context\n- *\n- * Returns : none\n- *\n- **/\n-static void i40e_fcoe_program_ddp(struct i40e_ring *tx_ring,\n-\t\t\t\t struct sk_buff *skb,\n-\t\t\t\t struct i40e_fcoe_ddp *ddp, u8 sof)\n-{\n-\tstruct i40e_fcoe_filter_context_desc *filter_desc = NULL;\n-\tstruct i40e_fcoe_queue_context_desc *queue_desc = NULL;\n-\tstruct i40e_fcoe_ddp_context_desc *ddp_desc = NULL;\n-\tstruct i40e_pf *pf = tx_ring->vsi->back;\n-\tu16 i = tx_ring->next_to_use;\n-\tstruct fc_frame_header *fh;\n-\tu64 flags_rsvd_lanq = 0;\n-\tbool target_mode;\n-\n-\t/* check if abort is still pending */\n-\tif (test_bit(__I40E_FCOE_DDP_ABORTED, &ddp->flags)) {\n-\t\tdev_warn(&pf->pdev->dev,\n-\t\t\t \"DDP abort is still pending xid:%hx and ddp->flags:%lx:\\n\",\n-\t\t\t ddp->xid, ddp->flags);\n-\t\treturn;\n-\t}\n-\n-\t/* set the flag to indicate this is programmed */\n-\tif (test_and_set_bit(__I40E_FCOE_DDP_PROGRAMMED, &ddp->flags)) {\n-\t\tdev_warn(&pf->pdev->dev,\n-\t\t\t \"DDP is already programmed for xid:%hx and ddp->flags:%lx:\\n\",\n-\t\t\t ddp->xid, ddp->flags);\n-\t\treturn;\n-\t}\n-\n-\t/* Prepare the DDP context descriptor */\n-\tddp_desc = I40E_DDP_CONTEXT_DESC(tx_ring, i);\n-\ti++;\n-\tif (i == tx_ring->count)\n-\t\ti = 0;\n-\n-\tddp_desc->type_cmd_foff_lsize =\n-\t\t\t\tcpu_to_le64(I40E_TX_DESC_DTYPE_DDP_CTX\t|\n-\t\t\t\t((u64)I40E_FCOE_DDP_CTX_DESC_BSIZE_4K <<\n-\t\t\t\tI40E_FCOE_DDP_CTX_QW1_CMD_SHIFT)\t|\n-\t\t\t\t((u64)ddp->firstoff\t\t <<\n-\t\t\t\tI40E_FCOE_DDP_CTX_QW1_FOFF_SHIFT)\t|\n-\t\t\t\t((u64)ddp->lastsize\t\t <<\n-\t\t\t\tI40E_FCOE_DDP_CTX_QW1_LSIZE_SHIFT));\n-\tddp_desc->rsvd = cpu_to_le64(0);\n-\n-\t/* target mode needs last packet in the sequence */\n-\ttarget_mode = test_bit(__I40E_FCOE_DDP_TARGET, &ddp->flags);\n-\tif (target_mode)\n-\t\tddp_desc->type_cmd_foff_lsize |=\n-\t\t\tcpu_to_le64(I40E_FCOE_DDP_CTX_DESC_LASTSEQH);\n-\n-\t/* Prepare queue_context descriptor */\n-\tqueue_desc = I40E_QUEUE_CONTEXT_DESC(tx_ring, i++);\n-\tif (i == tx_ring->count)\n-\t\ti = 0;\n-\tqueue_desc->dmaindx_fbase = cpu_to_le64(ddp->xid | ((u64)ddp->udp));\n-\tqueue_desc->flen_tph = cpu_to_le64(ddp->list_len |\n-\t\t\t\t((u64)(I40E_FCOE_QUEUE_CTX_DESC_TPHRDESC |\n-\t\t\t\tI40E_FCOE_QUEUE_CTX_DESC_TPHDATA) <<\n-\t\t\t\tI40E_FCOE_QUEUE_CTX_QW1_TPH_SHIFT));\n-\n-\t/* Prepare filter_context_desc */\n-\tfilter_desc = I40E_FILTER_CONTEXT_DESC(tx_ring, i);\n-\ti++;\n-\tif (i == tx_ring->count)\n-\t\ti = 0;\n-\n-\tfh = (struct fc_frame_header *)skb_transport_header(skb);\n-\tfilter_desc->param = cpu_to_le32(ntohl(fh->fh_parm_offset));\n-\tfilter_desc->seqn = cpu_to_le16(ntohs(fh->fh_seq_cnt));\n-\tfilter_desc->rsvd_dmaindx = cpu_to_le16(ddp->xid <<\n-\t\t\t\tI40E_FCOE_FILTER_CTX_QW0_DMAINDX_SHIFT);\n-\n-\tflags_rsvd_lanq = I40E_FCOE_FILTER_CTX_DESC_CTYP_DDP;\n-\tflags_rsvd_lanq |= (u64)(target_mode ?\n-\t\t\tI40E_FCOE_FILTER_CTX_DESC_ENODE_RSP :\n-\t\t\tI40E_FCOE_FILTER_CTX_DESC_ENODE_INIT);\n-\n-\tflags_rsvd_lanq |= (u64)((sof == FC_SOF_I2 || sof == FC_SOF_N2) ?\n-\t\t\tI40E_FCOE_FILTER_CTX_DESC_FC_CLASS2 :\n-\t\t\tI40E_FCOE_FILTER_CTX_DESC_FC_CLASS3);\n-\n-\tflags_rsvd_lanq |= ((u64)skb->queue_mapping <<\n-\t\t\t\tI40E_FCOE_FILTER_CTX_QW1_LANQINDX_SHIFT);\n-\tfilter_desc->flags_rsvd_lanq = cpu_to_le64(flags_rsvd_lanq);\n-\n-\t/* By this time, all offload related descriptors has been programmed */\n-\ttx_ring->next_to_use = i;\n-}\n-\n-/**\n- * i40e_fcoe_invalidate_ddp - invalidates DDP in case of abort\n- * @tx_ring: transmit ring for this packet\n- * @skb: the packet associated w/ this DDP invalidation, i.e., ABTS\n- * @ddp: the SW DDP context for this DDP\n- *\n- * Programs the Tx context descriptor to do DDP invalidation.\n- **/\n-static void i40e_fcoe_invalidate_ddp(struct i40e_ring *tx_ring,\n-\t\t\t\t struct sk_buff *skb,\n-\t\t\t\t struct i40e_fcoe_ddp *ddp)\n-{\n-\tstruct i40e_tx_context_desc *context_desc;\n-\tint i;\n-\n-\tif (test_and_set_bit(__I40E_FCOE_DDP_ABORTED, &ddp->flags))\n-\t\treturn;\n-\n-\ti = tx_ring->next_to_use;\n-\tcontext_desc = I40E_TX_CTXTDESC(tx_ring, i);\n-\ti++;\n-\tif (i == tx_ring->count)\n-\t\ti = 0;\n-\n-\tcontext_desc->tunneling_params = cpu_to_le32(0);\n-\tcontext_desc->l2tag2 = cpu_to_le16(0);\n-\tcontext_desc->rsvd = cpu_to_le16(0);\n-\tcontext_desc->type_cmd_tso_mss = cpu_to_le64(\n-\t\tI40E_TX_DESC_DTYPE_FCOE_CTX |\n-\t\t(I40E_FCOE_TX_CTX_DESC_OPCODE_DDP_CTX_INVL <<\n-\t\tI40E_TXD_CTX_QW1_CMD_SHIFT) |\n-\t\t(I40E_FCOE_TX_CTX_DESC_OPCODE_SINGLE_SEND <<\n-\t\tI40E_TXD_CTX_QW1_CMD_SHIFT));\n-\ttx_ring->next_to_use = i;\n-}\n-\n-/**\n- * i40e_fcoe_handle_ddp - check we should setup or invalidate DDP\n- * @tx_ring: transmit ring for this packet\n- * @skb: the packet to be sent out\n- * @sof: the SOF to indicate class of service\n- *\n- * Determine if it is ABTS/READ/XFER_RDY, and finds out if there is\n- * a matching SW DDP context for this command. DDP is applicable\n- * only in case of READ if initiator or WRITE in case of\n- * responder (via checking XFER_RDY). In case this is an ABTS, send\n- * just invalidate the context.\n- **/\n-static void i40e_fcoe_handle_ddp(struct i40e_ring *tx_ring,\n-\t\t\t\t struct sk_buff *skb, u8 sof)\n-{\n-\tstruct i40e_pf *pf = tx_ring->vsi->back;\n-\tstruct i40e_fcoe *fcoe = &pf->fcoe;\n-\tstruct fc_frame_header *fh;\n-\tstruct i40e_fcoe_ddp *ddp;\n-\tu32 f_ctl;\n-\tu8 r_ctl;\n-\tu16 xid;\n-\n-\tfh = (struct fc_frame_header *)skb_transport_header(skb);\n-\tf_ctl = ntoh24(fh->fh_f_ctl);\n-\tr_ctl = fh->fh_r_ctl;\n-\tddp = NULL;\n-\n-\tif ((r_ctl == FC_RCTL_DD_DATA_DESC) && (f_ctl & FC_FC_EX_CTX)) {\n-\t\t/* exchange responder? if so, XFER_RDY for write */\n-\t\txid = ntohs(fh->fh_rx_id);\n-\t\tif (i40e_fcoe_xid_is_valid(xid)) {\n-\t\t\tddp = &fcoe->ddp[xid];\n-\t\t\tif ((ddp->xid == xid) &&\n-\t\t\t (test_bit(__I40E_FCOE_DDP_TARGET, &ddp->flags)))\n-\t\t\t\ti40e_fcoe_program_ddp(tx_ring, skb, ddp, sof);\n-\t\t}\n-\t} else if (r_ctl == FC_RCTL_DD_UNSOL_CMD) {\n-\t\t/* exchange originator, check READ cmd */\n-\t\txid = ntohs(fh->fh_ox_id);\n-\t\tif (i40e_fcoe_xid_is_valid(xid)) {\n-\t\t\tddp = &fcoe->ddp[xid];\n-\t\t\tif ((ddp->xid == xid) &&\n-\t\t\t (!test_bit(__I40E_FCOE_DDP_TARGET, &ddp->flags)))\n-\t\t\t\ti40e_fcoe_program_ddp(tx_ring, skb, ddp, sof);\n-\t\t}\n-\t} else if (r_ctl == FC_RCTL_BA_ABTS) {\n-\t\t/* exchange originator, check ABTS */\n-\t\txid = ntohs(fh->fh_ox_id);\n-\t\tif (i40e_fcoe_xid_is_valid(xid)) {\n-\t\t\tddp = &fcoe->ddp[xid];\n-\t\t\tif ((ddp->xid == xid) &&\n-\t\t\t (!test_bit(__I40E_FCOE_DDP_TARGET, &ddp->flags)))\n-\t\t\t\ti40e_fcoe_invalidate_ddp(tx_ring, skb, ddp);\n-\t\t}\n-\t}\n-}\n-\n-/**\n- * i40e_fcoe_tso - set up FCoE TSO\n- * @tx_ring: ring to send buffer on\n- * @skb: send buffer\n- * @tx_flags: collected send information\n- * @hdr_len: the tso header length\n- * @sof: the SOF to indicate class of service\n- *\n- * Note must already have sof checked to be either class 2 or class 3 before\n- * calling this function.\n- *\n- * Returns 1 to indicate sequence segmentation offload is properly setup\n- * or returns 0 to indicate no tso is needed, otherwise returns error\n- * code to drop the frame.\n- **/\n-static int i40e_fcoe_tso(struct i40e_ring *tx_ring,\n-\t\t\t struct sk_buff *skb,\n-\t\t\t u32 tx_flags, u8 *hdr_len, u8 sof)\n-{\n-\tstruct i40e_tx_context_desc *context_desc;\n-\tu32 cd_type, cd_cmd, cd_tso_len, cd_mss;\n-\tstruct fc_frame_header *fh;\n-\tu64 cd_type_cmd_tso_mss;\n-\n-\t/* must match gso type as FCoE */\n-\tif (!skb_is_gso(skb))\n-\t\treturn 0;\n-\n-\t/* is it the expected gso type for FCoE ?*/\n-\tif (skb_shinfo(skb)->gso_type != SKB_GSO_FCOE) {\n-\t\tnetdev_err(skb->dev,\n-\t\t\t \"wrong gso type %d:expecting SKB_GSO_FCOE\\n\",\n-\t\t\t skb_shinfo(skb)->gso_type);\n-\t\treturn -EINVAL;\n-\t}\n-\n-\t/* header and trailer are inserted by hw */\n-\t*hdr_len = skb_transport_offset(skb) + sizeof(struct fc_frame_header) +\n-\t\t sizeof(struct fcoe_crc_eof);\n-\n-\t/* check sof to decide a class 2 or 3 TSO */\n-\tif (likely(i40e_fcoe_sof_is_class3(sof)))\n-\t\tcd_cmd = I40E_FCOE_TX_CTX_DESC_OPCODE_TSO_FC_CLASS3;\n-\telse\n-\t\tcd_cmd = I40E_FCOE_TX_CTX_DESC_OPCODE_TSO_FC_CLASS2;\n-\n-\t/* param field valid? */\n-\tfh = (struct fc_frame_header *)skb_transport_header(skb);\n-\tif (fh->fh_f_ctl[2] & FC_FC_REL_OFF)\n-\t\tcd_cmd |= I40E_FCOE_TX_CTX_DESC_RELOFF;\n-\n-\t/* fill the field values */\n-\tcd_type = I40E_TX_DESC_DTYPE_FCOE_CTX;\n-\tcd_tso_len = skb->len - *hdr_len;\n-\tcd_mss = skb_shinfo(skb)->gso_size;\n-\tcd_type_cmd_tso_mss =\n-\t\t((u64)cd_type << I40E_TXD_CTX_QW1_DTYPE_SHIFT) |\n-\t\t((u64)cd_cmd << I40E_TXD_CTX_QW1_CMD_SHIFT)\t |\n-\t\t((u64)cd_tso_len << I40E_TXD_CTX_QW1_TSO_LEN_SHIFT) |\n-\t\t((u64)cd_mss << I40E_TXD_CTX_QW1_MSS_SHIFT);\n-\n-\t/* grab the next descriptor */\n-\tcontext_desc = I40E_TX_CTXTDESC(tx_ring, tx_ring->next_to_use);\n-\ttx_ring->next_to_use++;\n-\tif (tx_ring->next_to_use == tx_ring->count)\n-\t\ttx_ring->next_to_use = 0;\n-\n-\tcontext_desc->tunneling_params = 0;\n-\tcontext_desc->l2tag2 = cpu_to_le16((tx_flags & I40E_TX_FLAGS_VLAN_MASK)\n-\t\t\t\t\t >> I40E_TX_FLAGS_VLAN_SHIFT);\n-\tcontext_desc->type_cmd_tso_mss = cpu_to_le64(cd_type_cmd_tso_mss);\n-\n-\treturn 1;\n-}\n-\n-/**\n- * i40e_fcoe_tx_map - build the tx descriptor\n- * @tx_ring: ring to send buffer on\n- * @skb: send buffer\n- * @first: first buffer info buffer to use\n- * @tx_flags: collected send information\n- * @hdr_len: ptr to the size of the packet header\n- * @eof: the frame eof value\n- *\n- * Note, for FCoE, sof and eof are already checked\n- **/\n-static void i40e_fcoe_tx_map(struct i40e_ring *tx_ring,\n-\t\t\t struct sk_buff *skb,\n-\t\t\t struct i40e_tx_buffer *first,\n-\t\t\t u32 tx_flags, u8 hdr_len, u8 eof)\n-{\n-\tu32 td_offset = 0;\n-\tu32 td_cmd = 0;\n-\tu32 maclen;\n-\n-\t/* insert CRC */\n-\ttd_cmd = I40E_TX_DESC_CMD_ICRC;\n-\n-\t/* setup MACLEN */\n-\tmaclen = skb_network_offset(skb);\n-\tif (tx_flags & I40E_TX_FLAGS_SW_VLAN)\n-\t\tmaclen += sizeof(struct vlan_hdr);\n-\n-\tif (skb->protocol == htons(ETH_P_FCOE)) {\n-\t\t/* for FCoE, maclen should exclude ether type */\n-\t\tmaclen -= 2;\n-\t\t/* setup type as FCoE and EOF insertion */\n-\t\ttd_cmd |= (I40E_TX_DESC_CMD_FCOET | i40e_fcoe_ctxt_eof(eof));\n-\t\t/* setup FCoELEN and FCLEN */\n-\t\ttd_offset |= ((((sizeof(struct fcoe_hdr) + 2) >> 2) <<\n-\t\t\t\tI40E_TX_DESC_LENGTH_IPLEN_SHIFT) |\n-\t\t\t ((sizeof(struct fc_frame_header) >> 2) <<\n-\t\t\t\tI40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT));\n-\t\t/* trim to exclude trailer */\n-\t\tpskb_trim(skb, skb->len - sizeof(struct fcoe_crc_eof));\n-\t}\n-\n-\t/* MACLEN is ether header length in words not bytes */\n-\ttd_offset |= (maclen >> 1) << I40E_TX_DESC_LENGTH_MACLEN_SHIFT;\n-\n-\ti40e_tx_map(tx_ring, skb, first, tx_flags, hdr_len, td_cmd, td_offset);\n-}\n-\n-/**\n- * i40e_fcoe_set_skb_header - adjust skb header point for FIP/FCoE/FC\n- * @skb: the skb to be adjusted\n- *\n- * Returns true if this skb is a FCoE/FIP or VLAN carried FCoE/FIP and then\n- * adjusts the skb header pointers correspondingly. Otherwise, returns false.\n- **/\n-static inline int i40e_fcoe_set_skb_header(struct sk_buff *skb)\n-{\n-\t__be16 protocol = skb->protocol;\n-\n-\tskb_reset_mac_header(skb);\n-\tskb->mac_len = sizeof(struct ethhdr);\n-\tif (protocol == htons(ETH_P_8021Q)) {\n-\t\tstruct vlan_ethhdr *veth = (struct vlan_ethhdr *)eth_hdr(skb);\n-\n-\t\tprotocol = veth->h_vlan_encapsulated_proto;\n-\t\tskb->mac_len += sizeof(struct vlan_hdr);\n-\t}\n-\n-\t/* FCoE or FIP only */\n-\tif ((protocol != htons(ETH_P_FIP)) &&\n-\t (protocol != htons(ETH_P_FCOE)))\n-\t\treturn -EINVAL;\n-\n-\t/* set header to L2 of FCoE/FIP */\n-\tskb_set_network_header(skb, skb->mac_len);\n-\tif (protocol == htons(ETH_P_FIP))\n-\t\treturn 0;\n-\n-\t/* set header to L3 of FC */\n-\tskb_set_transport_header(skb, skb->mac_len + sizeof(struct fcoe_hdr));\n-\treturn 0;\n-}\n-\n-/**\n- * i40e_fcoe_xmit_frame - transmit buffer\n- * @skb: send buffer\n- * @netdev: the fcoe netdev\n- *\n- * Returns 0 if sent, else an error code\n- **/\n-static netdev_tx_t i40e_fcoe_xmit_frame(struct sk_buff *skb,\n-\t\t\t\t\tstruct net_device *netdev)\n-{\n-\tstruct i40e_netdev_priv *np = netdev_priv(skb->dev);\n-\tstruct i40e_vsi *vsi = np->vsi;\n-\tstruct i40e_ring *tx_ring = vsi->tx_rings[skb->queue_mapping];\n-\tstruct i40e_tx_buffer *first;\n-\tu32 tx_flags = 0;\n-\tint fso, count;\n-\tu8 hdr_len = 0;\n-\tu8 sof = 0;\n-\tu8 eof = 0;\n-\n-\tif (i40e_fcoe_set_skb_header(skb))\n-\t\tgoto out_drop;\n-\n-\tcount = i40e_xmit_descriptor_count(skb);\n-\tif (i40e_chk_linearize(skb, count)) {\n-\t\tif (__skb_linearize(skb))\n-\t\t\tgoto out_drop;\n-\t\tcount = i40e_txd_use_count(skb->len);\n-\t\ttx_ring->tx_stats.tx_linearize++;\n-\t}\n-\n-\t/* need: 1 descriptor per page * PAGE_SIZE/I40E_MAX_DATA_PER_TXD,\n-\t * + 1 desc for skb_head_len/I40E_MAX_DATA_PER_TXD,\n-\t * + 4 desc gap to avoid the cache line where head is,\n-\t * + 1 desc for context descriptor,\n-\t * otherwise try next time\n-\t */\n-\tif (i40e_maybe_stop_tx(tx_ring, count + 4 + 1)) {\n-\t\ttx_ring->tx_stats.tx_busy++;\n-\t\treturn NETDEV_TX_BUSY;\n-\t}\n-\n-\t/* prepare the xmit flags */\n-\tif (i40e_tx_prepare_vlan_flags(skb, tx_ring, &tx_flags))\n-\t\tgoto out_drop;\n-\n-\t/* record the location of the first descriptor for this packet */\n-\tfirst = &tx_ring->tx_bi[tx_ring->next_to_use];\n-\n-\t/* FIP is a regular L2 traffic w/o offload */\n-\tif (skb->protocol == htons(ETH_P_FIP))\n-\t\tgoto out_send;\n-\n-\t/* check sof and eof, only supports FC Class 2 or 3 */\n-\tif (i40e_fcoe_fc_sof(skb, &sof) || i40e_fcoe_fc_eof(skb, &eof)) {\n-\t\tnetdev_err(netdev, \"SOF/EOF error:%02x - %02x\\n\", sof, eof);\n-\t\tgoto out_drop;\n-\t}\n-\n-\t/* always do FCCRC for FCoE */\n-\ttx_flags |= I40E_TX_FLAGS_FCCRC;\n-\n-\t/* check we should do sequence offload */\n-\tfso = i40e_fcoe_tso(tx_ring, skb, tx_flags, &hdr_len, sof);\n-\tif (fso < 0)\n-\t\tgoto out_drop;\n-\telse if (fso)\n-\t\ttx_flags |= I40E_TX_FLAGS_FSO;\n-\telse\n-\t\ti40e_fcoe_handle_ddp(tx_ring, skb, sof);\n-\n-out_send:\n-\t/* send out the packet */\n-\ti40e_fcoe_tx_map(tx_ring, skb, first, tx_flags, hdr_len, eof);\n-\n-\ti40e_maybe_stop_tx(tx_ring, DESC_NEEDED);\n-\treturn NETDEV_TX_OK;\n-\n-out_drop:\n-\tdev_kfree_skb_any(skb);\n-\treturn NETDEV_TX_OK;\n-}\n-\n-/**\n- * i40e_fcoe_change_mtu - NDO callback to change the Maximum Transfer Unit\n- * @netdev: network interface device structure\n- * @new_mtu: new value for maximum frame size\n- *\n- * Returns error as operation not permitted\n- *\n- **/\n-static int i40e_fcoe_change_mtu(struct net_device *netdev, int new_mtu)\n-{\n-\tnetdev_warn(netdev, \"MTU change is not supported on FCoE interfaces\\n\");\n-\treturn -EPERM;\n-}\n-\n-/**\n- * i40e_fcoe_set_features - set the netdev feature flags\n- * @netdev: ptr to the netdev being adjusted\n- * @features: the feature set that the stack is suggesting\n- *\n- **/\n-static int i40e_fcoe_set_features(struct net_device *netdev,\n-\t\t\t\t netdev_features_t features)\n-{\n-\tstruct i40e_netdev_priv *np = netdev_priv(netdev);\n-\tstruct i40e_vsi *vsi = np->vsi;\n-\n-\tif (features & NETIF_F_HW_VLAN_CTAG_RX)\n-\t\ti40e_vlan_stripping_enable(vsi);\n-\telse\n-\t\ti40e_vlan_stripping_disable(vsi);\n-\n-\treturn 0;\n-}\n-\n-static const struct net_device_ops i40e_fcoe_netdev_ops = {\n-\t.ndo_open\t\t= i40e_open,\n-\t.ndo_stop\t\t= i40e_close,\n-\t.ndo_get_stats64\t= i40e_get_netdev_stats_struct,\n-\t.ndo_set_rx_mode\t= i40e_set_rx_mode,\n-\t.ndo_validate_addr\t= eth_validate_addr,\n-\t.ndo_set_mac_address\t= i40e_set_mac,\n-\t.ndo_change_mtu\t\t= i40e_fcoe_change_mtu,\n-\t.ndo_do_ioctl\t\t= i40e_ioctl,\n-\t.ndo_tx_timeout\t\t= i40e_tx_timeout,\n-\t.ndo_vlan_rx_add_vid\t= i40e_vlan_rx_add_vid,\n-\t.ndo_vlan_rx_kill_vid\t= i40e_vlan_rx_kill_vid,\n-\t.ndo_setup_tc\t\t= __i40e_setup_tc,\n-\n-#ifdef CONFIG_NET_POLL_CONTROLLER\n-\t.ndo_poll_controller\t= i40e_netpoll,\n-#endif\n-\t.ndo_start_xmit\t\t= i40e_fcoe_xmit_frame,\n-\t.ndo_fcoe_enable\t= i40e_fcoe_enable,\n-\t.ndo_fcoe_disable\t= i40e_fcoe_disable,\n-\t.ndo_fcoe_ddp_setup\t= i40e_fcoe_ddp_get,\n-\t.ndo_fcoe_ddp_done\t= i40e_fcoe_ddp_put,\n-\t.ndo_fcoe_ddp_target\t= i40e_fcoe_ddp_target,\n-\t.ndo_set_features\t= i40e_fcoe_set_features,\n-};\n-\n-/* fcoe network device type */\n-static struct device_type fcoe_netdev_type = {\n-\t.name = \"fcoe\",\n-};\n-\n-/**\n- * i40e_fcoe_config_netdev - prepares the VSI context for creating a FCoE VSI\n- * @vsi: pointer to the associated VSI struct\n- * @ctxt: pointer to the associated VSI context to be passed to HW\n- *\n- * Returns 0 on success or < 0 on error\n- **/\n-void i40e_fcoe_config_netdev(struct net_device *netdev, struct i40e_vsi *vsi)\n-{\n-\tstruct i40e_hw *hw = &vsi->back->hw;\n-\tstruct i40e_pf *pf = vsi->back;\n-\n-\tif (vsi->type != I40E_VSI_FCOE)\n-\t\treturn;\n-\n-\tnetdev->features = (NETIF_F_HW_VLAN_CTAG_TX |\n-\t\t\t NETIF_F_HW_VLAN_CTAG_RX |\n-\t\t\t NETIF_F_HW_VLAN_CTAG_FILTER);\n-\n-\tnetdev->vlan_features = netdev->features;\n-\tnetdev->vlan_features &= ~(NETIF_F_HW_VLAN_CTAG_TX |\n-\t\t\t\t NETIF_F_HW_VLAN_CTAG_RX |\n-\t\t\t\t NETIF_F_HW_VLAN_CTAG_FILTER);\n-\tnetdev->fcoe_ddp_xid = I40E_FCOE_DDP_MAX - 1;\n-\tnetdev->features |= NETIF_F_ALL_FCOE;\n-\tnetdev->vlan_features |= NETIF_F_ALL_FCOE;\n-\tnetdev->hw_features |= netdev->features;\n-\tnetdev->priv_flags |= IFF_UNICAST_FLT;\n-\tnetdev->priv_flags |= IFF_SUPP_NOFCS;\n-\n-\tstrlcpy(netdev->name, \"fcoe%d\", IFNAMSIZ-1);\n-\tnetdev->mtu = FCOE_MTU;\n-\tSET_NETDEV_DEV(netdev, &pf->pdev->dev);\n-\tSET_NETDEV_DEVTYPE(netdev, &fcoe_netdev_type);\n-\t/* set different dev_port value 1 for FCoE netdev than the default\n-\t * zero dev_port value for PF netdev, this helps biosdevname user\n-\t * tool to differentiate them correctly while both attached to the\n-\t * same PCI function.\n-\t */\n-\tnetdev->dev_port = 1;\n-\tspin_lock_bh(&vsi->mac_filter_hash_lock);\n-\ti40e_add_filter(vsi, hw->mac.san_addr, 0);\n-\ti40e_add_filter(vsi, (u8[6]) FC_FCOE_FLOGI_MAC, 0);\n-\ti40e_add_filter(vsi, FIP_ALL_FCOE_MACS, 0);\n-\ti40e_add_filter(vsi, FIP_ALL_ENODE_MACS, 0);\n-\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n-\n-\t/* use san mac */\n-\tether_addr_copy(netdev->dev_addr, hw->mac.san_addr);\n-\tether_addr_copy(netdev->perm_addr, hw->mac.san_addr);\n-\t/* fcoe netdev ops */\n-\tnetdev->netdev_ops = &i40e_fcoe_netdev_ops;\n-}\n-\n-/**\n- * i40e_fcoe_vsi_setup - allocate and set up FCoE VSI\n- * @pf: the PF that VSI is associated with\n- *\n- **/\n-void i40e_fcoe_vsi_setup(struct i40e_pf *pf)\n-{\n-\tstruct i40e_vsi *vsi;\n-\tu16 seid;\n-\tint i;\n-\n-\tif (!(pf->flags & I40E_FLAG_FCOE_ENABLED))\n-\t\treturn;\n-\n-\tfor (i = 0; i < pf->num_alloc_vsi; i++) {\n-\t\tvsi = pf->vsi[i];\n-\t\tif (vsi && vsi->type == I40E_VSI_FCOE) {\n-\t\t\tdev_warn(&pf->pdev->dev,\n-\t\t\t\t \"FCoE VSI already created\\n\");\n-\t\t\treturn;\n-\t\t}\n-\t}\n-\n-\tseid = pf->vsi[pf->lan_vsi]->seid;\n-\tvsi = i40e_vsi_setup(pf, I40E_VSI_FCOE, seid, 0);\n-\tif (vsi) {\n-\t\tdev_dbg(&pf->pdev->dev,\n-\t\t\t\"Successfully created FCoE VSI seid %d id %d uplink_seid %d PF seid %d\\n\",\n-\t\t\tvsi->seid, vsi->id, vsi->uplink_seid, seid);\n-\t} else {\n-\t\tdev_info(&pf->pdev->dev, \"Failed to create FCoE VSI\\n\");\n-\t}\n-}\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_fcoe.h b/drivers/net/ethernet/intel/i40e/i40e_fcoe.h\ndeleted file mode 100644\nindex a93174ddeaba..000000000000\n--- a/drivers/net/ethernet/intel/i40e/i40e_fcoe.h\n+++ /dev/null\n@@ -1,127 +0,0 @@\n-/*******************************************************************************\n- *\n- * Intel Ethernet Controller XL710 Family Linux Driver\n- * Copyright(c) 2013 - 2014 Intel Corporation.\n- *\n- * This program is free software; you can redistribute it and/or modify it\n- * under the terms and conditions of the GNU General Public License,\n- * version 2, as published by the Free Software Foundation.\n- *\n- * This program is distributed in the hope it will be useful, but WITHOUT\n- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n- * more details.\n- *\n- * You should have received a copy of the GNU General Public License along\n- * with this program. If not, see <http://www.gnu.org/licenses/>.\n- *\n- * The full GNU General Public License is included in this distribution in\n- * the file called \"COPYING\".\n- *\n- * Contact Information:\n- * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>\n- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497\n- *\n- ******************************************************************************/\n-\n-#ifndef _I40E_FCOE_H_\n-#define _I40E_FCOE_H_\n-\n-/* FCoE HW context helper macros */\n-#define I40E_DDP_CONTEXT_DESC(R, i) \\\n-\t(&(((struct i40e_fcoe_ddp_context_desc *)((R)->desc))[i]))\n-\n-#define I40E_QUEUE_CONTEXT_DESC(R, i) \\\n-\t(&(((struct i40e_fcoe_queue_context_desc *)((R)->desc))[i]))\n-\n-#define I40E_FILTER_CONTEXT_DESC(R, i) \\\n-\t(&(((struct i40e_fcoe_filter_context_desc *)((R)->desc))[i]))\n-\n-/* receive queue descriptor filter status for FCoE */\n-#define I40E_RX_DESC_FLTSTAT_FCMASK\t0x3\n-#define I40E_RX_DESC_FLTSTAT_NOMTCH\t0x0\t/* no ddp context match */\n-#define I40E_RX_DESC_FLTSTAT_NODDP\t0x1\t/* no ddp due to error */\n-#define I40E_RX_DESC_FLTSTAT_DDP\t0x2\t/* DDPed payload, post header */\n-#define I40E_RX_DESC_FLTSTAT_FCPRSP\t0x3\t/* FCP_RSP */\n-\n-/* receive queue descriptor error codes for FCoE */\n-#define I40E_RX_DESC_FCOE_ERROR_MASK\t\t\\\n-\t(I40E_RX_DESC_ERROR_L3L4E_PROT |\t\\\n-\t I40E_RX_DESC_ERROR_L3L4E_FC |\t\t\\\n-\t I40E_RX_DESC_ERROR_L3L4E_DMAC_ERR |\t\\\n-\t I40E_RX_DESC_ERROR_L3L4E_DMAC_WARN)\n-\n-/* receive queue descriptor programming error */\n-#define I40E_RX_PROG_FCOE_ERROR_TBL_FULL(e)\t\\\n-\t(((e) >> I40E_RX_PROG_STATUS_DESC_FCOE_TBL_FULL_SHIFT) & 0x1)\n-\n-#define I40E_RX_PROG_FCOE_ERROR_CONFLICT(e)\t\\\n-\t(((e) >> I40E_RX_PROG_STATUS_DESC_FCOE_CONFLICT_SHIFT) & 0x1)\n-\n-#define I40E_RX_PROG_FCOE_ERROR_TBL_FULL_BIT\t\\\n-\tBIT(I40E_RX_PROG_STATUS_DESC_FCOE_TBL_FULL_SHIFT)\n-#define I40E_RX_PROG_FCOE_ERROR_CONFLICT_BIT\t\\\n-\tBIT(I40E_RX_PROG_STATUS_DESC_FCOE_CONFLICT_SHIFT)\n-\n-#define I40E_RX_PROG_FCOE_ERROR_INVLFAIL(e)\t\\\n-\tI40E_RX_PROG_FCOE_ERROR_CONFLICT(e)\n-#define I40E_RX_PROG_FCOE_ERROR_INVLFAIL_BIT\t\\\n-\tI40E_RX_PROG_FCOE_ERROR_CONFLICT_BIT\n-\n-/* FCoE DDP related definitions */\n-#define I40E_FCOE_MIN_XID\t0x0000 /* the min xid supported by fcoe_sw */\n-#define I40E_FCOE_MAX_XID\t0x0FFF /* the max xid supported by fcoe_sw */\n-#define I40E_FCOE_DDP_BUFFCNT_MAX\t512\t/* 9 bits bufcnt */\n-#define I40E_FCOE_DDP_PTR_ALIGN\t\t16\n-#define I40E_FCOE_DDP_PTR_MAX\t(I40E_FCOE_DDP_BUFFCNT_MAX * sizeof(dma_addr_t))\n-#define I40E_FCOE_DDP_BUF_MIN\t4096\n-#define I40E_FCOE_DDP_MAX\t2048\n-#define I40E_FCOE_FILTER_CTX_QW1_PCTYPE_SHIFT\t8\n-\n-/* supported netdev features for FCoE */\n-#define I40E_FCOE_NETIF_FEATURES (NETIF_F_ALL_FCOE | \\\n-\tNETIF_F_HW_VLAN_CTAG_TX | \\\n-\tNETIF_F_HW_VLAN_CTAG_RX | \\\n-\tNETIF_F_HW_VLAN_CTAG_FILTER)\n-\n-/* DDP context flags */\n-enum i40e_fcoe_ddp_flags {\n-\t__I40E_FCOE_DDP_NONE = 1,\n-\t__I40E_FCOE_DDP_TARGET,\n-\t__I40E_FCOE_DDP_INITALIZED,\n-\t__I40E_FCOE_DDP_PROGRAMMED,\n-\t__I40E_FCOE_DDP_DONE,\n-\t__I40E_FCOE_DDP_ABORTED,\n-\t__I40E_FCOE_DDP_UNMAPPED,\n-};\n-\n-/* DDP SW context struct */\n-struct i40e_fcoe_ddp {\n-\tint len;\n-\tu16 xid;\n-\tu16 firstoff;\n-\tu16 lastsize;\n-\tu16 list_len;\n-\tu8 fcerr;\n-\tu8 prerr;\n-\tunsigned long flags;\n-\tunsigned int sgc;\n-\tstruct scatterlist *sgl;\n-\tdma_addr_t udp;\n-\tu64 *udl;\n-\tstruct dma_pool *pool;\n-\n-};\n-\n-struct i40e_fcoe_ddp_pool {\n-\tstruct dma_pool *pool;\n-};\n-\n-struct i40e_fcoe {\n-\tunsigned long mode;\n-\tatomic_t refcnt;\n-\tstruct i40e_fcoe_ddp_pool __percpu *ddp_pool;\n-\tstruct i40e_fcoe_ddp ddp[I40E_FCOE_DDP_MAX];\n-};\n-\n-#endif /* _I40E_FCOE_H_ */\n", "prefixes": [] }