Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[cascardo/linux.git] / drivers / net / ethernet / chelsio / cxgb4 / t4_hw.c
index 2a476cc..20dec85 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the Chelsio T4 Ethernet driver for Linux.
  *
- * Copyright (c) 2003-2014 Chelsio Communications, Inc. All rights reserved.
+ * Copyright (c) 2003-2016 Chelsio Communications, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -2729,7 +2729,7 @@ int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p)
 
 out:
        vfree(vpd);
-       return ret;
+       return ret < 0 ? ret : 0;
 }
 
 /**
@@ -3627,7 +3627,8 @@ void t4_ulprx_read_la(struct adapter *adap, u32 *la_buf)
 }
 
 #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\
-                    FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \
+                    FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_25G | \
+                    FW_PORT_CAP_SPEED_40G | FW_PORT_CAP_SPEED_100G | \
                     FW_PORT_CAP_ANEG)
 
 /**
@@ -7196,8 +7197,12 @@ void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl)
                speed = 1000;
        else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G))
                speed = 10000;
+       else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_25G))
+               speed = 25000;
        else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G))
                speed = 40000;
+       else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100G))
+               speed = 100000;
 
        lc = &pi->link_cfg;
 
@@ -8305,3 +8310,32 @@ int t4_set_vf_mac_acl(struct adapter *adapter, unsigned int vf,
 
        return t4_wr_mbox(adapter, adapter->mbox, &cmd, sizeof(cmd), &cmd);
 }
+
+int t4_sched_params(struct adapter *adapter, int type, int level, int mode,
+                   int rateunit, int ratemode, int channel, int class,
+                   int minrate, int maxrate, int weight, int pktsize)
+{
+       struct fw_sched_cmd cmd;
+
+       memset(&cmd, 0, sizeof(cmd));
+       cmd.op_to_write = cpu_to_be32(FW_CMD_OP_V(FW_SCHED_CMD) |
+                                     FW_CMD_REQUEST_F |
+                                     FW_CMD_WRITE_F);
+       cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd));
+
+       cmd.u.params.sc = FW_SCHED_SC_PARAMS;
+       cmd.u.params.type = type;
+       cmd.u.params.level = level;
+       cmd.u.params.mode = mode;
+       cmd.u.params.ch = channel;
+       cmd.u.params.cl = class;
+       cmd.u.params.unit = rateunit;
+       cmd.u.params.rate = ratemode;
+       cmd.u.params.min = cpu_to_be32(minrate);
+       cmd.u.params.max = cpu_to_be32(maxrate);
+       cmd.u.params.weight = cpu_to_be16(weight);
+       cmd.u.params.pktsize = cpu_to_be16(pktsize);
+
+       return t4_wr_mbox_meat(adapter, adapter->mbox, &cmd, sizeof(cmd),
+                              NULL, 1);
+}