[ewg] RE: [ofa-general] OFED 1.3 beta status on kernel 2.6.24 rebase
Eli Cohen
eli at dev.mellanox.co.il
Wed Nov 14 08:29:43 PST 2007
On Wed, 2007-11-14 at 10:23 +0200, Moni Levy wrote:
> I guess that the one Tziporet is talking about is:
>
> "IPoIB: Use shinfo->gso_size to indicate tcp mss instead of using link MTU"
>
> Tziporet, am I right ?
>
No this is not the critical bug we're Tziporet was referring to. The one
she was referring to was a backport patch for ipoib from kernel 2.6.24
to older kernels. The previous version of the backport did not return a
correct return value from the poll function. Here is the new backport
for 2.6.23:
Backport IPOIB to kernel 2.6.23
Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
Index: ofed_kernel-2.6.23/drivers/infiniband/ulp/ipoib/ipoib.h
===================================================================
--- ofed_kernel-2.6.23.orig/drivers/infiniband/ulp/ipoib/ipoib.h 2007-11-13 11:56:43.000000000 +0200
+++ ofed_kernel-2.6.23/drivers/infiniband/ulp/ipoib/ipoib.h 2007-11-13 11:56:48.000000000 +0200
@@ -324,8 +324,6 @@ struct ipoib_dev_priv {
struct net_device *dev;
- struct napi_struct napi;
-
unsigned long flags;
struct mutex mcast_mutex;
@@ -451,7 +449,7 @@ extern struct workqueue_struct *ipoib_wo
/* functions */
-int ipoib_poll(struct napi_struct *napi, int budget);
+int ipoib_poll(struct net_device *dev, int *budget);
void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr);
struct ipoib_ah *ipoib_create_ah(struct net_device *dev,
Index: ofed_kernel-2.6.23/drivers/infiniband/ulp/ipoib/ipoib_ib.c
===================================================================
--- ofed_kernel-2.6.23.orig/drivers/infiniband/ulp/ipoib/ipoib_ib.c 2007-11-13 11:56:43.000000000 +0200
+++ ofed_kernel-2.6.23/drivers/infiniband/ulp/ipoib/ipoib_ib.c 2007-11-13 12:02:29.000000000 +0200
@@ -295,20 +295,19 @@ static void ipoib_ib_handle_tx_wc(struct
wc->status, wr_id, wc->vendor_err);
}
-int ipoib_poll(struct napi_struct *napi, int budget)
+int ipoib_poll(struct net_device *dev, int *budget)
{
- struct ipoib_dev_priv *priv = container_of(napi, struct ipoib_dev_priv, napi);
- struct net_device *dev = priv->dev;
+ struct ipoib_dev_priv *priv = netdev_priv(dev);
+ int max = min(*budget, dev->quota);
int done;
int t;
int n, i;
+ int ret;
done = 0;
poll_more:
- while (done < budget) {
- int max = (budget - done);
-
+ while (max) {
t = min(IPOIB_NUM_WC, max);
n = ib_poll_cq(priv->cq, t, priv->ibwc);
@@ -317,6 +316,7 @@ poll_more:
if (wc->wr_id & IPOIB_OP_RECV) {
++done;
+ --max;
if (wc->wr_id & IPOIB_OP_CM)
ipoib_cm_handle_rx_wc(dev, wc);
else
@@ -333,24 +333,26 @@ poll_more:
break;
}
- if (done < budget) {
- netif_rx_complete(dev, napi);
+ if (max) {
+ netif_rx_complete(dev);
if (unlikely(ib_req_notify_cq(priv->cq,
IB_CQ_NEXT_COMP |
IB_CQ_REPORT_MISSED_EVENTS)) &&
- netif_rx_reschedule(dev, napi))
+ netif_rx_reschedule(dev, 0))
goto poll_more;
- }
+ ret = 0;
+ } else
+ ret = 1;
+
+ dev->quota -= done;
+ *budget -= done;
- return done;
+ return ret;
}
void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr)
{
- struct net_device *dev = dev_ptr;
- struct ipoib_dev_priv *priv = netdev_priv(dev);
-
- netif_rx_schedule(dev, &priv->napi);
+ netif_rx_schedule(dev_ptr);
}
static inline int post_send(struct ipoib_dev_priv *priv,
Index: ofed_kernel-2.6.23/drivers/infiniband/ulp/ipoib/ipoib_main.c
===================================================================
--- ofed_kernel-2.6.23.orig/drivers/infiniband/ulp/ipoib/ipoib_main.c 2007-11-13 11:56:43.000000000 +0200
+++ ofed_kernel-2.6.23/drivers/infiniband/ulp/ipoib/ipoib_main.c 2007-11-13 11:56:48.000000000 +0200
@@ -101,20 +101,16 @@ int ipoib_open(struct net_device *dev)
ipoib_dbg(priv, "bringing up interface\n");
- napi_enable(&priv->napi);
set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
if (ipoib_pkey_dev_delay_open(dev))
return 0;
- if (ipoib_ib_dev_open(dev)) {
- napi_disable(&priv->napi);
+ if (ipoib_ib_dev_open(dev))
return -EINVAL;
- }
if (ipoib_ib_dev_up(dev)) {
ipoib_ib_dev_stop(dev, 1);
- napi_disable(&priv->napi);
return -EINVAL;
}
@@ -147,7 +143,6 @@ static int ipoib_stop(struct net_device
ipoib_dbg(priv, "stopping interface\n");
clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
- napi_disable(&priv->napi);
netif_stop_queue(dev);
@@ -805,7 +800,7 @@ static void ipoib_timeout(struct net_dev
static int ipoib_hard_header(struct sk_buff *skb,
struct net_device *dev,
unsigned short type,
- const void *daddr, const void *saddr, unsigned len)
+ void *daddr, void *saddr, unsigned len)
{
struct ipoib_header *header;
struct ipoib_dev_priv *priv = netdev_priv(dev);
@@ -980,10 +975,6 @@ void ipoib_dev_cleanup(struct net_device
priv->tx_ring = NULL;
}
-static const struct header_ops ipoib_header_ops = {
- .create = ipoib_hard_header,
-};
-
static void ipoib_setup(struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
@@ -993,13 +984,13 @@ static void ipoib_setup(struct net_devic
dev->change_mtu = ipoib_change_mtu;
dev->hard_start_xmit = ipoib_start_xmit;
dev->tx_timeout = ipoib_timeout;
- dev->header_ops = &ipoib_header_ops;
+ dev->hard_header = ipoib_hard_header;
dev->set_multicast_list = ipoib_set_mcast_list;
dev->neigh_setup = ipoib_neigh_setup_dev;
-
ipoib_set_ethtool_ops(dev);
+ dev->poll = ipoib_poll;
+ dev->weight = 100;
- netif_napi_add(dev, &priv->napi, ipoib_poll, 100);
dev->watchdog_timeo = HZ;
More information about the general
mailing list