get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/34914/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 34914,
    "url": "http://patches.dpdk.org/api/patches/34914/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/84aaf0feed10355bb4cb47cfa0044d378ea1950b.1517685185.git.rahul.lakkireddy@chelsio.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<84aaf0feed10355bb4cb47cfa0044d378ea1950b.1517685185.git.rahul.lakkireddy@chelsio.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/84aaf0feed10355bb4cb47cfa0044d378ea1950b.1517685185.git.rahul.lakkireddy@chelsio.com",
    "date": "2018-02-04T06:06:10",
    "name": "[dpdk-dev,5/7] cxgbe: update link Forward Error Correction (FEC)",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "efb211dcb93f03cd7d8fe1b8dced3c4ac0ae217e",
    "submitter": {
        "id": 241,
        "url": "http://patches.dpdk.org/api/people/241/?format=api",
        "name": "Rahul Lakkireddy",
        "email": "rahul.lakkireddy@chelsio.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/84aaf0feed10355bb4cb47cfa0044d378ea1950b.1517685185.git.rahul.lakkireddy@chelsio.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/34914/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/34914/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 699C8199B6;\n\tSun,  4 Feb 2018 07:06:51 +0100 (CET)",
            "from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8])\n\tby dpdk.org (Postfix) with ESMTP id 14A46A495\n\tfor <dev@dpdk.org>; Sun,  4 Feb 2018 07:06:48 +0100 (CET)",
            "from localhost (scalar.blr.asicdesigners.com [10.193.185.94])\n\tby stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w1466jgl030189; \n\tSat, 3 Feb 2018 22:06:45 -0800"
        ],
        "From": "Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>",
        "To": "dev@dpdk.org",
        "Cc": "kumaras@chelsio.com, surendra@chelsio.com, nirranjan@chelsio.com,\n\tindranil@chelsio.com",
        "Date": "Sun,  4 Feb 2018 11:36:10 +0530",
        "Message-Id": "<84aaf0feed10355bb4cb47cfa0044d378ea1950b.1517685185.git.rahul.lakkireddy@chelsio.com>",
        "X-Mailer": "git-send-email 2.5.3",
        "In-Reply-To": [
            "<cover.1517685185.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1517685185.git.rahul.lakkireddy@chelsio.com>"
        ],
        "References": [
            "<cover.1517685185.git.rahul.lakkireddy@chelsio.com>",
            "<cover.1517685185.git.rahul.lakkireddy@chelsio.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 5/7] cxgbe: update link Forward Error Correction\n\t(FEC)",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Kumar Sanghvi <kumaras@chelsio.com>\n\nNormally, firmware reads various Forward Error Correction parameters\nfrom a Transceiver Module i2c EPROM and uses a couple of IEEE Standards\n(802.3bj for 100Gb/s and 802.3by for 25Gb/s) to interpret those\nparameters and come up with supported and default FEC settings.\nFirmware then sends these FEC parameters to the Host Driver which gives\nthe Host Administrator an opportunity to change them if necessary in\norder to establish a Link with a Switch which may have made a\nnon-standard FEC decision.\n\nThis commit recognizes \"auto\" as a discrete FEC mode which can be\nused to explicitly select the IEEE 802.3 standard based FEC selection.\n\nOriginal work by Surendra Mobiya <surendra@chelsio.com>\n\nSigned-off-by: Kumar Sanghvi <kumaras@chelsio.com>\nSigned-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>\n---\n drivers/net/cxgbe/base/common.h |  13 +++--\n drivers/net/cxgbe/base/t4_hw.c  | 123 ++++++++++++++++++++++++++++------------\n 2 files changed, 94 insertions(+), 42 deletions(-)",
    "diff": "diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h\nindex dd282a933..0bd78c1b0 100644\n--- a/drivers/net/cxgbe/base/common.h\n+++ b/drivers/net/cxgbe/base/common.h\n@@ -69,9 +69,9 @@ enum {\n };\n \n enum {\n-\tFEC_RS        = 1 << 0,\n-\tFEC_BASER_RS  = 1 << 1,\n-\tFEC_RESERVED  = 1 << 2,\n+\tFEC_AUTO     = 1 << 0,    /* IEEE 802.3 \"automatic\" */\n+\tFEC_RS       = 1 << 1,    /* Reed-Solomon */\n+\tFEC_BASER_RS = 1 << 2,    /* BaseR/Reed-Solomon */\n };\n \n struct port_stats {\n@@ -248,8 +248,11 @@ struct link_config {\n \tunsigned int   speed;            /* actual link speed */\n \tunsigned char  requested_fc;     /* flow control user has requested */\n \tunsigned char  fc;               /* actual link flow control */\n-\tunsigned char  requested_fec;    /* Forward Error Correction user */\n-\tunsigned char  fec;              /* has requested and actual FEC */\n+\tunsigned char  auto_fec;         /* Forward Error Correction (FEC)\n+\t\t\t\t\t  * \"automatic\" (IEEE 802.3)\n+\t\t\t\t\t  */\n+\tunsigned char  requested_fec;    /* FEC requested */\n+\tunsigned char  fec;              /* FEC actual */\n \tunsigned char  autoneg;          /* autonegotiating? */\n \tunsigned char  link_ok;          /* link up? */\n };\ndiff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c\nindex 2d7214622..e8545ceb0 100644\n--- a/drivers/net/cxgbe/base/t4_hw.c\n+++ b/drivers/net/cxgbe/base/t4_hw.c\n@@ -2792,6 +2792,58 @@ void t4_dump_version_info(struct adapter *adapter)\n #define ADVERT_MASK (V_FW_PORT_CAP_SPEED(M_FW_PORT_CAP_SPEED) | \\\n \t\t     FW_PORT_CAP_ANEG)\n \n+/* Translate Firmware Pause specification to Common Code */\n+static inline unsigned int fwcap_to_cc_pause(unsigned int fw_pause)\n+{\n+\tunsigned int cc_pause = 0;\n+\n+\tif (fw_pause & F_FW_PORT_CMD_RXPAUSE)\n+\t\tcc_pause |= PAUSE_RX;\n+\tif (fw_pause & F_FW_PORT_CMD_TXPAUSE)\n+\t\tcc_pause |= PAUSE_TX;\n+\n+\treturn cc_pause;\n+}\n+\n+/* Translate Common Code Pause Frame specification into Firmware */\n+static inline unsigned int cc_to_fwcap_pause(unsigned int cc_pause)\n+{\n+\tunsigned int fw_pause = 0;\n+\n+\tif (cc_pause & PAUSE_RX)\n+\t\tfw_pause |= F_FW_PORT_CMD_RXPAUSE;\n+\tif (cc_pause & PAUSE_TX)\n+\t\tfw_pause |= F_FW_PORT_CMD_TXPAUSE;\n+\n+\treturn fw_pause;\n+}\n+\n+/* Translate Firmware Forward Error Correction specification to Common Code */\n+static inline unsigned int fwcap_to_cc_fec(unsigned int fw_fec)\n+{\n+\tunsigned int cc_fec = 0;\n+\n+\tif (fw_fec & FW_PORT_CAP_FEC_RS)\n+\t\tcc_fec |= FEC_RS;\n+\tif (fw_fec & FW_PORT_CAP_FEC_BASER_RS)\n+\t\tcc_fec |= FEC_BASER_RS;\n+\n+\treturn cc_fec;\n+}\n+\n+/* Translate Common Code Forward Error Correction specification to Firmware */\n+static inline unsigned int cc_to_fwcap_fec(unsigned int cc_fec)\n+{\n+\tunsigned int fw_fec = 0;\n+\n+\tif (cc_fec & FEC_RS)\n+\t\tfw_fec |= FW_PORT_CAP_FEC_RS;\n+\tif (cc_fec & FEC_BASER_RS)\n+\t\tfw_fec |= FW_PORT_CAP_FEC_BASER_RS;\n+\n+\treturn fw_fec;\n+}\n+\n /**\n  * t4_link_l1cfg - apply link configuration to MAC/PHY\n  * @phy: the PHY to setup\n@@ -2809,23 +2861,25 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port,\n \t\t  struct link_config *lc)\n {\n \tstruct fw_port_cmd c;\n-\tunsigned int mdi = V_FW_PORT_CAP_MDI(FW_PORT_CAP_MDI_AUTO);\n-\tunsigned int fc, fec;\n+\tunsigned int fw_mdi = V_FW_PORT_CAP_MDI(FW_PORT_CAP_MDI_AUTO);\n+\tunsigned int fw_fc, cc_fec, fw_fec;\n \n \tlc->link_ok = 0;\n-\tfc = 0;\n-\tif (lc->requested_fc & PAUSE_RX)\n-\t\tfc |= FW_PORT_CAP_FC_RX;\n-\tif (lc->requested_fc & PAUSE_TX)\n-\t\tfc |= FW_PORT_CAP_FC_TX;\n-\n-\tfec = 0;\n-\tif (lc->requested_fec & FEC_RS)\n-\t\tfec |= FW_PORT_CAP_FEC_RS;\n-\tif (lc->requested_fec & FEC_BASER_RS)\n-\t\tfec |= FW_PORT_CAP_FEC_BASER_RS;\n-\tif (lc->requested_fec & FEC_RESERVED)\n-\t\tfec |= FW_PORT_CAP_FEC_RESERVED;\n+\n+\tfw_fc = cc_to_fwcap_pause(lc->requested_fc);\n+\n+\t/* Convert Common Code Forward Error Control settings into the\n+\t * Firmware's API.  If the current Requested FEC has \"Automatic\"\n+\t * (IEEE 802.3) specified, then we use whatever the Firmware\n+\t * sent us as part of it's IEEE 802.3-based interpratation of\n+\t * the Transceiver Module EPROM FEC parameters.  Otherwise we\n+\t * use whatever is in the current Requested FEC settings.\n+\t */\n+\tif (lc->requested_fec & FEC_AUTO)\n+\t\tcc_fec = lc->auto_fec;\n+\telse\n+\t\tcc_fec = lc->requested_fec;\n+\tfw_fec = cc_to_fwcap_fec(cc_fec);\n \n \tmemset(&c, 0, sizeof(c));\n \tc.op_to_portid = cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) |\n@@ -2837,16 +2891,17 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port,\n \n \tif (!(lc->supported & FW_PORT_CAP_ANEG)) {\n \t\tc.u.l1cfg.rcap = cpu_to_be32((lc->supported & ADVERT_MASK) |\n-\t\t\t\t\t     fc | fec);\n+\t\t\t\t\t     fw_fc | fw_fec);\n \t\tlc->fc = lc->requested_fc & ~PAUSE_AUTONEG;\n-\t\tlc->fec = lc->requested_fec;\n+\t\tlc->fec = cc_fec;\n \t} else if (lc->autoneg == AUTONEG_DISABLE) {\n-\t\tc.u.l1cfg.rcap = cpu_to_be32(lc->requested_speed | fc |\n-\t\t\t\t\t     fec | mdi);\n+\t\tc.u.l1cfg.rcap = cpu_to_be32(lc->requested_speed | fw_fc |\n+\t\t\t\t\t     fw_fec | fw_mdi);\n \t\tlc->fc = lc->requested_fc & ~PAUSE_AUTONEG;\n-\t\tlc->fec = lc->requested_fec;\n+\t\tlc->fec = cc_fec;\n \t} else {\n-\t\tc.u.l1cfg.rcap = cpu_to_be32(lc->advertising | fc | fec | mdi);\n+\t\tc.u.l1cfg.rcap = cpu_to_be32(lc->advertising | fw_fc | fw_fec |\n+\t\t\t\t\t     fw_mdi);\n \t}\n \n \treturn t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);\n@@ -4212,11 +4267,11 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl)\n \t\tu32 stat = be32_to_cpu(p->u.info.lstatus_to_modtype);\n \t\tint link_ok = (stat & F_FW_PORT_CMD_LSTATUS) != 0;\n \t\tu32 mod = G_FW_PORT_CMD_MODTYPE(stat);\n+\t\tunsigned int fec;\n+\n+\t\tfc = fwcap_to_cc_pause(stat);\n+\t\tfec = fwcap_to_cc_fec(stat);\n \n-\t\tif (stat & F_FW_PORT_CMD_RXPAUSE)\n-\t\t\tfc |= PAUSE_RX;\n-\t\tif (stat & F_FW_PORT_CMD_TXPAUSE)\n-\t\t\tfc |= PAUSE_TX;\n \t\tif (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100M))\n \t\t\tspeed = ETH_SPEED_NUM_100M;\n \t\telse if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_1G))\n@@ -4238,11 +4293,12 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl)\n \t\tlc = &pi->link_cfg;\n \n \t\tif (mod != pi->mod_type) {\n+\t\t\tlc->auto_fec = fec;\n \t\t\tpi->mod_type = mod;\n \t\t\tt4_os_portmod_changed(adap, i);\n \t\t}\n \t\tif (link_ok != lc->link_ok || speed != lc->speed ||\n-\t\t    fc != lc->fc) {                    /* something changed */\n+\t\t    fc != lc->fc || fec != lc->fec) { /* something changed */\n \t\t\tif (!link_ok && lc->link_ok) {\n \t\t\t\tstatic const char * const reason[] = {\n \t\t\t\t\t\"Link Down\",\n@@ -4262,6 +4318,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl)\n \t\t\tlc->link_ok = link_ok;\n \t\t\tlc->speed = speed;\n \t\t\tlc->fc = fc;\n+\t\t\tlc->fec = fec;\n \t\t\tlc->supported = be16_to_cpu(p->u.info.pcap);\n \t\t}\n \t} else {\n@@ -4295,8 +4352,6 @@ void t4_reset_link_config(struct adapter *adap, int idx)\n static void init_link_config(struct link_config *lc, unsigned int pcaps,\n \t\t\t     unsigned int acaps)\n {\n-\tunsigned int fec;\n-\n \tlc->supported = pcaps;\n \tlc->requested_speed = 0;\n \tlc->speed = 0;\n@@ -4307,15 +4362,9 @@ static void init_link_config(struct link_config *lc, unsigned int pcaps,\n \t * For Forward Error Control, we default to whatever the Firmware\n \t * tells us the Link is currently advertising.\n \t */\n-\tfec = 0;\n-\tif (acaps & FW_PORT_CAP_FEC_RS)\n-\t\tfec |= FEC_RS;\n-\tif (acaps & FW_PORT_CAP_FEC_BASER_RS)\n-\t\tfec |= FEC_BASER_RS;\n-\tif (acaps & FW_PORT_CAP_FEC_RESERVED)\n-\t\tfec |= FEC_RESERVED;\n-\tlc->requested_fec = fec;\n-\tlc->fec = fec;\n+\tlc->auto_fec = fwcap_to_cc_fec(acaps);\n+\tlc->requested_fec = FEC_AUTO;\n+\tlc->fec = lc->auto_fec;\n \n \tif (lc->supported & FW_PORT_CAP_ANEG) {\n \t\tlc->advertising = lc->supported & ADVERT_MASK;\n",
    "prefixes": [
        "dpdk-dev",
        "5/7"
    ]
}