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

Commit e112373f authored by Eli Cohen's avatar Eli Cohen Committed by Roland Dreier
Browse files

IPoIB/cm: Reduce connected mode TX object size



Since IPoIB connected mode does not NETIF_F_SG, we only have one DMA
mapping per send, so we don't need a mapping[] array.  Define a new
struct with a single u64 mapping member and use it for the CM tx_ring.

Signed-off-by: default avatarEli Cohen <eli@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent df866619
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -157,6 +157,11 @@ struct ipoib_tx_buf {
	u64		mapping[MAX_SKB_FRAGS + 1];
	u64		mapping[MAX_SKB_FRAGS + 1];
};
};


struct ipoib_cm_tx_buf {
	struct sk_buff *skb;
	u64		mapping;
};

struct ib_cm_id;
struct ib_cm_id;


struct ipoib_cm_data {
struct ipoib_cm_data {
@@ -215,7 +220,7 @@ struct ipoib_cm_tx {
	struct net_device   *dev;
	struct net_device   *dev;
	struct ipoib_neigh  *neigh;
	struct ipoib_neigh  *neigh;
	struct ipoib_path   *path;
	struct ipoib_path   *path;
	struct ipoib_tx_buf *tx_ring;
	struct ipoib_cm_tx_buf *tx_ring;
	unsigned	     tx_head;
	unsigned	     tx_head;
	unsigned	     tx_tail;
	unsigned	     tx_tail;
	unsigned long	     flags;
	unsigned long	     flags;
+6 −6
Original line number Original line Diff line number Diff line
@@ -703,7 +703,7 @@ static inline int post_send(struct ipoib_dev_priv *priv,
void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx)
void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx)
{
{
	struct ipoib_dev_priv *priv = netdev_priv(dev);
	struct ipoib_dev_priv *priv = netdev_priv(dev);
	struct ipoib_tx_buf *tx_req;
	struct ipoib_cm_tx_buf *tx_req;
	u64 addr;
	u64 addr;


	if (unlikely(skb->len > tx->mtu)) {
	if (unlikely(skb->len > tx->mtu)) {
@@ -734,7 +734,7 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
		return;
		return;
	}
	}


	tx_req->mapping[0] = addr;
	tx_req->mapping = addr;


	if (unlikely(post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1),
	if (unlikely(post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1),
			       addr, skb->len))) {
			       addr, skb->len))) {
@@ -759,7 +759,7 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
	struct ipoib_dev_priv *priv = netdev_priv(dev);
	struct ipoib_dev_priv *priv = netdev_priv(dev);
	struct ipoib_cm_tx *tx = wc->qp->qp_context;
	struct ipoib_cm_tx *tx = wc->qp->qp_context;
	unsigned int wr_id = wc->wr_id & ~IPOIB_OP_CM;
	unsigned int wr_id = wc->wr_id & ~IPOIB_OP_CM;
	struct ipoib_tx_buf *tx_req;
	struct ipoib_cm_tx_buf *tx_req;
	unsigned long flags;
	unsigned long flags;


	ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n",
	ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n",
@@ -773,7 +773,7 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)


	tx_req = &tx->tx_ring[wr_id];
	tx_req = &tx->tx_ring[wr_id];


	ib_dma_unmap_single(priv->ca, tx_req->mapping[0], tx_req->skb->len, DMA_TO_DEVICE);
	ib_dma_unmap_single(priv->ca, tx_req->mapping, tx_req->skb->len, DMA_TO_DEVICE);


	/* FIXME: is this right? Shouldn't we only increment on success? */
	/* FIXME: is this right? Shouldn't we only increment on success? */
	++dev->stats.tx_packets;
	++dev->stats.tx_packets;
@@ -1143,7 +1143,7 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
{
{
	struct ipoib_dev_priv *priv = netdev_priv(p->dev);
	struct ipoib_dev_priv *priv = netdev_priv(p->dev);
	struct ipoib_tx_buf *tx_req;
	struct ipoib_cm_tx_buf *tx_req;
	unsigned long flags;
	unsigned long flags;
	unsigned long begin;
	unsigned long begin;


@@ -1171,7 +1171,7 @@ static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)


	while ((int) p->tx_tail - (int) p->tx_head < 0) {
	while ((int) p->tx_tail - (int) p->tx_head < 0) {
		tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)];
		tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)];
		ib_dma_unmap_single(priv->ca, tx_req->mapping[0], tx_req->skb->len,
		ib_dma_unmap_single(priv->ca, tx_req->mapping, tx_req->skb->len,
				    DMA_TO_DEVICE);
				    DMA_TO_DEVICE);
		dev_kfree_skb_any(tx_req->skb);
		dev_kfree_skb_any(tx_req->skb);
		++p->tx_tail;
		++p->tx_tail;