Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 839f5ac0 authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford
Browse files

IB/rxe: Remove a pointless indirection layer



Neither rxe->ifc_ops nor any of the function pointers in struct
struct rxe_ifc_ops ever change. Hence remove the rxe->ifc_ops
indirection mechanism.

Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Reviewed-by: default avatarAndrew Boyer <andrew.boyer@dell.com>
Cc: Moni Shoua <monis@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent ab176544
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ static int rxe_init_ports(struct rxe_dev *rxe)
		return -ENOMEM;

	port->pkey_tbl[0] = 0xffff;
	port->port_guid = rxe->ifc_ops->port_guid(rxe);
	port->port_guid = rxe_port_guid(rxe);

	spin_lock_init(&port->port_lock);

+18 −2
Original line number Diff line number Diff line
@@ -141,6 +141,22 @@ void rxe_mem_cleanup(struct rxe_pool_entry *arg);

int advance_dma_data(struct rxe_dma_info *dma, unsigned int length);

/* rxe_net.c */
int rxe_loopback(struct sk_buff *skb);
int rxe_send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
	     struct sk_buff *skb);
__be64 rxe_port_guid(struct rxe_dev *rxe);
struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
				int paylen, struct rxe_pkt_info *pkt);
int rxe_prepare(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
		struct sk_buff *skb, u32 *crc);
enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num);
const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
struct device *rxe_dma_device(struct rxe_dev *rxe);
__be64 rxe_node_guid(struct rxe_dev *rxe);
int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
int rxe_mcast_delete(struct rxe_dev *rxe, union ib_gid *mgid);

/* rxe_qp.c */
int rxe_qp_chk_init(struct rxe_dev *rxe, struct ib_qp_init_attr *init);

@@ -257,9 +273,9 @@ static inline int rxe_xmit_packet(struct rxe_dev *rxe, struct rxe_qp *qp,

	if (pkt->mask & RXE_LOOPBACK_MASK) {
		memcpy(SKB_TO_PKT(skb), pkt, sizeof(*pkt));
		err = rxe->ifc_ops->loopback(skb);
		err = rxe_loopback(skb);
	} else {
		err = rxe->ifc_ops->send(rxe, pkt, skb);
		err = rxe_send(rxe, pkt, skb);
	}

	if (err) {
+2 −2
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ int rxe_mcast_get_grp(struct rxe_dev *rxe, union ib_gid *mgid,

	rxe_add_key(grp, mgid);

	err = rxe->ifc_ops->mcast_add(rxe, mgid);
	err = rxe_mcast_add(rxe, mgid);
	if (err)
		goto err2;

@@ -186,5 +186,5 @@ void rxe_mc_cleanup(struct rxe_pool_entry *arg)
	struct rxe_dev *rxe = grp->rxe;

	rxe_drop_key(grp);
	rxe->ifc_ops->mcast_delete(rxe, &grp->mgid);
	rxe_mcast_delete(rxe, &grp->mgid);
}
+13 −30
Original line number Diff line number Diff line
@@ -102,17 +102,17 @@ static __be64 rxe_mac_to_eui64(struct net_device *ndev)
	return eui64;
}

static __be64 node_guid(struct rxe_dev *rxe)
__be64 rxe_node_guid(struct rxe_dev *rxe)
{
	return rxe_mac_to_eui64(rxe->ndev);
}

static __be64 port_guid(struct rxe_dev *rxe)
__be64 rxe_port_guid(struct rxe_dev *rxe)
{
	return rxe_mac_to_eui64(rxe->ndev);
}

static struct device *dma_device(struct rxe_dev *rxe)
struct device *rxe_dma_device(struct rxe_dev *rxe)
{
	struct net_device *ndev;

@@ -124,7 +124,7 @@ static struct device *dma_device(struct rxe_dev *rxe)
	return ndev->dev.parent;
}

static int mcast_add(struct rxe_dev *rxe, union ib_gid *mgid)
int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid)
{
	int err;
	unsigned char ll_addr[ETH_ALEN];
@@ -135,7 +135,7 @@ static int mcast_add(struct rxe_dev *rxe, union ib_gid *mgid)
	return err;
}

static int mcast_delete(struct rxe_dev *rxe, union ib_gid *mgid)
int rxe_mcast_delete(struct rxe_dev *rxe, union ib_gid *mgid)
{
	int err;
	unsigned char ll_addr[ETH_ALEN];
@@ -397,7 +397,7 @@ static int prepare6(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
	return 0;
}

static int prepare(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
int rxe_prepare(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
		struct sk_buff *skb, u32 *crc)
{
	int err = 0;
@@ -424,8 +424,7 @@ static void rxe_skb_tx_dtor(struct sk_buff *skb)
		rxe_run_task(&qp->req.task, 1);
}

static int send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
		struct sk_buff *skb)
int rxe_send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, struct sk_buff *skb)
{
	struct sk_buff *nskb;
	struct rxe_av *av;
@@ -461,7 +460,7 @@ static int send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
	return 0;
}

static int loopback(struct sk_buff *skb)
int rxe_loopback(struct sk_buff *skb)
{
	return rxe_rcv(skb);
}
@@ -471,7 +470,7 @@ static inline int addr_same(struct rxe_dev *rxe, struct rxe_av *av)
	return rxe->port.port_guid == av->grh.dgid.global.interface_id;
}

static struct sk_buff *init_packet(struct rxe_dev *rxe, struct rxe_av *av,
struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
				int paylen, struct rxe_pkt_info *pkt)
{
	unsigned int hdr_len;
@@ -511,31 +510,16 @@ static struct sk_buff *init_packet(struct rxe_dev *rxe, struct rxe_av *av,
 * this is required by rxe_cfg to match rxe devices in
 * /sys/class/infiniband up with their underlying ethernet devices
 */
static char *parent_name(struct rxe_dev *rxe, unsigned int port_num)
const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num)
{
	return rxe->ndev->name;
}

static enum rdma_link_layer link_layer(struct rxe_dev *rxe,
				       unsigned int port_num)
enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num)
{
	return IB_LINK_LAYER_ETHERNET;
}

static struct rxe_ifc_ops ifc_ops = {
	.node_guid	= node_guid,
	.port_guid	= port_guid,
	.dma_device	= dma_device,
	.mcast_add	= mcast_add,
	.mcast_delete	= mcast_delete,
	.prepare	= prepare,
	.send		= send,
	.loopback	= loopback,
	.init_packet	= init_packet,
	.parent_name	= parent_name,
	.link_layer	= link_layer,
};

struct rxe_dev *rxe_net_add(struct net_device *ndev)
{
	int err;
@@ -545,7 +529,6 @@ struct rxe_dev *rxe_net_add(struct net_device *ndev)
	if (!rxe)
		return NULL;

	rxe->ifc_ops = &ifc_ops;
	rxe->ndev = ndev;

	err = rxe_add(rxe, ndev->mtu);
+2 −2
Original line number Diff line number Diff line
@@ -404,7 +404,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp,

	/* init skb */
	av = rxe_get_av(pkt);
	skb = rxe->ifc_ops->init_packet(rxe, av, paylen, pkt);
	skb = rxe_init_packet(rxe, av, paylen, pkt);
	if (unlikely(!skb))
		return NULL;

@@ -475,7 +475,7 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
	u32 *p;
	int err;

	err = rxe->ifc_ops->prepare(rxe, pkt, skb, &crc);
	err = rxe_prepare(rxe, pkt, skb, &crc);
	if (err)
		return err;

Loading