drivers/infiniband/ulp/ipoib/ipoib_multicast.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/ulp/ipoib/ipoib_multicast.c- Extension
.c- Size
- 29606 bytes
- Lines
- 1048
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/skbuff.hlinux/rtnetlink.hlinux/moduleparam.hlinux/ip.hlinux/in.hlinux/igmp.hlinux/inetdevice.hlinux/delay.hlinux/completion.hlinux/slab.hnet/dst.hipoib.h
Detected Declarations
struct ipoib_mcast_iterfunction __ipoib_mcast_schedule_join_threadfunction ipoib_mcast_freefunction __ipoib_mcast_addfunction ipoib_mcast_join_finishfunction ipoib_mcast_carrier_on_taskfunction ipoib_stopfunction ipoib_mcast_join_completefunction ipoib_mcast_joinfunction ipoib_mcast_join_taskfunction ipoib_mcast_start_threadfunction ipoib_mcast_stop_threadfunction ipoib_mcast_leavefunction ipoib_check_and_add_mcast_sendonlyfunction ipoib_mcast_remove_listfunction list_for_each_entry_safefunction ipoib_mcast_sendfunction ipoib_mcast_dev_flushfunction list_for_each_entry_safefunction ipoib_mcast_addr_is_validfunction ipoib_mcast_restart_taskfunction ipoib_mcast_iter_nextfunction ipoib_mcast_iter_read
Annotated Snippet
struct ipoib_mcast_iter {
struct net_device *dev;
union ib_gid mgid;
unsigned long created;
unsigned int queuelen;
unsigned int complete;
unsigned int send_only;
};
/* join state that allows creating mcg with sendonly member request */
#define SENDONLY_FULLMEMBER_JOIN 8
/*
* This should be called with the priv->lock held
*/
static void __ipoib_mcast_schedule_join_thread(struct ipoib_dev_priv *priv,
struct ipoib_mcast *mcast,
bool delay)
{
if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags))
return;
/*
* We will be scheduling *something*, so cancel whatever is
* currently scheduled first
*/
cancel_delayed_work(&priv->mcast_task);
if (mcast && delay) {
/*
* We had a failure and want to schedule a retry later
*/
mcast->backoff *= 2;
if (mcast->backoff > IPOIB_MAX_BACKOFF_SECONDS)
mcast->backoff = IPOIB_MAX_BACKOFF_SECONDS;
mcast->delay_until = jiffies + (mcast->backoff * HZ);
/*
* Mark this mcast for its delay, but restart the
* task immediately. The join task will make sure to
* clear out all entries without delays, and then
* schedule itself to run again when the earliest
* delay expires
*/
queue_delayed_work(priv->wq, &priv->mcast_task, 0);
} else if (delay) {
/*
* Special case of retrying after a failure to
* allocate the broadcast multicast group, wait
* 1 second and try again
*/
queue_delayed_work(priv->wq, &priv->mcast_task, HZ);
} else
queue_delayed_work(priv->wq, &priv->mcast_task, 0);
}
static void ipoib_mcast_free(struct ipoib_mcast *mcast)
{
struct net_device *dev = mcast->dev;
int tx_dropped = 0;
ipoib_dbg_mcast(ipoib_priv(dev), "deleting multicast group %pI6\n",
mcast->mcmember.mgid.raw);
/* remove all neigh connected to this mcast */
ipoib_del_neighs_by_gid(dev, mcast->mcmember.mgid.raw);
if (mcast->ah)
ipoib_put_ah(mcast->ah);
while (!skb_queue_empty(&mcast->pkt_queue)) {
++tx_dropped;
dev_kfree_skb_any(skb_dequeue(&mcast->pkt_queue));
}
netif_tx_lock_bh(dev);
dev->stats.tx_dropped += tx_dropped;
netif_tx_unlock_bh(dev);
kfree(mcast);
}
static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev)
{
struct ipoib_mcast *mcast;
mcast = kzalloc_obj(*mcast, GFP_ATOMIC);
if (!mcast)
return NULL;
mcast->dev = dev;
mcast->created = jiffies;
Annotation
- Immediate include surface: `linux/skbuff.h`, `linux/rtnetlink.h`, `linux/moduleparam.h`, `linux/ip.h`, `linux/in.h`, `linux/igmp.h`, `linux/inetdevice.h`, `linux/delay.h`.
- Detected declarations: `struct ipoib_mcast_iter`, `function __ipoib_mcast_schedule_join_thread`, `function ipoib_mcast_free`, `function __ipoib_mcast_add`, `function ipoib_mcast_join_finish`, `function ipoib_mcast_carrier_on_task`, `function ipoib_stop`, `function ipoib_mcast_join_complete`, `function ipoib_mcast_join`, `function ipoib_mcast_join_task`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.