aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx4/port.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 13:33:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 13:33:42 -0400
commit0c2fe82a9b106f1c03719783134360586d718a69 (patch)
treeec1a18ca49f1e6724ef3a93727f5f73b7df61931 /drivers/net/ethernet/mellanox/mlx4/port.c
parent5f0e685f316a1de6d3af8b23eaf46651faca32ab (diff)
parentf0e88aeb19dac00ed2e09fd4d39ee65f32d5e968 (diff)
Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull InfiniBand/RDMA changes for the 3.4 merge window from Roland Dreier: "Nothing big really stands out; by patch count lots of fixes to the mlx4 driver plus some cleanups and fixes to the core and other drivers." * tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (28 commits) mlx4_core: Scale size of MTT table with system RAM mlx4_core: Allow dynamic MTU configuration for IB ports IB/mlx4: Fix info returned when querying IBoE ports IB/mlx4: Fix possible missed completion event mlx4_core: Report thermal error events mlx4_core: Fix one more static exported function IB: Change CQE "csum_ok" field to a bit flag RDMA/iwcm: Reject connect requests if cmid is not in LISTEN state RDMA/cxgb3: Don't pass irq flags to flush_qp() mlx4_core: Get rid of redundant ext_port_cap flags RDMA/ucma: Fix AB-BA deadlock IB/ehca: Fix ilog2() compile failure IB: Use central enum for speed instead of hard-coded values IB/iser: Post initial receive buffers before sending the final login request IB/iser: Free IB connection resources in the proper place IB/srp: Consolidate repetitive sysfs code IB/srp: Use pr_fmt() and pr_err()/pr_warn() IB/core: Fix SDR rates in sysfs mlx4: Enforce device max FMR maps in FMR alloc IB/mlx4: Set bad_wr for invalid send opcode ...
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/port.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/port.c68
1 files changed, 22 insertions, 46 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c
index 98e776261ead..77535ff18f1b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/port.c
+++ b/drivers/net/ethernet/mellanox/mlx4/port.c
@@ -590,49 +590,6 @@ int mlx4_get_port_ib_caps(struct mlx4_dev *dev, u8 port, __be32 *caps)
590 return err; 590 return err;
591} 591}
592 592
593int mlx4_check_ext_port_caps(struct mlx4_dev *dev, u8 port)
594{
595 struct mlx4_cmd_mailbox *inmailbox, *outmailbox;
596 u8 *inbuf, *outbuf;
597 int err, packet_error;
598
599 inmailbox = mlx4_alloc_cmd_mailbox(dev);
600 if (IS_ERR(inmailbox))
601 return PTR_ERR(inmailbox);
602
603 outmailbox = mlx4_alloc_cmd_mailbox(dev);
604 if (IS_ERR(outmailbox)) {
605 mlx4_free_cmd_mailbox(dev, inmailbox);
606 return PTR_ERR(outmailbox);
607 }
608
609 inbuf = inmailbox->buf;
610 outbuf = outmailbox->buf;
611 memset(inbuf, 0, 256);
612 memset(outbuf, 0, 256);
613 inbuf[0] = 1;
614 inbuf[1] = 1;
615 inbuf[2] = 1;
616 inbuf[3] = 1;
617
618 *(__be16 *) (&inbuf[16]) = MLX4_ATTR_EXTENDED_PORT_INFO;
619 *(__be32 *) (&inbuf[20]) = cpu_to_be32(port);
620
621 err = mlx4_cmd_box(dev, inmailbox->dma, outmailbox->dma, port, 3,
622 MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C,
623 MLX4_CMD_NATIVE);
624
625 packet_error = be16_to_cpu(*(__be16 *) (outbuf + 4));
626
627 dev->caps.ext_port_cap[port] = (!err && !packet_error) ?
628 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO
629 : 0;
630
631 mlx4_free_cmd_mailbox(dev, inmailbox);
632 mlx4_free_cmd_mailbox(dev, outmailbox);
633 return err;
634}
635
636static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod, 593static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod,
637 u8 op_mod, struct mlx4_cmd_mailbox *inbox) 594 u8 op_mod, struct mlx4_cmd_mailbox *inbox)
638{ 595{
@@ -766,10 +723,18 @@ int mlx4_SET_PORT_wrapper(struct mlx4_dev *dev, int slave,
766 vhcr->op_modifier, inbox); 723 vhcr->op_modifier, inbox);
767} 724}
768 725
726/* bit locations for set port command with zero op modifier */
727enum {
728 MLX4_SET_PORT_VL_CAP = 4, /* bits 7:4 */
729 MLX4_SET_PORT_MTU_CAP = 12, /* bits 15:12 */
730 MLX4_CHANGE_PORT_VL_CAP = 21,
731 MLX4_CHANGE_PORT_MTU_CAP = 22,
732};
733
769int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port) 734int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)
770{ 735{
771 struct mlx4_cmd_mailbox *mailbox; 736 struct mlx4_cmd_mailbox *mailbox;
772 int err; 737 int err, vl_cap;
773 738
774 if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH) 739 if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
775 return 0; 740 return 0;
@@ -781,8 +746,19 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)
781 memset(mailbox->buf, 0, 256); 746 memset(mailbox->buf, 0, 256);
782 747
783 ((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port]; 748 ((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port];
784 err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT, 749
785 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); 750 /* IB VL CAP enum isn't used by the firmware, just numerical values */
751 for (vl_cap = 8; vl_cap >= 1; vl_cap >>= 1) {
752 ((__be32 *) mailbox->buf)[0] = cpu_to_be32(
753 (1 << MLX4_CHANGE_PORT_MTU_CAP) |
754 (1 << MLX4_CHANGE_PORT_VL_CAP) |
755 (dev->caps.port_ib_mtu[port] << MLX4_SET_PORT_MTU_CAP) |
756 (vl_cap << MLX4_SET_PORT_VL_CAP));
757 err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT,
758 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED);
759 if (err != -ENOMEM)
760 break;
761 }
786 762
787 mlx4_free_cmd_mailbox(dev, mailbox); 763 mlx4_free_cmd_mailbox(dev, mailbox);
788 return err; 764 return err;