cxgb_main.c (f705d735fb4fb532401b2c5adf1d1ec7cebcac3e) cxgb_main.c (46b0a854ccd07858a429beb69c992e80a742006d)
1/**************************************************************************
2
1/**************************************************************************
2
3Copyright (c) 2007, Chelsio Inc.
3Copyright (c) 2007-2008, Chelsio Inc.
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11
122. Neither the name of the Chelsio Corporation nor the names of its
12 2. Neither the name of the Chelsio Corporation nor the names of its
13 contributors may be used to endorse or promote products derived from
14 this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

--- 697 unchanged lines hidden (view full) ---

718 if (is_offload(sc)) {
719 cxgb_adapter_unofld(sc);
720 if (isset(&sc->open_device_map, OFFLOAD_DEVMAP_BIT))
721 offload_close(&sc->tdev);
722 else
723 printf("cxgb_free: DEVMAP_BIT not set\n");
724 } else
725 printf("not offloading set\n");
13 contributors may be used to endorse or promote products derived from
14 this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

--- 697 unchanged lines hidden (view full) ---

718 if (is_offload(sc)) {
719 cxgb_adapter_unofld(sc);
720 if (isset(&sc->open_device_map, OFFLOAD_DEVMAP_BIT))
721 offload_close(&sc->tdev);
722 else
723 printf("cxgb_free: DEVMAP_BIT not set\n");
724 } else
725 printf("not offloading set\n");
726
726#ifdef notyet
727 if (sc->flags & CXGB_OFLD_INIT)
728 cxgb_offload_deactivate(sc);
727 if (sc->flags & CXGB_OFLD_INIT)
728 cxgb_offload_deactivate(sc);
729#endif
729 free(sc->filters, M_DEVBUF);
730 t3_sge_free(sc);
731
732 cxgb_offload_exit();
733
734 if (sc->udbs_res != NULL)
735 bus_release_resource(sc->dev, SYS_RES_MEMORY, sc->udbs_rid,
736 sc->udbs_res);

--- 990 unchanged lines hidden (view full) ---

1727 if (!adap_up)
1728 err = cxgb_up(adapter);
1729 ADAPTER_UNLOCK(pi->adapter);
1730 if (err)
1731 return (err);
1732
1733 t3_tp_set_offload_mode(adapter, 1);
1734 tdev->lldev = pi->ifp;
730 free(sc->filters, M_DEVBUF);
731 t3_sge_free(sc);
732
733 cxgb_offload_exit();
734
735 if (sc->udbs_res != NULL)
736 bus_release_resource(sc->dev, SYS_RES_MEMORY, sc->udbs_rid,
737 sc->udbs_res);

--- 990 unchanged lines hidden (view full) ---

1728 if (!adap_up)
1729 err = cxgb_up(adapter);
1730 ADAPTER_UNLOCK(pi->adapter);
1731 if (err)
1732 return (err);
1733
1734 t3_tp_set_offload_mode(adapter, 1);
1735 tdev->lldev = pi->ifp;
1735 err = cxgb_offload_activate(adapter);
1736 if (err)
1737 goto out;
1738
1739 init_port_mtus(adapter);
1740 t3_load_mtus(adapter, adapter->params.mtus, adapter->params.a_wnd,
1741 adapter->params.b_wnd,
1742 adapter->params.rev == 0 ?
1743 adapter->port[0].ifp->if_mtu : 0xffff);
1744 init_smt(adapter);
1745
1736
1737 init_port_mtus(adapter);
1738 t3_load_mtus(adapter, adapter->params.mtus, adapter->params.a_wnd,
1739 adapter->params.b_wnd,
1740 adapter->params.rev == 0 ?
1741 adapter->port[0].ifp->if_mtu : 0xffff);
1742 init_smt(adapter);
1743
1746 /* Call back all registered clients */
1747 cxgb_add_clients(tdev);
1748
1749out:
1750 /* restore them in case the offload module has changed them */
1751 if (err) {
1752 t3_tp_set_offload_mode(adapter, 0);
1753 clrbit(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT);
1754 cxgb_set_dummy_ops(tdev);
1755 }
1756 return (err);
1757}
1758
1759static int
1760offload_close(struct t3cdev *tdev)
1761{
1762 struct adapter *adapter = tdev2adap(tdev);
1763
1764 if (!isset(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT))
1765 return (0);
1766
1744 /* restore them in case the offload module has changed them */
1745 if (err) {
1746 t3_tp_set_offload_mode(adapter, 0);
1747 clrbit(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT);
1748 cxgb_set_dummy_ops(tdev);
1749 }
1750 return (err);
1751}
1752
1753static int
1754offload_close(struct t3cdev *tdev)
1755{
1756 struct adapter *adapter = tdev2adap(tdev);
1757
1758 if (!isset(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT))
1759 return (0);
1760
1767 /* Call back all registered clients */
1768 cxgb_remove_clients(tdev);
1769 tdev->lldev = NULL;
1770 cxgb_set_dummy_ops(tdev);
1771 t3_tp_set_offload_mode(adapter, 0);
1772 clrbit(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT);
1773
1774 ADAPTER_LOCK(adapter);
1775 if (!adapter->open_device_map)
1776 cxgb_down_locked(adapter);

--- 936 unchanged lines hidden ---
1761 tdev->lldev = NULL;
1762 cxgb_set_dummy_ops(tdev);
1763 t3_tp_set_offload_mode(adapter, 0);
1764 clrbit(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT);
1765
1766 ADAPTER_LOCK(adapter);
1767 if (!adapter->open_device_map)
1768 cxgb_down_locked(adapter);

--- 936 unchanged lines hidden ---