Hi Steve.
On Sat, Sep 15, 2007 at 10:56:46AM -0500, Steve Wise (swise@xxxxxxxxxxxxxxxxxxxxx) wrote:This is a real device. I don't understand your question? Packets aren't being stolen.The iWARP driver must translate all listens on address 0.0.0.0 to theIf the only solutions to solve a problem with hardware are to steal
set of rdma-only ip addresses for the device in question. This prevents
incoming connect requests to the TCP ipaddresses from going up the
rdma stack.
packets or became a real device, then real device is much more
appropriate. Is that correct?
I meant port from main network stack. Sorry for confusion.
No, insert_ifa() allocates a struct iwch_addrlist, which has 2 fields: a list_head for linking, and a struct in_ifaddr pointer.+static void insert_ifa(struct iwch_dev *rnicp, struct in_ifaddr *ifa)As a small nitpick: this wants to be sizeof(struct in_ifaddr)
+{
+ struct iwch_addrlist *addr;
+
+ addr = kmalloc(sizeof *addr, GFP_KERNEL);
sizeof(struct iwch_addrlist) of course, not (*addr).
To simplify grep.
There are two causes where this is called: 1) during module init to populate the list of iwarp addresses. If we failed in that case then, I _could_ then not register. 2) we get called via the notifier mechanism when an address is added. If that fails, the caller doesn't care (since we're on the notifier callout thread). But the code could perhaps unregister the device. I prefer just logging an error in case 2. I'll look into not registering if we cannot get any address due to lack of memory. But there's another case: we load the module and the admin hasn't yet created the ethX:iw interface.+ if (!addr) {What about providing error back to caller and fail to register?
+ printk(KERN_ERR MOD "%s - failed to alloc memory!\n",
+ __FUNCTION__);
+ return;
+ }
+ addr->ifa = ifa;
+ mutex_lock(&rnicp->mutex);
+ list_add_tail(&addr->entry, &rnicp->addrlist);
+ mutex_unlock(&rnicp->mutex);
+}
Perhaps I should change the code to only register as a working rdma device _when_ we get at least one ethX:iwY interface created? Whatchathink?
Does second case ends up with problem you described in the initial
e-mail not being fixed?
It is kinda crappy. But I don't see a better solution. Any ideas?+static inline int is_iwarp_label(char *label)I.e. it is not allowed to create ':iw' alias for anyone else?
+{
+ char *colon;
+
+ colon = strchr(label, ':');
+ if (colon && !strncmp(colon+1, "iw", 2))
+ return 1;
+ return 0;
+}
Well, looks crappy, but if it is the only solution...
Does creating the whole new netdevice is a too big overhead, or is it
considered bad idea?
Do you mean I shouldn't use sizeof *le, but rather sizeof(struct iwch_listen_entry)? Is that the preferred coding style?+static struct iwch_listen_entry *alloc_listener(struct iwch_listen_ep *ep,Do you know, that cxgb3 function names suck? :)
+ __be32 addr)
Especially get_skb().
+{Wants to be sizeof(struct iwch_listen_entry) and in other places too.
+ struct iwch_dev *h = to_iwch_dev(ep->com.cm_id->device);
+ struct iwch_listen_entry *le;
+
+ le = kmalloc(sizeof *le, GFP_KERNEL);
Yes, exactly.