Lines Matching refs:ufdev

41 static int usnic_fwd_devcmd_locked(struct usnic_fwd_dev *ufdev, int vnic_idx,  in usnic_fwd_devcmd_locked()  argument
46 struct net_device *netdev = ufdev->netdev; in usnic_fwd_devcmd_locked()
48 lockdep_assert_held(&ufdev->lock); in usnic_fwd_devcmd_locked()
58 ufdev->name, vnic_idx, cmd); in usnic_fwd_devcmd_locked()
61 ufdev->name, vnic_idx, cmd, in usnic_fwd_devcmd_locked()
66 ufdev->name, vnic_idx, cmd); in usnic_fwd_devcmd_locked()
72 static int usnic_fwd_devcmd(struct usnic_fwd_dev *ufdev, int vnic_idx, in usnic_fwd_devcmd() argument
77 spin_lock(&ufdev->lock); in usnic_fwd_devcmd()
78 status = usnic_fwd_devcmd_locked(ufdev, vnic_idx, cmd, a0, a1); in usnic_fwd_devcmd()
79 spin_unlock(&ufdev->lock); in usnic_fwd_devcmd()
86 struct usnic_fwd_dev *ufdev; in usnic_fwd_dev_alloc() local
88 ufdev = kzalloc(sizeof(*ufdev), GFP_KERNEL); in usnic_fwd_dev_alloc()
89 if (!ufdev) in usnic_fwd_dev_alloc()
92 ufdev->pdev = pdev; in usnic_fwd_dev_alloc()
93 ufdev->netdev = pci_get_drvdata(pdev); in usnic_fwd_dev_alloc()
94 spin_lock_init(&ufdev->lock); in usnic_fwd_dev_alloc()
95 BUILD_BUG_ON(sizeof(ufdev->name) != sizeof(ufdev->netdev->name)); in usnic_fwd_dev_alloc()
96 strcpy(ufdev->name, ufdev->netdev->name); in usnic_fwd_dev_alloc()
98 return ufdev; in usnic_fwd_dev_alloc()
101 void usnic_fwd_dev_free(struct usnic_fwd_dev *ufdev) in usnic_fwd_dev_free() argument
103 kfree(ufdev); in usnic_fwd_dev_free()
106 void usnic_fwd_set_mac(struct usnic_fwd_dev *ufdev, const char mac[ETH_ALEN]) in usnic_fwd_set_mac() argument
108 spin_lock(&ufdev->lock); in usnic_fwd_set_mac()
109 memcpy(&ufdev->mac, mac, sizeof(ufdev->mac)); in usnic_fwd_set_mac()
110 spin_unlock(&ufdev->lock); in usnic_fwd_set_mac()
113 void usnic_fwd_add_ipaddr(struct usnic_fwd_dev *ufdev, __be32 inaddr) in usnic_fwd_add_ipaddr() argument
115 spin_lock(&ufdev->lock); in usnic_fwd_add_ipaddr()
116 if (!ufdev->inaddr) in usnic_fwd_add_ipaddr()
117 ufdev->inaddr = inaddr; in usnic_fwd_add_ipaddr()
118 spin_unlock(&ufdev->lock); in usnic_fwd_add_ipaddr()
121 void usnic_fwd_del_ipaddr(struct usnic_fwd_dev *ufdev) in usnic_fwd_del_ipaddr() argument
123 spin_lock(&ufdev->lock); in usnic_fwd_del_ipaddr()
124 ufdev->inaddr = 0; in usnic_fwd_del_ipaddr()
125 spin_unlock(&ufdev->lock); in usnic_fwd_del_ipaddr()
128 void usnic_fwd_carrier_up(struct usnic_fwd_dev *ufdev) in usnic_fwd_carrier_up() argument
130 spin_lock(&ufdev->lock); in usnic_fwd_carrier_up()
131 ufdev->link_up = 1; in usnic_fwd_carrier_up()
132 spin_unlock(&ufdev->lock); in usnic_fwd_carrier_up()
135 void usnic_fwd_carrier_down(struct usnic_fwd_dev *ufdev) in usnic_fwd_carrier_down() argument
137 spin_lock(&ufdev->lock); in usnic_fwd_carrier_down()
138 ufdev->link_up = 0; in usnic_fwd_carrier_down()
139 spin_unlock(&ufdev->lock); in usnic_fwd_carrier_down()
142 void usnic_fwd_set_mtu(struct usnic_fwd_dev *ufdev, unsigned int mtu) in usnic_fwd_set_mtu() argument
144 spin_lock(&ufdev->lock); in usnic_fwd_set_mtu()
145 ufdev->mtu = mtu; in usnic_fwd_set_mtu()
146 spin_unlock(&ufdev->lock); in usnic_fwd_set_mtu()
149 static int usnic_fwd_dev_ready_locked(struct usnic_fwd_dev *ufdev) in usnic_fwd_dev_ready_locked() argument
151 lockdep_assert_held(&ufdev->lock); in usnic_fwd_dev_ready_locked()
153 if (!ufdev->link_up) in usnic_fwd_dev_ready_locked()
159 static int validate_filter_locked(struct usnic_fwd_dev *ufdev, in validate_filter_locked() argument
163 lockdep_assert_held(&ufdev->lock); in validate_filter_locked()
170 else if (ufdev->inaddr == 0) in validate_filter_locked()
174 else if (ntohl(ufdev->inaddr) != filter->u.ipv4.dst_addr) in validate_filter_locked()
198 usnic_fwd_alloc_flow(struct usnic_fwd_dev *ufdev, struct filter *filter, in usnic_fwd_alloc_flow() argument
209 pdev = ufdev->pdev; in usnic_fwd_alloc_flow()
226 spin_lock(&ufdev->lock); in usnic_fwd_alloc_flow()
227 status = usnic_fwd_dev_ready_locked(ufdev); in usnic_fwd_alloc_flow()
230 ufdev->name, status); in usnic_fwd_alloc_flow()
234 status = validate_filter_locked(ufdev, filter); in usnic_fwd_alloc_flow()
244 status = usnic_fwd_devcmd_locked(ufdev, uaction->vnic_idx, in usnic_fwd_alloc_flow()
248 ufdev->name, status); in usnic_fwd_alloc_flow()
252 usnic_dbg("VF %s FILTER ID:%llu", ufdev->name, a0); in usnic_fwd_alloc_flow()
257 flow->ufdev = ufdev; in usnic_fwd_alloc_flow()
260 spin_unlock(&ufdev->lock); in usnic_fwd_alloc_flow()
276 status = usnic_fwd_devcmd(flow->ufdev, flow->vnic_idx, in usnic_fwd_dealloc_flow()
282 flow->ufdev->name, status); in usnic_fwd_dealloc_flow()
285 flow->ufdev->name, flow->vnic_idx, in usnic_fwd_dealloc_flow()
296 flow->ufdev->name, flow->vnic_idx, in usnic_fwd_dealloc_flow()
304 int usnic_fwd_enable_qp(struct usnic_fwd_dev *ufdev, int vnic_idx, int qp_idx) in usnic_fwd_enable_qp() argument
310 pf_netdev = ufdev->netdev; in usnic_fwd_enable_qp()
314 status = usnic_fwd_devcmd(ufdev, vnic_idx, CMD_QP_ENABLE, in usnic_fwd_enable_qp()
331 int usnic_fwd_disable_qp(struct usnic_fwd_dev *ufdev, int vnic_idx, int qp_idx) in usnic_fwd_disable_qp() argument
337 pf_netdev = ufdev->netdev; in usnic_fwd_disable_qp()
341 status = usnic_fwd_devcmd(ufdev, vnic_idx, CMD_QP_DISABLE, in usnic_fwd_disable_qp()